This commit is contained in:
Vlad Didenko 2015-07-18 17:30:30 -05:00 committed by spf13
parent 1e6a237e05
commit f14e1baa25

View file

@ -522,11 +522,11 @@ func (v *Viper) BindPFlag(key string, flag *pflag.Flag) (err error) {
switch flag.Value.Type() {
case "int", "int8", "int16", "int32", "int64":
SetDefault(key, cast.ToInt(flag.Value.String()))
v.SetDefault(key, cast.ToInt(flag.Value.String()))
case "bool":
SetDefault(key, cast.ToBool(flag.Value.String()))
v.SetDefault(key, cast.ToBool(flag.Value.String()))
default:
SetDefault(key, flag.Value.String())
v.SetDefault(key, flag.Value.String())
}
return nil
}