-
Notifications
You must be signed in to change notification settings - Fork 8
feat: accept --verbose as a global flag before the subcommand #27
Description
Problem or motivation
--verbose currently only works when placed after the subcommand:
poly push --verbose ✅ works
poly --verbose push ❌ failsThis is non-standard. Every major CLI that has global flags (git, kubectl, gh, docker) accepts them before the subcommand. Developers build muscle memory from these tools and will naturally try poly --verbose push when debugging, hit a confusing parse error, and not understand why.
Proposed solution
Accept --verbose in both positions by hoisting it to the top-level parser:
poly --verbose push # global position — works
poly push --verbose # after subcommand — still works (backwards compatible)Argparse supports this via parser.add_argument('--verbose', ...) on the root parser in addition to (or instead of) each subparser. The value can be propagated to subcommand handlers the same way it is today.
Alternatives considered
Keeping --verbose subcommand-only and just documenting the position requirement. This avoids a parser change but doesn't fix the underlying ergonomic mismatch with developer expectations.
Scope
CLI commands