Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
corteza
corteza-server
Commits
595d929e
Commit
595d929e
authored
4 years ago
by
Urban Klinc
Browse files
Options
Download
Email Patches
Plain Diff
Add options.gen.adoc.tpl, modify options.go to enable .adoc codegen from .gen.adoc.tpl
parent
988291f9
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
44 additions
and
4 deletions
+44
-4
pkg/codegen/assets/options.gen.adoc.tpl
pkg/codegen/assets/options.gen.adoc.tpl
+23
-0
pkg/codegen/options.go
pkg/codegen/options.go
+21
-4
No files found.
pkg/codegen/assets/options.gen.adoc.tpl
0 → 100644
View file @
595d929e
// 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
This diff is collapsed.
Click to expand it.
pkg/codegen/options.go
View file @
595d929e
...
...
@@ -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
}
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment