mirror of
https://github.com/spf13/viper
synced 2024-12-23 20:17:03 +00:00
Removes superfluous block for intSlice, and appends to stringSlice instead
This commit is contained in:
parent
bd294940f9
commit
7b01606243
1 changed files with 2 additions and 7 deletions
9
viper.go
9
viper.go
|
@ -925,12 +925,7 @@ func (v *Viper) find(lcaseKey string) interface{} {
|
||||||
return cast.ToInt(flag.ValueString())
|
return cast.ToInt(flag.ValueString())
|
||||||
case "bool":
|
case "bool":
|
||||||
return cast.ToBool(flag.ValueString())
|
return cast.ToBool(flag.ValueString())
|
||||||
case "stringSlice":
|
case "stringSlice", "intSlice":
|
||||||
s := strings.TrimPrefix(flag.ValueString(), "[")
|
|
||||||
s = strings.TrimSuffix(s, "]")
|
|
||||||
res, _ := readAsCSV(s)
|
|
||||||
return res
|
|
||||||
case "intSlice":
|
|
||||||
s := strings.TrimPrefix(flag.ValueString(), "[")
|
s := strings.TrimPrefix(flag.ValueString(), "[")
|
||||||
s = strings.TrimSuffix(s, "]")
|
s = strings.TrimSuffix(s, "]")
|
||||||
res, _ := readAsCSV(s)
|
res, _ := readAsCSV(s)
|
||||||
|
@ -999,7 +994,7 @@ func (v *Viper) find(lcaseKey string) interface{} {
|
||||||
return cast.ToInt(flag.ValueString())
|
return cast.ToInt(flag.ValueString())
|
||||||
case "bool":
|
case "bool":
|
||||||
return cast.ToBool(flag.ValueString())
|
return cast.ToBool(flag.ValueString())
|
||||||
case "stringSlice":
|
case "stringSlice", "intSlice":
|
||||||
s := strings.TrimPrefix(flag.ValueString(), "[")
|
s := strings.TrimPrefix(flag.ValueString(), "[")
|
||||||
s = strings.TrimSuffix(s, "]")
|
s = strings.TrimSuffix(s, "]")
|
||||||
res, _ := readAsCSV(s)
|
res, _ := readAsCSV(s)
|
||||||
|
|
Loading…
Reference in a new issue