mirror of
https://github.com/spf13/cobra
synced 2024-11-25 07:07:15 +00:00
Fix viper flag
Since --viper is a bool flag with default true, there is no way of opting out. This commit sets the default to false. Signed-off-by: Nikolas Sepos <nikolas.sepos@gmail.com>
This commit is contained in:
parent
a1f051bc3e
commit
aebea8a8b3
1 changed files with 1 additions and 1 deletions
|
@ -45,7 +45,7 @@ func init() {
|
|||
rootCmd.PersistentFlags().StringVar(&cfgFile, "config", "", "config file (default is $HOME/.cobra.yaml)")
|
||||
rootCmd.PersistentFlags().StringP("author", "a", "YOUR NAME", "author name for copyright attribution")
|
||||
rootCmd.PersistentFlags().StringVarP(&userLicense, "license", "l", "", "name of license for the project")
|
||||
rootCmd.PersistentFlags().Bool("viper", true, "use Viper for configuration")
|
||||
rootCmd.PersistentFlags().Bool("viper", false, "use Viper for configuration")
|
||||
viper.BindPFlag("author", rootCmd.PersistentFlags().Lookup("author"))
|
||||
viper.BindPFlag("useViper", rootCmd.PersistentFlags().Lookup("viper"))
|
||||
viper.SetDefault("author", "NAME HERE <EMAIL ADDRESS>")
|
||||
|
|
Loading…
Reference in a new issue