Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix subcommands from commands with underscores #13516

Merged
merged 1 commit into from
Mar 24, 2023

Conversation

czoido
Copy link
Contributor

@czoido czoido commented Mar 23, 2023

Changelog: Bugfix: Fix subcommands names when the parent command has underscores.
Docs: omit

When implementing a custom command that has something like:

@conan_command(group="Custom commands")
def build_info(conan_api: ConanAPI, parser, *args):
...

@conan_subcommand()
def build_info_create(conan_api: ConanAPI, parser, subparser, *args):
...

I noticed that the subcommand name was not properly formed, it appeared as info-create instead of create.

Maybe we want to get rid of the restriction of being the main command the start of the subcommand names and just use:

@conan_command(group="Custom commands")
def build_info(conan_api: ConanAPI, parser, *args):
...

@conan_subcommand()
def create(conan_api: ConanAPI, parser, subparser, *args):
...

@czoido czoido added this to the 2.0.3 milestone Mar 23, 2023
@memsharded memsharded self-assigned this Mar 23, 2023
@czoido czoido self-assigned this Mar 23, 2023
Copy link
Member

@AbrilRBS AbrilRBS left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

Maybe we want to get rid of the restriction of being the main command the start of the subcommand names and just use

In my head it makes more sense how it is currently, but I see how this can be prettier to write too :)

@memsharded
Copy link
Member

In my head it makes more sense how it is currently, but I see how this can be prettier to write too :)

I think I also prefer the consistency of having every command prefixed with the parent one.

@memsharded memsharded merged commit 480ee34 into conan-io:release/2.0 Mar 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants