Skip to content

[BUG] argparse -f conflict: --diff-base PR introduced global --format/-f that clashes with subparser --format/-f #174

Description

@Wolfvin

Problem

Any codelens CLI invocation crashes with:

argparse.ArgumentError: argument --format/-f: conflicting option string(s): -f

Root cause: PR #157 (--diff-base flag) added --format/-f at the global parser level (line ~926 in scripts/codelens.py). But subparsers already define --format/-f at the subparser level. argparse does not allow duplicate short flags across parent and child parsers.

Reported independently by workers fixing PR #139 (formatters) and PR #141 (baseline diff).

Impact

Fix

Two options:

Option A (recommended): Remove the -f short alias from the global --format flag added in PR #157. Keep --format (long form only) at global level. Subparsers keep their --format/-f. This is non-breaking — users who use codelens -f json can use codelens --format json instead.

Option B: Remove the global --format flag entirely from PR #157's addition. The --diff-base flag doesn't need format at global level — format is already available per-subcommand.

Definition of Done

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions