Textualize / trogon

Easily turn your Click CLI into a powerful terminal application
MIT License
2.4k stars 54 forks source link

Support for Click Custom Multi Commands #62

Open SebastienSyd opened 9 months ago

SebastienSyd commented 9 months ago

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

doronz88 commented 9 months ago

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.

boehmseb commented 6 months ago

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.