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