typer
typer copied to clipboard
Help panel sorted by name, allow to not expand help command tables
This PR brings following changes and features:
- Rich Help Panels for commands are now sorted by panel name (except for 'Commands' panel always printed first). Currently, command help panels are sorted by command name (ordering being done across all panels) which may results in weird/unexpected display.
- New
STYLE_COMMANDS_TABLE_EXPANDstyle to allow to not expand tables of command help panels. The currently forced table expand may not be desirable when you have several command panels (help text may end up far on the right side and alignment with other panel text too inconsistent). Disabling tables' expand option helps improving the result (in combination withSTYLE_COMMANDS_TABLE_PADDINGstyle).
📝 Docs preview for commit 98a0f3fbc5520f2027bd57f2ed3e943f98914e8e at: https://6367f2806084a07b322a00ed--typertiangolo.netlify.app
📝 Docs preview for commit 46a2868dd702513cc23b74823a1ec16df851fa0d at: https://639cea0318290c0c34ff487a--typertiangolo.netlify.app
Is this related to https://github.com/Textualize/rich/discussions/2878 and https://github.com/tiangolo/typer/pull/567 ?
@ssbarnea yep after looking at your discussion and PR, clearly related. Seems you also stumbled upon same issue with labels ending up not aligned across panels. Your proposal is different than mine though since I only make visible the expand property to fix it.
Now we need to find a way to persuade @tiangolo to pick one of the fixes, so we can make use of it.
Thanks @asaintsever! :rocket:
I went for https://github.com/tiangolo/typer/pull/567 to handle the length of the commands.
I want to allow making the order of panels and commands explicit, but not sorted by order. I also want to change that for commands, so that developers can decide which commands are shown first in the help menus. I think commands and their help are in many cases related, or some should be used first, before others, etc. And that doesn't depend on the name but on the intention of the developer, so, I want to order commands in the same order they were added to the app instead of the alphabetically. :nerd_face:
Given that, I'll pass on this one, but thanks for the effort! :cake:
@tiangolo Just for clarification:
I want to allow making the order of panels and commands explicit, but not sorted by order
This isn't currently possible, correct? Just wanting to make sure I hadn't missed this being implemented
- #428
Thanks ❤️