(args: string[])
| 146 | * print usage and exit before a subcommand branch can launch the UI. |
| 147 | */ |
| 148 | export function isSubcommandHelpInvocation(args: string[]): string | null { |
| 149 | const sub = args[0]; |
| 150 | if (!sub) return null; |
| 151 | const canonical = SUBCOMMAND_HELP_ALIASES[sub] ?? sub; |
| 152 | if (!(canonical in SUBCOMMAND_HELP)) return null; |
| 153 | return hasHelpFlag(args.slice(1)) ? canonical : null; |
| 154 | } |
| 155 | |
| 156 | /** Usage text for a canonical subcommand (falls back to top-level help). */ |
| 157 | export function formatSubcommandHelp(subcommand: string): string { |
no test coverage detected