Commit 595d929e authored by Urban Klinc's avatar Urban Klinc
Browse files

Add options.gen.adoc.tpl, modify options.go to enable .adoc codegen from .gen.adoc.tpl

parent 988291f9
// This file is auto-generated.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
//
// Definitions file that controls how this file is generated:
// {{ .Source }}
= {{ export $.Name }}
[cols="2,3,5a"]
|===
|Type|Default value|Description
{{- range $prop := $.Properties }}
3+| *{{ toUpper $prop.Env }}*
|`{{ $prop.Type }}`
|{{- if $prop.Default }}
{{- $prop.Default -}}
{{- end -}}
|{{ $prop.Description }}
{{- end }}
|===
\ No newline at end of file
......@@ -28,10 +28,11 @@ type (
optionsPropSet []*optionsProp
optionsProp struct {
Name string
Type string
Env string
Default *optionsPropDefault
Name string
Type string
Env string
Default *optionsPropDefault
Description string
}
optionsPropDefault string
......@@ -108,6 +109,8 @@ func genOptions(tpl *template.Template, dd ...*optionsDef) (err error) {
var (
tplOptionsGen = tpl.Lookup("options.gen.go.tpl")
tplOptionsAdoc = tpl.Lookup("options.gen.adoc.tpl")
dst string
)
......@@ -117,6 +120,20 @@ func genOptions(tpl *template.Template, dd ...*optionsDef) (err error) {
if err != nil {
return
}
dst = path.Join(d.outputDir, path.Base(d.Source)[:strings.LastIndex(path.Base(d.Source), ".")]+".adoc")
err = goTemplate(dst, tplOptionsAdoc, d)
if err != nil {
return
}
}
// for _, d := range dd {
// dst = path.Join(d.outputDir, path.Base(d.Source)[:strings.LastIndex(path.Base(d.Source), ".")]+".adoc")
// err = goTemplate(dst, tplOptionsAdoc, d)
// if err != nil {
// return
// }
// }
return nil
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment