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 command name collision on generator #1447

Closed
wants to merge 1 commit into from
Closed

Fix command name collision on generator #1447

wants to merge 1 commit into from

Conversation

setsevireon
Copy link

When creating new commands via cobra add, it is not possible to add
commands with the same name to different parents. They will just
overwrite each other.

With this patch, the command's object identifier is templated
parentCommandCmd, the Use field command and the file name
parent_command.go.

Fixes #1059
Fixes #1131

Signed-off-by: Carlos Marx me@carlosmarx.com

When creating new commands via `cobra add`, it is not possible to add
commands with the same name to different parents. They will just
overwrite each other.

With this patch, the command's object identifier is templated
`parentCommandCmd`, the `Use` field `command` and the file name
`parent_command.go`.

Fixes #1059
Fixes #1131

Signed-off-by: Carlos Marx <me@carlosmarx.com>
@CLAassistant
Copy link

CLAassistant commented Jul 8, 2021

CLA assistant check
All committers have signed the CLA.

@github-actions github-actions bot added the area/cli [deprecated] For the cobra CLI !!! moved to spf13/cobra-cli label Jul 8, 2021
@github-actions
Copy link

github-actions bot commented Sep 7, 2021

This PR is being marked as stale due to a long period of inactivity

@github-actions github-actions bot closed this Mar 27, 2022
hoshsadiq pushed a commit to zulucmd/zulu that referenced this pull request Dec 31, 2022
When creating new commands via `cobra add`, it is not possible to add
commands with the same name to different parents. They will just
overwrite each other.

With this patch, the command's object identifier is templated
`parentCommandCmd`, the `Use` field `command` and the file name
`parent_command.go`.

Merge spf13/cobra#1447

Fixes #1059
Fixes #1131

Signed-off-by: Carlos Marx <me@carlosmarx.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/cli [deprecated] For the cobra CLI !!! moved to spf13/cobra-cli
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Same subcommand for multiple commands About subcommand directory
2 participants