respect durationSlice type (spf13/pflag#122)

This commit is contained in:
Roman Volosatovs 2017-04-18 15:58:37 +02:00
parent 6152d25e55
commit 21a8c83361
No known key found for this signature in database
GPG Key ID: 3AC661943D80C89E
1 changed files with 2 additions and 2 deletions

View File

@ -903,7 +903,7 @@ func (v *Viper) find(lcaseKey string) interface{} {
return cast.ToUint(flag.ValueString())
case "bool":
return cast.ToBool(flag.ValueString())
case "stringSlice", "stringArray", "boolSlice", "ipSlice", "uintSlice", "intSlice":
case "stringSlice", "stringArray", "boolSlice", "ipSlice", "uintSlice", "intSlice", "durationSlice":
s := strings.TrimPrefix(flag.ValueString(), "[")
s = strings.TrimSuffix(s, "]")
res, _ := readAsCSV(s)
@ -974,7 +974,7 @@ func (v *Viper) find(lcaseKey string) interface{} {
return cast.ToUint(flag.ValueString())
case "bool":
return cast.ToBool(flag.ValueString())
case "stringSlice", "stringArray", "boolSlice", "ipSlice", "uintSlice", "intSlice":
case "stringSlice", "stringArray", "boolSlice", "ipSlice", "uintSlice", "intSlice", "durationSlice":
s := strings.TrimPrefix(flag.ValueString(), "[")
s = strings.TrimSuffix(s, "]")
res, _ := readAsCSV(s)