Textualize / rich-cli

Rich-cli is a command line toolbox for fancy output in the terminal
https://www.textualize.io
MIT License
2.99k stars 77 forks source link

[WIP][Discussion] Improve Click-rich integration #8

Closed abey79 closed 2 years ago

abey79 commented 2 years ago

Preamble: I'm sharing this quick experimentation of mine to feed into the "rich-click" integration discussion. I have a strong interest in the topic for my own project, but I'm completely new to both Click's internals and rich.

The current rich --help look is currently achieved by fully overriding the format_help() function. This comes at the cost of loosing several features, which is likely not desirable for an hypothetical "rich-click" project. Here, I've attempted to reproduce the current look of rich --help mainly though a custom HelpFormatter and with a lighter override of format_help().

These are the limitations of this approach:

willmcgugan commented 2 years ago

Do you have a screenshot of the output?

I was only really interested in generating pretty output for this particular project, and not making a general solution. Ultimately I think it would be better to create a rich-click package that prettified the output, but still respected Click's config.

abey79 commented 2 years ago
image

I totally agree that this stuff should be a separate project. I've basically been using your project as sandbox because it's CLI structure is simpler than mine's 😃

The idea of this PR was fundamentally to gauge interest for pushing this rich-click project a bit further, possibly creating a repository under the textualize umbrella. From your comment above and on twitter I understand that this is not a priority of yours -- which obviously is fine. If so, I'll continue that exploration on my side and let you close this PR.

willmcgugan commented 2 years ago

Fair enough. Let me see what to come up with. It doesn’t need to be under the Textualize umbrella. I’d be happy to promote it, no matter who hosts it. And I’m help if I can!