Skip to content

fix: hide INTEGER from help for count=True options (closes #1869)#1871

Open
pooyanazad wants to merge 2 commits into
fastapi:masterfrom
pooyanazad:master
Open

fix: hide INTEGER from help for count=True options (closes #1869)#1871
pooyanazad wants to merge 2 commits into
fastapi:masterfrom
pooyanazad:master

Conversation

@pooyanazad

@pooyanazad pooyanazad commented Jun 30, 2026

Copy link
Copy Markdown

Pull Request

Discussion: #1869

Description

Fixed #1869count=True options were incorrectly showing INTEGER in the help text, making it look like they take a value (e.g. --verbose 3), when they actually work as flag-like counters (e.g. --verbose --verbose).

Two small changes:

  • typer/core.py: TyperOption.make_metavar() now returns "" for count=True options, matching how Click handles count internally.
  • typer/rich_utils.py: _print_options_panel() now skips appending the type name (e.g. INTEGER RANGE) for count options.

Before: --verbose INTEGER [default: 0]
After: --verbose [default: 0]

AI Disclaimer

Review with Claude Opus 4.6

Checklist

  • This PR links to a GitHub Discussion for the proposed code change.
  • I added tests for the change.
  • The new or updated tests fail on the main branch and pass on this PR.
  • Coverage stays at 100%.*
  • The documentation explains the change if needed.

*Coverage note: test_others.py::test_atomic_write_example has a pre-existing failure unrelated to this change. All other tests pass (38/38 in test_core.py and test_rich_utils.py).

@pooyanazad

Copy link
Copy Markdown
Author

Hi! Could someone please add the bug label so the CI checks can pass? Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

count=True options are shown as INTEGER in help

2 participants