Merge branch 'feature/add-move-command' into dev

Add move command feature:
- Allows moving a host from one config file to another when using includes
- Available both in the TUI interface and via CLI with 'sshm move'
This commit is contained in:
2025-09-10 09:37:24 +02:00
8 changed files with 629 additions and 52 deletions

28
cmd/move.go Normal file
View 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)
}