Closed abey79 closed 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.
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.
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!
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 theformat_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 ofrich --help
mainly though a customHelpFormatter
and with a lighter override offormat_help()
.These are the limitations of this approach:
show_default=True
andshow_envvar=True
forclick.Option
. However, since those are formatted in brackets[]
by Click, they get eaten by the console. I don't see an easy way around this short of overridingCommand.format_options()
and reimplementing all ofOption.get_help_record()
(which is a pity because the latter is a rather dense function, subject to change in future versions of click).