Impossible to get single newlines in help text
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 17.7k
- Forks
- 2.3k
- Avg merge
- 1d 30m
- Merged PRs (30d)
- 18
Description
The expected format is:
--annotations [disabled|comment]
Specify the type of annotations to include in the XML output.
'Disabled' - no annotations.
'Comment' - annotations as comments.
The actual format is either:
--annotations [disabled|comment]
Specify the type of annotations to include in the XML output.
'Disabled' - no annotations.
'Comment' - annotations as comments.
or:
--annotations [disabled|comment]
Specify the type of annotations to include in the XML output. 'Disabled' - no annotations. 'Comment' - annotations as comments.
However the text either has no newlines, or it has double newlines.
I expected this to work:
@click.option(
"--annotations",
type=click.Choice(Annotations, case_sensitive=False),
default=Annotations.Comment,
help="""Specify the type of annotations to include in the XML output.
\b
'Disabled' - no annotations.
'Comment' - annotations as comments.""",
)
But that ends up without any newlines.
Adding an extra blank line before the \b does work, but that also results in an extra blank line in the output (as seen above):
@click.option(
"--annotations",
type=click.Choice(Annotations, case_sensitive=False),
default=Annotations.Comment,
help="""Specify the type of annotations to include in the XML output.
\b
'Disabled' - no annotations.
'Comment' - annotations as comments.""",
)
Environment:
- Python version: 3.10.11
- Click version: 8.2.1
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the formatting with the shown click.option example on Python 3.10.11 and Click 8.2.1, then trace the help-text rendering path responsible for whitespace and line breaks. Done means the documented single-newline format is produced without requiring an extra blank line, while the existing alternatives remain correct.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100