cmdGlobal routes global subcommands
(ctx *ShellContext, args string)
| 911 | |
| 912 | // cmdGlobal routes global subcommands |
| 913 | func cmdGlobal(ctx *ShellContext, args string) error { |
| 914 | args = strings.TrimSpace(args) |
| 915 | |
| 916 | if args == "" || args == "show" { |
| 917 | return cmdGlobalShow(ctx) |
| 918 | } |
| 919 | if args == "edit" { |
| 920 | return cmdGlobalEdit(ctx) |
| 921 | } |
| 922 | if args == "set" || strings.HasPrefix(args, "set ") { |
| 923 | if args == "set" { |
| 924 | return cmdGlobalSet(ctx, "") |
| 925 | } |
| 926 | return cmdGlobalSet(ctx, args[4:]) |
| 927 | } |
| 928 | if args == "unset" || strings.HasPrefix(args, "unset ") { |
| 929 | if args == "unset" { |
| 930 | return cmdGlobalUnset(ctx, "") |
| 931 | } |
| 932 | return cmdGlobalUnset(ctx, args[6:]) |
| 933 | } |
| 934 | |
| 935 | // Unknown subcommand |
| 936 | fmt.Println("Unknown global subcommand. Usage:") |
| 937 | fmt.Println(" global show - Display current global config") |
| 938 | fmt.Println(" global edit - Edit global config interactively") |
| 939 | fmt.Println(" global set <key> <value> - Set a single option") |
| 940 | fmt.Println(" global unset <key> - Remove a single option") |
| 941 | return nil |
| 942 | } |
no test coverage detected