Improve text wrapping
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 17.7k
- Forks
- 2.3k
- Avg merge
- 1d 30m
- Merged PRs (30d)
- 18
Description
Currently click has 2 modes to display a help text:
- Word-wrap the entire blob, and remove all other whitespaces
- Preserve newlines, but disable word-wrapping
- with a console width of 60, visualized with the
*:
************************************************************
Usage: click_wrapping.py [OPTIONS]
Options:
--test [value1|value2] Example text to show word
wrapping. 'Value1' - short
comment. 'Value2' - A longer
comment that should wrap to the
next line.
--help Show this message and exit.
************************************************************
- with a console width of 60, visualized with the
*:
************************************************************
Usage: click_wrapping.py [OPTIONS]
Options:
--test [value1|value2] Example text to show word wrapping.
'Value1' - short comment.
'Value2' - A longer comment that should wrap to the next line.
--help Show this message and exit.
************************************************************
The 2nd option is slightly problematic, because on an actual console with width of 60, it looks like this:
************************************************************
Usage: click_wrapping.py [OPTIONS]
Options:
--test [value1|value2] Example text to show word wrapping
.
'Value1' - short comment.
'Value2' - A longer comment that s
hould wrap to the next line.
--help Show this message and exit.
************************************************************
And that should probably be more along the lines of:
************************************************************
Usage: click_wrapping.py [OPTIONS]
Options:
--test [value1|value2] Example text to show word
wrapping.
'Value1' - short comment.
'Value2' - A longer comment that
should wrap to the next line.
--help Show this message and exit.
************************************************************
Would a PR to fix this be accepted?
(As in, preserve newlines but still wrap on the console width)
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 with Click's text-wrapping behavior described in the linked documentation and reproduce the examples at console width 60. Trace the help-text formatting entry point and add coverage for preserving newlines while still wrapping to the console width; done means long lines no longer overflow or split words unexpectedly.
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