Comments (7)
ok, I just added this functionality in 50d89b7
The new examples/click/10_table_styles.py
script shows it in action. The top options table I tried to base roughly on your request.
Note that it's not exactly the same, as in order to set leading=1
you have to use a table box
style. Using a box immediately adds a bunch of additional spacing / padding (even if that box is invisible in our case). I removed as much of it as I can, but it's still more spaced:
Hopefully that's ok. If you can figure out how to further reduce the padding, let me know 👍🏻 Alternatively we could add the spacing manually by just dumping a newline in to the help text. More crude, but should have the desired effect.
I figured that people would inevitably request this at custom-group level eventually, so I wrote it in such a way that it can be done on a per-group level too. You can see that in action in examples/click/03_groups_sorting.py
from rich-click.
Looks perfect! I actually enjoy the extra padding, but I can try to figure out a solution that would allow us to control it.
from rich-click.
Great! I set it up with padding
and pad_edge
already (the latter set to False
by default, which the best effect):
rich-click/src/rich_click/rich_click.py
Lines 48 to 49 in 95a3594
But I guess that there is still some other cell padding or something creeping in which could be finetuned to get exactly the right effect... But I didn't spend ages looking as I thought it looked ok as it was 😅
Note that some of the table style settings only work when the box is set to something other than None
. I probably should have mentioned that in the readme somewhere. That's why I set it to SIMPLE
here:
rich-click/examples/click/10_table_styles.py
Lines 3 to 4 in 95a3594
from rich-click.
You're too efficient. I can't keep up hahaha. Thank you so much, @ewels!
I'll try to contribute by figuring out how to fix the other aesthetic bugs that have been bothering me (#35 and #34), but they are much trickier than I was expecting.
from rich-click.
Should be fairly easy to add as an opt-in thing I think 🤔
from rich-click.
Could even give a few different options - blank lines but also horizontal rules / table styles or alternating background colours.
from rich-click.
Would be awesome!
from rich-click.
Related Issues (20)
- 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 5
- `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 4
- Fix warning (again)
- Show commands before options HOT 5
- Grouped `--help` output is not shown for `__main__.py` CLIs (`python -m foo`) / add support for `prog_name` HOT 2
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.