-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
Adding commands with dashes("-") in the name generates bad code #269
Comments
Exact issue for me. |
Just clarifying, this is only an issue with the Cobra generation tool, not with the library itself, correct? |
No idea, I'm still learning Go :) |
@spf13 yes I think it's just generation. |
Yes, just in generation:
Lines 30 and 46: var get-metadataCmd = &cobra.Command{
...
RootCmd.AddCommand(get-metadataCmd) Probably makes sense to automagically camel case dashed (or underscored, ew, why) commands, e.g. |
It seems that, dash in command name will be camel cased now. What should I do if I want to have a command name with dash ? |
I got it. Just change "Use" in cobra.Command {} |
@lzhecheng More specifically, the alias field can be used. I was wondering the same.
|
For example when running
cobra add-user
the name of the command in the code isadd-userCmd
which is wrong.The text was updated successfully, but these errors were encountered: