python-poetry / cleo

Cleo allows you to create beautiful and testable command-line interfaces.
https://cleo.readthedocs.io
MIT License
1.28k stars 90 forks source link

How can you create a subcommand? #62

Open pmav99 opened 5 years ago

pmav99 commented 5 years ago

I can't find any reference for creating subcommands. E.g.

app command subcmd1 --help
app command subcmd2 --help

As far as I can tell clikit seems to be supporting this. But is this supported on cleo? Can you provide any pointers on how to do this? Do we need a new cleo.Application and/or clikit.console_application?

pmav99 commented 5 years ago

I checked poetry's develop branch and figured it out. An MWE can be found here.

Not sure if the issue needs to be closed or not. My problem is solved but mentioning this in the documentation would not be a bad idea.

drunkwcodes commented 5 years ago

Can we add a convention like this?

This needs to handle args mismatch like this and allows us to create subcommands in other projects.

drunkwcodes commented 5 years ago

At the mean time I found this: https://poetry.eustace.io/docs/plugins/#creating-a-plugin

bswck commented 9 months ago

You cannot really create subcommands. You can create commands with spaces in names, like env "subcommands" in https://github.com/python-poetry/poetry/blob/05f39efa52deb801800309c6ee8cce7c17f61d49/src/poetry/console/application.py#L52-L93.