From 0e0aec0f169abee30ec255991c8d7bd8a73a6ced Mon Sep 17 00:00:00 2001 From: CleverThis Date: Tue, 14 Apr 2026 23:38:38 +0000 Subject: [PATCH] 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'. --- src/cleveragents/cli/main.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/cleveragents/cli/main.py b/src/cleveragents/cli/main.py index 149fa1f3c..6203a0183 100644 --- a/src/cleveragents/cli/main.py +++ b/src/cleveragents/cli/main.py @@ -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