fix(cli): handle standalone short options like -f that take values
CI / benchmark-publish (pull_request) Has been skipped
CI / build (pull_request) Successful in 20s
CI / push-validation (pull_request) Successful in 21s
CI / helm (pull_request) Successful in 24s
CI / lint (pull_request) Successful in 27s
CI / quality (pull_request) Successful in 35s
CI / typecheck (pull_request) Successful in 1m7s
CI / security (pull_request) Successful in 1m8s
CI / e2e_tests (pull_request) Failing after 1m51s
CI / integration_tests (pull_request) Failing after 4m11s
CI / unit_tests (pull_request) Successful in 5m27s
CI / docker (pull_request) Successful in 1m22s
CI / coverage (pull_request) Successful in 10m53s
CI / status-check (pull_request) Failing after 1s
CI / benchmark-regression (pull_request) Successful in 57m23s

When a global short option like -f (for --format) appears after a subcommand
as a standalone token (e.g., 'agents info -f json'), it was not being promoted
because the code only handled fused forms like '-fjson'.

This fix adds a check for standalone short options in _GLOBAL_VALUE_SHORT_OPTIONS
that consume the following argument, allowing 'agents info -f json' to work
correctly in addition to 'agents info -fjson'.
This commit is contained in:
2026-04-14 23:38:38 +00:00
parent ceb77376c9
commit 8640d7fac2
+9
View File
@@ -83,6 +83,15 @@ def _promote_global_options(args: list[str]) -> list[str]:
i += 1
continue
if arg in _GLOBAL_VALUE_SHORT_OPTIONS:
if i + 1 < length:
promoted.extend([arg, args[i + 1]])
i += 2
else:
remaining.append(arg)
i += 1
continue
remaining.append(arg)
i += 1