Skip to content

Commit

Permalink
feat: use data template in the config template
Browse files Browse the repository at this point in the history
Signed-off-by: peefy <[email protected]>
  • Loading branch information
Peefy committed Jan 14, 2024
1 parent 0c0771c commit 6752548
Showing 1 changed file with 1 addition and 25 deletions.
26 changes: 1 addition & 25 deletions pkg/tools/gen/templates/kcl/config.gotmpl
Original file line number Diff line number Diff line change
@@ -1,29 +1,5 @@
{{- if .Var }}{{ formatName .Var }}{{- if .IsUnion }}{{ " : " }}{{- else }}{{ " = " }}{{- end }}{{- end }}{{- if .Name }}{{ formatName .Name }}{{- end }}{{- if .Data }}{{- "{\n" }}
{{- range .Data -}}
{{- " " }}{{ formatName .Key }}{{ " = " }}
{{- if isKclData .Value }}
{{- "{\n" }}
{{- range .Value -}}
{{- indentLines (include "data" .) " " }}
{{- end }}
{{- " }" }}
{{- else if isArray .Value }}
{{- "[\n" }}
{{- range .Value -}}
{{- if isKclData . }}
{{- " {\n" }}
{{- range . -}}
{{- indentLines (include "data" .) " " }}
{{- end }}
{{- " }\n" }}
{{- else }}
{{- indentLines (formatValue .) " " }}{{- "\n" }}
{{- end }}
{{- end }}
{{- " ]" }}
{{- else }}
{{- formatValue .Value }}
{{- end }}
{{- "\n" }}
{{- indentLines (include "data" .) " " }}
{{- end -}}
{{- "}" }}{{- else }}{}{{- end }}

0 comments on commit 6752548

Please sign in to comment.