diff --git a/README.md b/README.md index 907832f..f24ac32 100644 --- a/README.md +++ b/README.md @@ -14,6 +14,8 @@ Usage of ./spry: Output delimiter between template files rendered (default "---") -f value Specify a values file (JSON or YAML) + -helm + Whether to nest provided values under .Values -set value Set a specific value (foo.bar=spam) ``` diff --git a/main.go b/main.go index 4e59015..aa861af 100644 --- a/main.go +++ b/main.go @@ -77,6 +77,7 @@ var flags struct { valuesFiles valFileSlice values valSlice outputDelimiter string + helmCompat bool } func init() { @@ -87,6 +88,7 @@ func init() { "d", "---", "Output delimiter between template files rendered", ) + flag.BoolVar(&flags.helmCompat, "helm", false, "Whether to nest provided values under .Values") flag.Parse() } @@ -164,8 +166,13 @@ func expandFiles(files []string) (expFiles []string) { return } -func mergeValues() (result map[string]interface{}) { - result = map[string]interface{}{} +func mergeValues() (res map[string]interface{}) { + res = map[string]interface{}{} + result := res + if flags.helmCompat { + res["Values"] = map[string]interface{}{} + result = res["Values"].(map[string]interface{}) + } for _, vf := range flags.valuesFiles { vfContent, err := os.ReadFile(vf) checkErr(err)