diff options
author | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2018-04-14 10:34:02 +0200 |
---|---|---|
committer | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2018-04-14 11:32:25 +0200 |
commit | 27a524b0905ec73c1eef233f94700feb9f465011 (patch) | |
tree | 54b52fb75ffc867c1eb6f6da441cb186b900e7d2 /commands/hugo.go | |
parent | bede93de005dcf934f3ec9be6388310ac6c57acd (diff) |
commands: Properly handle CLI slice arguments
Like `--disableKinds` -- this handling was kind of broken when we recently moved this from global vars
See #4607
Diffstat (limited to 'commands/hugo.go')
-rw-r--r-- | commands/hugo.go | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/commands/hugo.go b/commands/hugo.go index 5c301c7fb..41c06c026 100644 --- a/commands/hugo.go +++ b/commands/hugo.go @@ -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())) + } + } } |