Skip to content
Permalink
Browse files

Quickfix for input sets (support for boolean)

  • Loading branch information...
Depado committed May 27, 2019
1 parent da3a2c3 commit 77344bbbcc4c1e5d6aa13762feb3444035cee18b
Showing with 12 additions and 2 deletions.
  1. +11 −1 conf/input.go
  2. +1 −1 renderer/analyze.go
@@ -51,7 +51,17 @@ func GetSetContext(set []string) (InputCtx, error) {
if len(tmp) != 2 {
return out, fmt.Errorf("invalid set option: %s", s)
}
out = append(out, yaml.MapItem{Key: tmp[0], Value: tmp[1]})
v := yaml.MapItem{Key: tmp[0]}
// Convert to bool if needed
switch strings.ToLower(tmp[1]) {
case "1", "true":
v.Value = true
case "0", "false":
v.Value = false
default:
v.Value = tmp[1]
}
out = append(out, v)
}
return out, nil
}
@@ -56,7 +56,7 @@ func Analyze(dir, output, input string, set []string) {
}
utils.OkPrintln("Input file", utils.Green.Sprint(input), "found")
}
if set != nil {
if len(set) > 0 {
setCtx, err := conf.GetSetContext(set)
if err != nil {
utils.FatalPrintln("Could not parse set flags:", err)

0 comments on commit 77344bb

Please sign in to comment.
You can’t perform that action at this time.