GithubHelp home page GithubHelp logo

Comments (7)

ewels avatar ewels commented on June 13, 2024 1

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:

table styles example

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.

apcamargo avatar apcamargo commented on June 13, 2024 1

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.

ewels avatar ewels commented on June 13, 2024 1

Great! I set it up with padding and pad_edge already (the latter set to False by default, which the best effect):

STYLE_OPTIONS_TABLE_PAD_EDGE = False
STYLE_OPTIONS_TABLE_PADDING = (0, 1)

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:

click.rich_click.STYLE_OPTIONS_TABLE_LEADING = 1
click.rich_click.STYLE_OPTIONS_TABLE_BOX = "SIMPLE"

from rich-click.

apcamargo avatar apcamargo commented on June 13, 2024 1

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.

ewels avatar ewels commented on June 13, 2024

Should be fairly easy to add as an opt-in thing I think 🤔

from rich-click.

ewels avatar ewels commented on June 13, 2024

Could even give a few different options - blank lines but also horizontal rules / table styles or alternating background colours.

from rich-click.

apcamargo avatar apcamargo commented on June 13, 2024

Would be awesome!

from rich-click.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.