MCPcopy Create free account
hub / github.com/Mister-leo/fssh / cmdGlobalUnset

Function cmdGlobalUnset

cmd/fssh/shell_commands.go:886–910  ·  view source on GitHub ↗

cmdGlobalUnset removes a single option

(ctx *ShellContext, args string)

Source from the content-addressed store, hash-verified

884
885// cmdGlobalUnset removes a single option
886func cmdGlobalUnset(ctx *ShellContext, args string) error {
887 key := strings.TrimSpace(args)
888 if key == "" {
889 fmt.Println("Usage: global unset <key>")
890 fmt.Println("\nSupported options:")
891
892 // Display all options with descriptions
893 for _, key := range sshconfig.GetGlobalOptionNames() {
894 desc, _, _ := sshconfig.GetGlobalOptionHelp(key)
895 fmt.Printf(" %-30s - %s\n", key, desc)
896 }
897
898 fmt.Println("\nExample:")
899 fmt.Println(" global unset UseKeychain")
900 return nil
901 }
902
903 if err := sshconfig.UnsetGlobalOption(key); err != nil {
904 return fmt.Errorf("failed to unset option: %w", err)
905 }
906
907 fmt.Printf("\n✓ Unset %s\n", key)
908 fmt.Println("✓ Backup created")
909 return nil
910}
911
912// cmdGlobal routes global subcommands
913func cmdGlobal(ctx *ShellContext, args string) error {

Callers 1

cmdGlobalFunction · 0.85

Calls 3

GetGlobalOptionNamesFunction · 0.92
GetGlobalOptionHelpFunction · 0.92
UnsetGlobalOptionFunction · 0.92

Tested by

no test coverage detected