cleo icon indicating copy to clipboard operation
cleo copied to clipboard

How can you create a subcommand?

Open pmav99 opened this issue 7 years ago • 4 comments

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 avatar Dec 18 '18 18:12 pmav99

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.

pmav99 avatar Dec 21 '18 18:12 pmav99

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 avatar Mar 21 '19 13:03 drunkwcodes

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

drunkwcodes avatar Mar 21 '19 22:03 drunkwcodes

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.

johnslavik avatar Jan 16 '24 02:01 johnslavik