improve template and sort results

Signed-off-by: jkoberg <jkoberg@owncloud.com>
This commit is contained in:
jkoberg
2023-01-10 14:43:18 +01:00
parent bb9c65db7b
commit a3bcb80fe3
2 changed files with 18 additions and 5 deletions

View File

@@ -9,10 +9,12 @@ import (
"regexp"
"strings"
"text/template"
"sort"
{{- range $key, $value := .}}
pkg{{$key}} "{{$value}}"
{{- end}})
{{- end}}
)
// ConfigField is the representation of one configuration field
type ConfigField struct {
@@ -83,6 +85,9 @@ func main() {
for _, e := range f.EnvVars {
if env, ok := all[e]; ok {
env.Services = append(env.Services, service)
sort.Slice(env.Services, func(i, j int) bool {
return env.Services[i] < env.Services[j]
})
all[e] = env
} else {
all[e] = EnvVar{
@@ -130,6 +135,11 @@ func main() {
}
}
// sort
sort.Slice(tmplValues, func(i, j int) bool {
return tmplValues[i]["Name"].(string) < tmplValues[j]["Name"].(string)
})
glc, err := os.ReadFile("../../docs/templates/ADOC_global.tmpl")
if err != nil {
log.Fatal(err)

View File

@@ -1,6 +1,9 @@
// collected through docs/helpers/adoc-generator.go.tmpl
[.landscape]
[caption=]
.Environment variables with global scope available in multiple services
[width="100%",cols="~,~,~,~,~",options="header"]
[width="100%",cols="30%,25%,~,~,~",options="header"]
|===
| Name
| Services
@@ -12,9 +15,9 @@
a| `{{ .Name }}`
a| [subs=-attributes]
a| [subs=attributes+]
{{- range .Services}}
xref:{s-path}/{{ . }}.adoc[{{ . }}] +
* xref:{s-path}/{{ . }}.adoc[{{ . }}] +
{{- end }}
a| [subs=-attributes]
@@ -24,7 +27,7 @@ a| [subs=-attributes]
++{{ .DefaultValue }} ++
a| [subs=-attributes]
++{{ .Description }} ++
{{ .Description }}
{{- end }}
|===