Skip to content

feat: accept --verbose as a global flag before the subcommand #27

@HelenGreul

Description

@HelenGreul

Problem or motivation

--verbose currently only works when placed after the subcommand:

poly push --verbose   ✅ works
poly --verbose push   ❌ fails

This 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions