diff --git a/cmd/root.go b/cmd/root.go index 528366f..79589a3 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -29,22 +29,14 @@ func Execute() { } func init() { - cobra.OnInitialize(initConfig) - // Here you will define your flags and configuration settings. // Cobra supports persistent flags, which, if defined here, // will be global for your application. - rootCmd.PersistentFlags().StringVar(&cfgFile, "configs", "c", "configs file (default is 'configs.json' in cwd)") + rootCmd.PersistentFlags().StringVarP(&cfgFile, "configs", "c", "configs.json", "configurations file") // Cobra also supports local flags, which will only run // when this action is called directly. // rootCmd.Flags().BoolP("toggle", "t", false, "Help message for toggle") } - -func initConfig() { - if cfgFile == "" { - cfgFile = "configs.json" - } -}