allow argumentless flags

This commit is contained in:
2021-10-25 18:29:59 +02:00
parent 2789502c89
commit 6137e31c3b
4 changed files with 18 additions and 3 deletions

View File

@@ -239,7 +239,18 @@ func getOptions(options Options, key string) []string {
var selected []string
for k, values := range options[key] {
for _, value := range values {
selected = append(selected, fmt.Sprintf("--%s", k), value)
// Bool
asBool, ok := value.(bool)
if ok && asBool {
selected = append(selected, fmt.Sprintf("--%s", k))
continue
}
// String
asString, ok := value.(string)
if ok {
selected = append(selected, fmt.Sprintf("--%s", k), asString)
continue
}
}
}
return selected