Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
lnperry wants to merge7 commits intopython:main
base:main
Choose a base branch
Loading
fromlnperry:gh-134200

Conversation

lnperry
Copy link

@lnperrylnperry commentedMay 20, 2025
edited by bedevere-appbot
Loading

RefactorsHelpFormatter 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:

  1. 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.

    • A "reasonable" argument is one whose own invocation string (plus
      indent and minimal padding) does not exceed the overall maximum help
      position (derived frommax_help_position and terminal width, e.g., 24).
    • This calculated alignment column is itself capped by this overall
      maximum help position.
  2. Help text for arguments is formatted against this single global column:

    • Shorter arguments are padded so their help text (and any wrapped lines)
      begins at this alignment column.
    • Argument invocations too long to fit this same-line alignment will
      have their help text start on the next line, also indented to this
      alignment column.

This ensures:

  • Consistent alignment of help descriptions across all sections.
  • Outlier long options no longer distort the layout for other arguments.
  • Sets of only short options are aligned compactly based on their local
    longest member, rather than being forced to an unnecessarily wide default.
  • The option defining the alignment has exactly two spaces before its help.

@python-cla-bot
Copy link

python-cla-botbot commentedMay 20, 2025
edited
Loading

All commit authors signed the Contributor License Agreement.

CLA signed

@bedevere-app
Copy link

Most changes to Pythonrequire a NEWS entry. Add one using theblurb_it web app or theblurb command-line tool.

If this change has little impact on Python users, wait for a maintainer to apply theskip news label instead.

@bedevere-app
Copy link

Most changes to Pythonrequire a NEWS entry. Add one using theblurb_it web app or theblurb command-line tool.

If this change has little impact on Python users, wait for a maintainer to apply theskip news label instead.

@bedevere-app
Copy link

Most changes to Pythonrequire a NEWS entry. Add one using theblurb_it web app or theblurb command-line tool.

If this change has little impact on Python users, wait for a maintainer to apply theskip news label instead.

@bedevere-app
Copy link

Most changes to Pythonrequire a NEWS entry. Add one using theblurb_it web app or theblurb command-line tool.

If this change has little impact on Python users, wait for a maintainer to apply theskip news label instead.

@bedevere-app
Copy link

Most changes to Pythonrequire a NEWS entry. Add one using theblurb_it web app or theblurb command-line tool.

If this change has little impact on Python users, wait for a maintainer to apply theskip news label instead.

@bedevere-app
Copy link

Most changes to Pythonrequire a NEWS entry. Add one using theblurb_it web app or theblurb command-line tool.

If this change has little impact on Python users, wait for a maintainer to apply theskip news label instead.

@bedevere-app
Copy link

Most changes to Pythonrequire a NEWS entry. Add one using theblurb_it web app or theblurb command-line tool.

If this change has little impact on Python users, wait for a maintainer to apply theskip news label instead.

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

@savannahostrowskisavannahostrowskiAwaiting requested review from savannahostrowskisavannahostrowski is a code owner

Assignees
No one assigned
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

1 participant
@lnperry

[8]ページ先頭

©2009-2025 Movatter.jp