Open domano opened 3 years ago
Hi, this is a feature request mainly to make cobra & viper integration easier.
If the VarP-methods for flags are used then there is a pointer value for a variable which will be filled with the flags' value.
Example:
Currently the pointer is just used to fill the variable.
It would be nice if the pointer was stored somewhere and could be retrieved.
This would allow for easy setting of all variables pointed to when using cobras' VisitAll function: cmd.Flags().VisitAll(func(f *pflag.Flag) {}).
cmd.Flags().VisitAll(func(f *pflag.Flag) {})
Right now one has to manually set all variables by fetching them via viper and setting them, something like this: myVar := v.Get(f.Name).
myVar := v.Get(f.Name)
Hi, this is a feature request mainly to make cobra & viper integration easier.
If the VarP-methods for flags are used then there is a pointer value for a variable which will be filled with the flags' value.
Example:
Currently the pointer is just used to fill the variable.
It would be nice if the pointer was stored somewhere and could be retrieved.
This would allow for easy setting of all variables pointed to when using cobras' VisitAll function:
cmd.Flags().VisitAll(func(f *pflag.Flag) {})
.Right now one has to manually set all variables by fetching them via viper and setting them, something like this:
myVar := v.Get(f.Name)
.