Skip to content

AI junk#3664

Closed
mayoka0 wants to merge 2 commits into
pallets:mainfrom
mayoka0:fix/usage-no-hyphen-break
Closed

AI junk#3664
mayoka0 wants to merge 2 commits into
pallets:mainfrom
mayoka0:fix/usage-no-hyphen-break

Conversation

@mayoka0

@mayoka0 mayoka0 commented Jul 7, 2026

Copy link
Copy Markdown

Fixes #3362.

HelpFormatter.write_usage wrapped the arguments string with the default break_on_hyphens=True, so a long option that got pushed onto a new line could be split at one of its internal hyphens:

Usage: program --enable-verbose-logging --output-file-path --max-
               retry-count --disable-cache-mode --config-file-
               location

This adds a break_on_hyphens parameter to wrap_text and passes break_on_hyphens=False from write_usage, so the usage line only ever wraps between options (at spaces):

Usage: program --enable-verbose-logging --output-file-path
               --max-retry-count --disable-cache-mode
               --config-file-location

Other wrap_text callers are unaffected — the default stays True.

Added test_write_usage_does_not_break_options_at_hyphens. Full tests/test_formatting.py passes (36) and a broader run of test_formatting.py + test_basic.py (129) is green.

mayoka0 added 2 commits July 6, 2026 23:51
HelpFormatter.write_usage wrapped the argument string with the default
break_on_hyphens=True, so a long option pushed onto a new line could be
split at one of its internal hyphens (e.g. '--max-' / 'retry-count').

Add a break_on_hyphens parameter to wrap_text and pass break_on_hyphens=
False from write_usage, so the usage line only wraps between options.
Other wrap_text callers are unaffected (default stays True).
@davidism davidism closed this Jul 7, 2026
@davidism davidism changed the title Don't break options at hyphens in the usage line (#3362) AI junk Jul 7, 2026
@mayoka0 mayoka0 deleted the fix/usage-no-hyphen-break branch July 7, 2026 04:50
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