mirror of
https://github.com/tiennm99/ccs.git
synced 2026-10-11 12:09:03 +00:00
fix(cliproxy): keep --help working for all subcommands
The earlier help-gating overcorrected: scoping global help to 'no real subcommand' meant 'cliproxy status --help' (and list/quota) ran the command and ignored --help. Restore global help on --help/-h anywhere (order-insensitive), carving out only 'routing affinity --help', which renders its own help.
This commit is contained in:
1 parent
310f4f6e52
commit
d8cd2f94b5
1 file changed
+6
-6
@@ -146,12 +146,12 @@ export async function handleCliproxyCommand(args: string[]): Promise<void> {
|
|||||||
const verbose = hasAnyFlag(remainingArgs, ['--verbose', '-v']);
|
const verbose = hasAnyFlag(remainingArgs, ['--verbose', '-v']);
|
||||||
const command = remainingArgs[0];
|
const command = remainingArgs[0];
|
||||||
|
|
||||||
// Show global cliproxy help when there is no real subcommand (no args, or the
|
// Show global cliproxy help whenever --help/-h appears (order-insensitive, so
|
||||||
// first token is a flag) and --help/-h appears anywhere — order-insensitive, so
|
// `cliproxy status --help` and `cliproxy --verbose --help` both work). The one
|
||||||
// `cliproxy --verbose --help` still works. Real subcommands (e.g.
|
// exception is `routing affinity --help`, which renders affinity-specific help
|
||||||
// `routing affinity --help`) handle --help themselves after dispatch.
|
// after dispatch (handled below).
|
||||||
const hasRealSubcommand = typeof command === 'string' && !command.startsWith('-');
|
const isRoutingAffinity = command === 'routing' && remainingArgs[1] === 'affinity';
|
||||||
if (!hasRealSubcommand && hasAnyFlag(remainingArgs, ['--help', '-h'])) {
|
if (!isRoutingAffinity && hasAnyFlag(remainingArgs, ['--help', '-h'])) {
|
||||||
await showHelp();
|
await showHelp();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user