Skip to content
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

Store raw help string for commands #2151

Merged
merged 2 commits into from
Feb 21, 2022

Conversation

stephenfin
Copy link
Contributor

@stephenfin stephenfin commented Dec 9, 2021

Some tools, such as sphinx-click, may wish to access the full help string for a command including any text after the form feed character (which indicates truncation). Make this possible by storing this help string before truncation. Truncation is achieved by the users of the attribute.

This is an alternative to #2150, based on feedback on the issue, #2149

Checklist:

  • Add tests that demonstrate the correct behavior of the change. Tests should fail without the change.
  • Add or update relevant docs, in the docs folder and in code.
  • Add an entry in CHANGES.rst summarizing the change and linking to the issue.
  • Add .. versionchanged:: entries in any relevant code docs.
  • Run pre-commit hooks and fix any issues.
  • Run pytest and tox, no tests failed.

src/click/core.py Outdated Show resolved Hide resolved
@davidism davidism added this to the 8.1.0 milestone Dec 28, 2021
stephenfin and others added 2 commits February 20, 2022 12:04
Some tools, such as sphinx-click [1], may wish to access the full help
string for a command including any text after the form feed character
(which indicates truncation [2]). Make this possible by storing the
help string without truncation and instead truncate when we use this
string (i.e. truncate on load, not on store).

[1] click-contrib/sphinx-click#56
[2] https://click.palletsprojects.com/en/latest/documentation/#truncating-help-texts

Signed-off-by: Stephen Finucane <stephen@that.guru>
@davidism
Copy link
Member

Added another commit to defer inspect.cleandoc() for help, epilog, and short_help.

@davidism davidism merged commit c01e2b8 into pallets:main Feb 21, 2022
@stephenfin stephenfin deleted the store-untruncated-help branch February 21, 2022 23:30
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 8, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Access untruncated help string
2 participants