Comments (4)
Ok, this should now be fixed. I think that the previous behaviour of only printing the first line was there because I was trying to mimic the click behaviour of showing a short help text for groups but then having longer help text when doing help on that specific subcommand.
Now it's slightly smarter and takes the first paragraph, according to double newlines. Single newlines are stripped (unless using Markdown, but then they're ignored).
from rich-click.
Thanks for reporting! Does this work as you'd expect with vanilla click output?
from rich-click.
Vanilla click doesn't allow command descriptions to be rendered over multiple lines, but it does support multi-line strings that use """
.
Because the command descriptions are limited to a single line, click tries to be smart and only displays the text that comes before the first period:
def test_command(input, output, threads):
"""
Let's build an almighty mountain. Maybe, just to play a little, we'll put a
little tree here. Look around, look at what we have. Beauty is everywhere,
you only have to look to see it. The only prerequisite is that it makes you
happy. If it makes you happy then it's good. We don't have to be concerned
about it. We just have to let it fall where it will. By now you should be
quite happy about what's happening here.
"""
Commands:
test-command Let's build an almighty mountain.
If there's no period before the maximum width of the help dialog, it will use ellipsis:
def test_command(input, output, threads):
"""
Let's build an almighty mountain Maybe, just to play a little, we'll put a
little tree here. Look around, look at what we have. Beauty is everywhere,
you only have to look to see it. The only prerequisite is that it makes you
happy. If it makes you happy then it's good. We don't have to be concerned
about it. We just have to let it fall where it will. By now you should be
quite happy about what's happening here.
"""
Commands:
test-command Let's build an almighty mountain Maybe, just to play a...
My preference is the way rich-click
renders when you use a single-line string (that is, shows the full description in the dialogue). If the goal is to stay as close to vanilla as possible, I think using ellipsis is fine (although I would use the true ellipsis character to save characters: …
).
from rich-click.
Thanks 🙏🏻 I think displaying the full text is better too (might be scope for a config option there though I guess 🤔).
I'll take a look into fixing this ASAP.
from rich-click.
Related Issues (20)
- Test help output in `rich-click` CLI is robust to lazy loading of modules. HOT 3
- Add `pytest-snapshot` or `syrupy` or similar HOT 1
- Expose a way to send usage information to stderr HOT 9
- Rich-Click does not translate the ascii codes into colors on windows 64 cmd.exe anymore HOT 3
- support providing a default/global `option_groups` config to apply to all commands HOT 7
- Unit tests should assert output to stderr on errors
- Either update or deprecate MacPorts install HOT 1
- `text_markup: Literal["rich", "markdown", "rst", None]` config option HOT 1
- Additional style options HOT 1
- `rich-click` CLI for version `1.8.0dev1` breaks backwards compatibility in edge case
- 1.9 wishlist
- 2.0 roadmap
- 'RichGroup' object has no attribute 'isolation' HOT 2
- Bugs (a) generating svg/html with decorator. (b) with root directory scripts HOT 1
- Interim blog post - "5 cool pre-made styles for your CLI" (title tentative)
- Color part of the help massage HOT 8
- OptionHighlighter is deprecated and will be removed in a future version. HOT 6
- Invalid MRO when importing rich_click HOT 4
- Continuting to receive "DeprecationWarning: OptionHighlighter is deprecated" as of 1.8.1 HOT 1
- Fix warning (again)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rich-click.