cmdGlobalUnset removes a single option
(ctx *ShellContext, args string)
| 884 | |
| 885 | // cmdGlobalUnset removes a single option |
| 886 | func 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 |
| 913 | func cmdGlobal(ctx *ShellContext, args string) error { |
no test coverage detected