mirror of
https://github.com/spf13/viper
synced 2024-12-22 19:47:01 +00:00
Fixes #83
This commit is contained in:
parent
db7ff930a1
commit
c36643ca68
1 changed files with 3 additions and 3 deletions
6
viper.go
6
viper.go
|
@ -522,11 +522,11 @@ func (v *Viper) BindPFlag(key string, flag *pflag.Flag) (err error) {
|
||||||
|
|
||||||
switch flag.Value.Type() {
|
switch flag.Value.Type() {
|
||||||
case "int", "int8", "int16", "int32", "int64":
|
case "int", "int8", "int16", "int32", "int64":
|
||||||
SetDefault(key, cast.ToInt(flag.Value.String()))
|
v.SetDefault(key, cast.ToInt(flag.Value.String()))
|
||||||
case "bool":
|
case "bool":
|
||||||
SetDefault(key, cast.ToBool(flag.Value.String()))
|
v.SetDefault(key, cast.ToBool(flag.Value.String()))
|
||||||
default:
|
default:
|
||||||
SetDefault(key, flag.Value.String())
|
v.SetDefault(key, flag.Value.String())
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue