MCPcopy Create free account
hub / github.com/AnukarOP/claude-code-leaked / isKnownSubcommand

Function isKnownSubcommand

source code/utils/shell/specPrefix.ts:42–50  ·  view source on GitHub ↗
(arg: string, spec: CommandSpec | null)

Source from the content-addressed store, hash-verified

40// Check if an argument matches a known subcommand (case-insensitive: PS
41// callers pass original-cased args; fig spec names are lowercase)
42function isKnownSubcommand(arg: string, spec: CommandSpec | null): boolean {
43 if (!spec?.subcommands?.length) return false
44 const argLower = arg.toLowerCase()
45 return spec.subcommands.some(sub =>
46 Array.isArray(sub.name)
47 ? sub.name.some(n => n.toLowerCase() === argLower)
48 : sub.name.toLowerCase() === argLower,
49 )
50}
51
52// Check if a flag takes an argument based on spec, or use heuristic
53function flagTakesArg(

Callers 3

flagTakesArgFunction · 0.70
findFirstSubcommandFunction · 0.70
buildPrefixFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected