fix(cli): handle standalone short options like -f that take values

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
committed by drew
parent cb77abb6c7
commit 0e0aec0f16
+9
View File
@@ -84,6 +84,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