diff --git a/cobra/cmd/add_test.go b/cobra/cmd/add_test.go index 0b32ca6..c9b185b 100644 --- a/cobra/cmd/add_test.go +++ b/cobra/cmd/add_test.go @@ -4,9 +4,12 @@ import ( "fmt" "os" "testing" + + "github.com/spf13/viper" ) func TestGoldenAddCmd(t *testing.T) { + viper.Set("useViper", true) command := &Command{ CmdName: "test", CmdParent: parentName, diff --git a/cobra/cmd/root.go b/cobra/cmd/root.go index 350df10..ae961be 100644 --- a/cobra/cmd/root.go +++ b/cobra/cmd/root.go @@ -1,4 +1,4 @@ -// Copyright © 2015 Steve Francia . +// Copyright © 2021 Steve Francia . // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -46,7 +46,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") cobra.CheckErr(viper.BindPFlag("author", rootCmd.PersistentFlags().Lookup("author"))) cobra.CheckErr(viper.BindPFlag("useViper", rootCmd.PersistentFlags().Lookup("viper"))) viper.SetDefault("author", "NAME HERE ")