Skip to content

Avoid hyphen breaks in usage option tokens#3385

Closed
cyphercodes wants to merge 1 commit into
pallets:mainfrom
cyphercodes:fix-usage-hyphen-wrap-3362
Closed

Avoid hyphen breaks in usage option tokens#3385
cyphercodes wants to merge 1 commit into
pallets:mainfrom
cyphercodes:fix-usage-hyphen-wrap-3362

Conversation

@cyphercodes
Copy link
Copy Markdown

Fixes #3362

This prevents HelpFormatter.write_usage from wrapping hyphenated option tokens at internal hyphens when the full token can fit on the next line. It also adds a regression test and changelog entry.

Tests:

  • PYTHONPATH=src python -m pytest -q tests/test_formatting.py
  • python -m ruff check src/click/formatting.py tests/test_formatting.py
  • PYTHONPATH=src python -m pytest -q

@davidism davidism closed this Apr 27, 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.

HelpFormatter.write_usage breaks options at a hyphen

2 participants