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

Function cmdGlobal

cmd/fssh/shell_commands.go:913–942  ·  view source on GitHub ↗

cmdGlobal routes global subcommands

(ctx *ShellContext, args string)

Source from the content-addressed store, hash-verified

911
912// cmdGlobal routes global subcommands
913func 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}

Callers 1

runShellFunction · 0.85

Calls 4

cmdGlobalShowFunction · 0.85
cmdGlobalEditFunction · 0.85
cmdGlobalSetFunction · 0.85
cmdGlobalUnsetFunction · 0.85

Tested by

no test coverage detected