Skip to content

Instantly share code, notes, and snippets.

@prat0318
Created June 5, 2017 20:23
Show Gist options
  • Save prat0318/a476f0989f89f3175805df7ef570fc5c to your computer and use it in GitHub Desktop.
Save prat0318/a476f0989f89f3175805df7ef570fc5c to your computer and use it in GitHub Desktop.
{{- range $_, $key := .Values | keys | sortAlpha -}}
{{- $value := index $.Values $key -}}
{{- if kindIs "map" $value -}}
{{- range $_, $nested_key := $value | keys | sortAlpha -}}
{{- $nested_value := index $value $nested_key -}}
{{- if kindIs "map" $nested_value -}}
{{- range $_, $nested_nested_key := $nested_value | keys | sortAlpha -}}
{{- $nested_nested_value := index $nested_value $nested_nested_key -}}
{{- if kindIs "map" $nested_nested_value -}}
{{- range $_, $nested_nested_nested_key := $nested_nested_value | keys | sortAlpha -}}
{{- $nested_nested_nested_value := index $nested_nested_value $nested_nested_nested_key -}}
{{ $nested_nested_nested_key }}: {{ $nested_nested_nested_value }}
{{- end -}}
{{- else -}}
{{ $nested_nested_key }}: {{ $nested_nested_value }}
{{- end -}}
{{- end -}}
{{- else -}}
{{ $nested_key }}: {{ $nested_value }}
{{- end -}}
{{- end -}}
{{- else -}}
{{ $key }}: {{ $value }}
{{- end -}}
{{- end }}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment