From aebea8a8b380f8dad744f5a064ebb2465e16b956 Mon Sep 17 00:00:00 2001 From: Nikolas Sepos Date: Wed, 28 Mar 2018 22:58:52 +0200 Subject: [PATCH] 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 --- cobra/cmd/root.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cobra/cmd/root.go b/cobra/cmd/root.go index 19568f98..2220d498 100644 --- a/cobra/cmd/root.go +++ b/cobra/cmd/root.go @@ -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 ")