-
Notifications
You must be signed in to change notification settings - Fork 1
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: rebind projKey flag to update subcommand #62
Conversation
@@ -67,6 +67,9 @@ func runUpdate(cmd *cobra.Command, args []string) error { | |||
viper.GetString("baseUri"), | |||
) | |||
|
|||
// rebind flag to this subcommand | |||
viper.BindPFlag("projKey", cmd.Flags().Lookup("projKey")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are we basically rebinding it before we pass the data in?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess somewhere in the issue you linked I saw that since these are "local flags" for a subcommand they get overwritten
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would be nice to have a helper function that rebinds all the flags were going to use/re-use or something since we're going to have a lot of subcommands.
@@ -67,6 +67,9 @@ func runUpdate(cmd *cobra.Command, args []string) error { | |||
viper.GetString("baseUri"), | |||
) | |||
|
|||
// rebind flag to this subcommand | |||
viper.BindPFlag("projKey", cmd.Flags().Lookup("projKey")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would be nice to have a helper function that rebinds all the flags were going to use/re-use or something since we're going to have a lot of subcommands.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should do this for the create command too since it's probably only showing up for update because we call create first.
running into issues with duplicate flag names in different commands - rebinding the flag in the subcommand might not be the "right way" to do this but it works for now!
related issue: spf13/viper#233