What's the best way to customize the layout of the "options" panel? #1420
Unanswered
travishathaway
asked this question in
Questions
Replies: 2 comments
-
Beta Was this translation helpful? Give feedback.
0 replies
-
|
Self-plug: Typer integration docs here: https://ewels.github.io/rich-click/latest/documentation/typer_support/ |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment

Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
First Check
Commit to Help
Example Code
Description
This is more of a feature request than a question. I am writing a CLI with
typer, and I would like to completely override the display of command line options and arguments on the help pages. I simply do not like the table layout and would like to switch to a layout that looks more like the following:I know I could simply just copy
typer.rich_utilsto my project and simply override the entirerich_format_helpfunction, but that seems a little overkill for what I want and maintaining this copied version of the module would also become difficult as the project progresses.Possible solution
I think a better solution would be adding the ability to simply override the functions that render the panel (
typer/typer/rich_utils.py
Line 348 in b0e6be2
Drawbacks
Now that we've exposed this functions and encouraged them to be customized, we'll need to be extra careful about changing them in the future, but I think this drawback is worth the added flexibility.
Alternatives
On top of the alternative I mentioned above (simply overriding the entire
rich_format_helpfunction), we could also pursue a plugin architecture for customizing these parts of typer. For this, we could use something like the pluggy library. I'm a core maintainer of the conda package manager, and we've had quite a bit of success implementing and using pluggy over the years for this purpose.Looking forward to hearing feedback from the community on this and whether anyone has ever wanted the same thing from typer.
Operating System
Linux, Windows, macOS
Operating System Details
No response
Typer Version
0.20.0
Python Version
Additional Context
Here's a link to a pull request that would add this new functionality to typer:
_print_options_paneland_print_commands_panel#1421Beta Was this translation helpful? Give feedback.
All reactions