mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-24 21:56:05 +02:00
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:
@@ -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()))
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user