Skip to content

Commit

Permalink
Quickfix for input sets (support for boolean)
Browse files Browse the repository at this point in the history
  • Loading branch information
Paul Lhussiez committed May 27, 2019
1 parent da3a2c3 commit 77344bb
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
12 changes: 11 additions & 1 deletion conf/input.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
2 changes: 1 addition & 1 deletion renderer/analyze.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 77344bb

Please sign in to comment.