mirror of
https://github.com/Gu1llaum-3/sshm.git
synced 2026-01-27 03:04:21 +01:00
feat: add move command to relocate SSH hosts between config files
- Add 'move' command with interactive file selector - Implement atomic host moving between SSH config files - Support for configs with include directives - Add comprehensive error handling and validation - Update help screen with improved two-column layout
This commit is contained in:
28
cmd/move.go
Normal file
28
cmd/move.go
Normal file
@@ -0,0 +1,28 @@
|
||||
package cmd
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/Gu1llaum-3/sshm/internal/ui"
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
var moveCmd = &cobra.Command{
|
||||
Use: "move <hostname>",
|
||||
Short: "Move an existing SSH host configuration to another config file",
|
||||
Long: `Move an existing SSH host configuration to another config file with an interactive file selector.`,
|
||||
Args: cobra.ExactArgs(1),
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
hostname := args[0]
|
||||
|
||||
err := ui.RunMoveForm(hostname, configFile)
|
||||
if err != nil {
|
||||
fmt.Printf("Error moving host: %v\n", err)
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
func init() {
|
||||
rootCmd.AddCommand(moveCmd)
|
||||
}
|
||||
Reference in New Issue
Block a user