skip initialization of config in version and help commands
@@ -49,9 +49,13 @@ Version: %v`, Version),
func rootCmdValidatePersistent(cmd *cobra.Command, args []string) (err error) {
requireCache := RequireCache || cachecmd.RequireCache
-
+ switch cmd.CalledAs() {
+ case "help", "version":
+ return nil
+ default:
return initConfig(configFile, requireCache)
}
+}
func initConfig(configFile string, cacheRequired bool) (err error) {
log.Infof("Loading config file: %v", configFile)
