norwoodj / helm-docs

A tool for automatically generating markdown documentation for helm charts
GNU General Public License v3.0
1.3k stars 178 forks source link

custom template not defined error #180

Open podleaper opened 1 year ago

podleaper commented 1 year ago

I'm struggling to get custom template to work. I'm not sure if made a mistake somewhere or if this is a bug. I'm testing with the repo provided extra.flower.

podleaper@ml ~/dev
$ git clone https://github.com/norwoodj/helm-docs.git
Cloning into 'helm-docs'...
remote: Enumerating objects: 1549, done.
remote: Counting objects: 100% (512/512), done.
remote: Compressing objects: 100% (175/175), done.
remote: Total 1549 (delta 351), reused 463 (delta 330), pack-reused 1037
Receiving objects: 100% (1549/1549), 3.78 MiB | 6.29 MiB/s, done.
Resolving deltas: 100% (837/837), done.

podleaper@ml ~/dev
$ cd helm-docs

podleaper@ml ~/dev/helm-docs (master)
$ cd example-charts/custom-template/

podleaper@ml ~/dev/helm-docs/example-charts/custom-template (master)
$ ls
Chart.yaml  README.md  README.md.gotmpl  requirements.yaml  values.yaml

podleaper@ml ~/dev/helm-docs/example-charts/custom-template (master)
$ rm README.md

podleaper@ml ~/dev/helm-docs/example-charts/custom-template (master)
$ helm-docs
INFO[2023-04-21T12:47:24-07:00] Found Chart directories [.]
INFO[2023-04-21T12:47:24-07:00] Generating README Documentation for chart .
WARN[2023-04-21T12:47:24-07:00] Error generating documentation for chart .: template: .:8:12: executing "." at <{{template "extra.flower" .}}>: template "extra.flower" not defined

podleaper@ml ~/dev/helm-docs/example-charts/custom-template (master)
$ cat README.md
# custom-template

Basically the same as the nginx-ingress chart, but using a custom template to include some other content

![Version: 0.2.0](https://img.shields.io/badge/Version-0.2.0-informational?style=flat-square)

## Additional Information
dalwar23 commented 4 months ago

I had the same issue. I had to read the documentation again. Try the following, see if this helps

from helm-docs directory

helm-docs -c example-charts/ -t ./_templates.gotmpl -t README.md.gotmpl -g example-charts/custom-template

Or from example-cahrts directory

helm-docs -c . -t ./_templates.gotmpl -t README.md.gotmpl -g custom-template