commands: Properly handle CLI slice arguments

Like `--disableKinds` -- this handling was kind of broken when we recently moved this from global vars

See #4607
This commit is contained in:
Bjørn Erik Pedersen
2018-04-14 10:34:02 +02:00
parent bede93de00
commit 27a524b090
2 changed files with 19 additions and 1 deletions

View File

@@ -243,7 +243,20 @@ If you need to set this configuration value from the command line, set it via an
if targetKey != "" {
configKey = targetKey
}
cfg.Set(configKey, f.Value.String())
// Gotta love this API.
switch f.Value.Type() {
case "bool":
bv, _ := flags.GetBool(key)
cfg.Set(configKey, bv)
case "string":
cfg.Set(configKey, f.Value.String())
case "stringSlice":
bv, _ := flags.GetStringSlice(key)
cfg.Set(configKey, bv)
default:
panic(fmt.Sprintf("update switch with %s", f.Value.Type()))
}
}
}