Skip to content

Commit

Permalink
docs: fix error in HOWTO guide
Browse files Browse the repository at this point in the history
The "different files locations on different systems" guide didn't pass
data to the template file, which can result in errors. See
#1108 for an example of this
problem.
  • Loading branch information
triallax authored and twpayne committed Sep 29, 2021
1 parent 130fa79 commit fa09eff
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions docs/HOWTO.md
Original file line number Diff line number Diff line change
Expand Up @@ -775,12 +775,13 @@ a shared template.

Create the common file in the `.chezmoitemplates` directory in the source state. For
example, create `.chezmoitemplates/file.conf`. The contents of this file are
available in templates with the `template *name*` function where *name* is the
name of the file.
available in templates with the `template *name* .` function where *name* is the
name of the file (`.` passes the current data to the template code in `file.conf`;
see https://pkg.go.dev/text/template#hdr-Actions for details).

Then create files for each system, for example `Library/Application
Support/App/file.conf.tmpl` for macOS and `dot_config/app/file.conf.tmpl` for
Linux. Both template files should contain `{{- template "file.conf" -}}`.
Linux. Both template files should contain `{{- template "file.conf" . -}}`.

Finally, tell chezmoi to ignore files where they are not needed by adding lines
to your `.chezmoiignore` file, for example:
Expand Down

0 comments on commit fa09eff

Please sign in to comment.