Skip to content

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

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

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!

@svlandeg svlandeg left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi, thanks for the contribution. Please follow the contributor guidelines and do not open issues or PRs directly. Always start with a discussion thread first. This helps us reduce AI-generated slop and maintainer's work load.

About this particular issue: open a discussion thread. I am working on related code and I can review this, but we won't be accepting user PRs as they will conflict with a refactor that is already taking place. Thanks! 🙏

@svlandeg svlandeg closed this Jul 7, 2026
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

3 participants