Skip to content

Store raw help string for commands#2151

Merged
davidism merged 2 commits into
pallets:mainfrom
stephenfin:store-untruncated-help
Feb 21, 2022
Merged

Store raw help string for commands#2151
davidism merged 2 commits into
pallets:mainfrom
stephenfin:store-untruncated-help

Conversation

@stephenfin
Copy link
Copy Markdown
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.

Comment thread src/click/core.py Outdated
@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 davidism force-pushed the store-untruncated-help branch from 5f0251f to 92b30e4 Compare February 21, 2022 18:02
@davidism
Copy link
Copy Markdown
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