mirror of
https://github.com/spf13/viper
synced 2024-12-23 12:07:02 +00:00
Removes superfluous block for intSlice, and appends to stringSlice instead
This commit is contained in:
parent
43a90672d3
commit
bf7e634b7f
1 changed files with 2 additions and 7 deletions
9
viper.go
9
viper.go
|
@ -956,12 +956,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)
|
||||||
|
@ -1030,7 +1025,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