Closed halybang closed 6 years ago
Run hexya -c config_file_name not work. Reason: Corbra parses command line args when call Execute() method. How to fix: Modify cmd/hexya.go
hexya -c config_file_name
cmd/hexya.go
cobra.OnInitialize(initConfig)
func initConfig() { cfgFile := viper.GetString("ConfigFileName") // Read config either from cfgFile or from home directory! viper.AddConfigPath("/etc/hexya/") viper.AddConfigPath("$HOME/.hexya") viper.AddConfigPath(".") if cfgFile == "" { cfgFile = "hexya" } viper.SetConfigFile(cfgFile) viper.ReadInConfig() }
You're right, this wasn't implemented.
Can you open a PR with your proposal ?
Run
hexya -c config_file_name
not work. Reason: Corbra parses command line args when call Execute() method. How to fix: Modifycmd/hexya.go
cobra.OnInitialize(initConfig)