mirror of
https://github.com/opencloud-eu/opencloud.git
synced 2026-05-08 04:20:59 -05:00
Move conditional for deprecation Link into go template
Signed-off-by: Christian Richter <crichter@owncloud.com>
This commit is contained in:
@@ -16,12 +16,12 @@ import (
|
|||||||
{{- end}})
|
{{- end}})
|
||||||
|
|
||||||
type ConfigField struct {
|
type ConfigField struct {
|
||||||
EnvVars []string
|
EnvVars []string
|
||||||
DefaultValue string
|
DefaultValue string
|
||||||
Type string
|
Type string
|
||||||
Description string
|
Description string
|
||||||
VersionInfo string
|
VersionInfo string
|
||||||
IsDeprecated bool
|
DeprecationLink string
|
||||||
}
|
}
|
||||||
|
|
||||||
type DeprecationField struct {
|
type DeprecationField struct {
|
||||||
@@ -103,7 +103,7 @@ func GetAnnotatedVariables(s interface{}) ([]ConfigField, []DeprecationField) {
|
|||||||
default:
|
default:
|
||||||
desc := field.Tag.Get("desc")
|
desc := field.Tag.Get("desc")
|
||||||
env, ok := field.Tag.Lookup("env")
|
env, ok := field.Tag.Lookup("env")
|
||||||
isDeprecated := false
|
deprecationLink := ""
|
||||||
if !ok {
|
if !ok {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
@@ -115,7 +115,7 @@ func GetAnnotatedVariables(s interface{}) ([]ConfigField, []DeprecationField) {
|
|||||||
removalVersion != "" ||
|
removalVersion != "" ||
|
||||||
deprecationInfo != "" ||
|
deprecationInfo != "" ||
|
||||||
deprecationReplacement != "" {
|
deprecationReplacement != "" {
|
||||||
isDeprecated = true
|
deprecationLink = "xref:deprecation-note[Deprecation Note]"
|
||||||
}
|
}
|
||||||
v := fmt.Sprintf("%v", value.Interface())
|
v := fmt.Sprintf("%v", value.Interface())
|
||||||
td := strings.Split(env, ";")
|
td := strings.Split(env, ";")
|
||||||
@@ -131,13 +131,13 @@ func GetAnnotatedVariables(s interface{}) ([]ConfigField, []DeprecationField) {
|
|||||||
}
|
}
|
||||||
fields = append(fields,
|
fields = append(fields,
|
||||||
ConfigField{
|
ConfigField{
|
||||||
EnvVars: td,
|
EnvVars: td,
|
||||||
DefaultValue: v,
|
DefaultValue: v,
|
||||||
Description: desc,
|
Description: desc,
|
||||||
Type: typeName,
|
Type: typeName,
|
||||||
IsDeprecated: isDeprecated,
|
DeprecationLink: deprecationLink,
|
||||||
})
|
})
|
||||||
if isDeprecated {
|
if deprecationLink != "" {
|
||||||
deprecations = append(deprecations,
|
deprecations = append(deprecations,
|
||||||
DeprecationField{
|
DeprecationField{
|
||||||
DeprecationVersion: deprecationVersion,
|
DeprecationVersion: deprecationVersion,
|
||||||
|
|||||||
Vendored
+1
-4
@@ -38,10 +38,7 @@ a| {{- range $i, $value := .EnvVars }}{{- if $i }} +
|
|||||||
{{ end -}}
|
{{ end -}}
|
||||||
`{{- $value }}`
|
`{{- $value }}`
|
||||||
{{- end }} +
|
{{- end }} +
|
||||||
:is-deprecated: {{ .IsDeprecated }}
|
{{ .DeprecationLink }}
|
||||||
ifeval::[{is-deprecated} == true]
|
|
||||||
xref:deprecation-note[Deprecation Note]
|
|
||||||
endif::[]
|
|
||||||
a| [subs=-attributes]
|
a| [subs=-attributes]
|
||||||
++{{.Type}} ++
|
++{{.Type}} ++
|
||||||
a| [subs=-attributes]
|
a| [subs=-attributes]
|
||||||
|
|||||||
Reference in New Issue
Block a user