trogon icon indicating copy to clipboard operation
trogon copied to clipboard

Support for Click Custom Multi Commands

Open SebastienSyd opened this issue 2 years ago • 2 comments

Hi team! I love your work, really. I discovered this new tool and would like to integrate it in our internal stack. We are using Click for an internal CLI, and we are using it commands and sub-commands with that implementation: https://click.palletsprojects.com/en/8.1.x/commands/#custom-multi-commands

Basically we have a folder structure:

mycli/
|_ commands/
   |_ cmd1.py
   |_ cmd2.py
   |_ cmd3.py
   |_ ...

Running mycli would list all the commands, and running mycli cmd1 would list all the cmd subcommands

If I implement Trogon from the docs, I would need to do mycli cmd1 tui to have a TUI for the mycli cmd1 subcommands, but I would love having a mycli tui command that would create a TUI for all commands and associated subcommands. Is there a way to do it with the current Trogon code, or this would need extra development? Let me know if it's unclear

SebastienSyd avatar Sep 25 '23 08:09 SebastienSyd

I'm also encountering the same issue. I would also like to use it with click.CommandCollection. Haven't found a way to implement it.

doronz88 avatar Oct 03 '23 19:10 doronz88

I just opened a PR that adds support for MultiCommands (#71) since I also needed it and it was straight forward enough to implement. It works for my use case but feel free to test if it also works for you.

boehmseb avatar Jan 05 '24 16:01 boehmseb