-
-
Notifications
You must be signed in to change notification settings - Fork 32k
gh-134200: Add adaptive global alignment for help text #134308
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Most changes to Python require a NEWS entry. Add one using the blurb_it web app or the blurb command-line tool. If this change has little impact on Python users, wait for a maintainer to apply the |
Most changes to Python require a NEWS entry. Add one using the blurb_it web app or the blurb command-line tool. If this change has little impact on Python users, wait for a maintainer to apply the |
Most changes to Python require a NEWS entry. Add one using the blurb_it web app or the blurb command-line tool. If this change has little impact on Python users, wait for a maintainer to apply the |
Most changes to Python require a NEWS entry. Add one using the blurb_it web app or the blurb command-line tool. If this change has little impact on Python users, wait for a maintainer to apply the |
Most changes to Python require a NEWS entry. Add one using the blurb_it web app or the blurb command-line tool. If this change has little impact on Python users, wait for a maintainer to apply the |
Most changes to Python require a NEWS entry. Add one using the blurb_it web app or the blurb command-line tool. If this change has little impact on Python users, wait for a maintainer to apply the |
Most changes to Python require a NEWS entry. Add one using the blurb_it web app or the blurb command-line tool. If this change has little impact on Python users, wait for a maintainer to apply the |
Refactors
HelpFormatter
to improve help text readability and consistency,addressing issues where argument string lengths varied widely.
Previously, a single very long option could push all help text excessively
to the right, or groups of only short options might not align optimally.
Key changes:
A global help alignment column is now calculated by finding the display
endpoint of the longest "reasonable" argument invocation string across
all sections, adding a 2-space padding.
indent and minimal padding) does not exceed the overall maximum help
position (derived from
max_help_position
and terminal width, e.g., 24).maximum help position.
Help text for arguments is formatted against this single global column:
begins at this alignment column.
have their help text start on the next line, also indented to this
alignment column.
This ensures:
longest member, rather than being forced to an unnecessarily wide default.