mirror of
https://github.com/spf13/cobra
synced 2025-05-05 12:57:22 +00:00
cobra init: Should exit on invalid configuration
This commit is contained in:
parent
e04ec72550
commit
0a2d1f2fbf
1 changed files with 5 additions and 2 deletions
|
@ -73,7 +73,10 @@ func initConfig() {
|
||||||
|
|
||||||
viper.AutomaticEnv()
|
viper.AutomaticEnv()
|
||||||
|
|
||||||
if err := viper.ReadInConfig(); err == nil {
|
if err := viper.ReadInConfig(); err != nil {
|
||||||
fmt.Fprintln(os.Stderr, "Using config file:", viper.ConfigFileUsed())
|
cobra.CheckErr(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_, err := fmt.Fprintln(os.Stderr, "Using config file:", viper.ConfigFileUsed())
|
||||||
|
cobra.CheckErr(err)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue