You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If a template file is specified as a filename only as with the default above, the file is interpreted as being _relative to each chart directory found_.
117
+
If however a template file is specified as a relative path, e.g. the first of `--template-files=./_templates.gotmpl --template-files=README.md.gotmpl`
118
+
then the file is interpreted as being relative to the `chart-search-root`.
119
+
120
+
This repo is a good example of this in action. If you take a look at the [.pre-commit-config.yaml file](./.pre-commit-config.yaml)
121
+
here, you'll see our search root is set to [example-charts](./example-charts) and the list of templates used for each chart
122
+
is the [_templates.gotmpl file in that directory](./example-charts/_templates.gotmpl) and the README.md.gotmpl file in
123
+
each chart directory.
119
124
120
-
And the complete listing of available templates is below:
125
+
If any of the specified template files is not found for a chart (you'll notice most of the example charts do not have a README.md.gotmpl)
126
+
file, then the internal default template is used instead.
127
+
128
+
In addition to extra defined templates you specify in these template files, there are quite a few built-in templates that
129
+
can be used as well:
121
130
122
131
| Name | Description |
123
132
|------|-------------|
@@ -148,11 +157,7 @@ And the complete listing of available templates is below:
148
157
| chart.valuesTable | A table of the chart's values parsed from the `values.yaml` file (see below) |
149
158
| chart.valuesSection | A section headed by the valuesHeader from above containing the valuesTable from above or "" if there are no values |
150
159
151
-
For an example of how these various templates can be used in a `README.md.gotmpl` file to generate a reasonable markdown file,
152
-
look at the charts in [example-charts](./example-charts).
153
-
154
-
If there is no `README.md.gotmpl` (or other specified gotmpl file) present, the default template is used to generate the README.
155
-
That template looks like so:
160
+
The default internal template mentioned above uses many of these and looks like this:
156
161
```
157
162
{{ template "chart.header" . }}
158
163
{{ template "chart.deprecationWarning" . }}
@@ -172,10 +177,9 @@ That template looks like so:
172
177
{{ template "chart.valuesSection" . }}
173
178
```
174
179
175
-
The tool includes the [sprig templating library](https://github.com/Masterminds/sprig), so those functions can be used
180
+
The tool also includes the [sprig templating library](https://github.com/Masterminds/sprig), so those functions can be used
176
181
in the templates you supply.
177
182
178
-
179
183
### values.yaml metadata
180
184
This tool can parse descriptions and defaults of values from `values.yaml` files. The defaults are pulled directly from
command.PersistentFlags().StringP("output-file", "o", "README.md", "markdown file path relative to each chart directory to which rendered documentation will be written")
50
-
command.PersistentFlags().StringP("template-file", "t", "README.md.gotmpl", "gotemplate file path relative to each chart directory from which documentation will be generated")
51
-
command.PersistentFlags().StringSliceP("template-files", "T", []string{"README.md.gotmpl"}, "gotemplate file paths relative to each chart directory from which documentation will be generated")
52
-
iferr:=command.PersistentFlags().MarkDeprecated("template-file", "in favor of template-files"); err!=nil {
53
-
returncommand, err
54
-
}
51
+
command.PersistentFlags().StringSliceP("template-files", "t", []string{"README.md.gotmpl"}, "gotemplate file paths relative to each chart directory from which documentation will be generated")
0 commit comments