feat: implement edit and delete host commands
- Add edit command with flag-based and interactive update modes - Add delete command with confirmation prompt and --force flag - Include delete alias 'rm' for convenience - Add comprehensive tests for both commands - Update project state documentation
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestEditCommandExists(t *testing.T) {
|
||||
if editCmd == nil {
|
||||
t.Fatal("editCmd should not be nil")
|
||||
}
|
||||
|
||||
if editCmd.Use != "edit <host-name-or-id>" {
|
||||
t.Errorf("expected Use 'edit <host-name-or-id>', got '%s'", editCmd.Use)
|
||||
}
|
||||
|
||||
if editCmd.Short == "" {
|
||||
t.Error("Short description should not be empty")
|
||||
}
|
||||
}
|
||||
|
||||
func TestEditCommandFlags(t *testing.T) {
|
||||
expectedFlags := []string{"host", "port", "user", "password", "key", "auth-type", "group", "tags", "notes", "name"}
|
||||
for _, flagName := range expectedFlags {
|
||||
if editCmd.Flags().Lookup(flagName) == nil {
|
||||
t.Errorf("flag '%s' should be defined", flagName)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestEditArgs(t *testing.T) {
|
||||
if editCmd.Args == nil {
|
||||
t.Error("Args validator should not be nil")
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user