Skip to content

Commit

Permalink
feat: Add .chezmoi.configFile template variable
Browse files Browse the repository at this point in the history
  • Loading branch information
felipecrs authored and twpayne committed Nov 30, 2021
1 parent 9939926 commit ecb6c1d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions docs/REFERENCE.md
Original file line number Diff line number Diff line change
Expand Up @@ -1891,6 +1891,7 @@ chezmoi provides the following automatically-populated variables:
| -------------------------- | ---------- | ------------------------------------------------------------------------------------------------------------------------------- |
| `.chezmoi.arch` | `string` | Architecture, e.g. `amd64`, `arm`, etc. as returned by [runtime.GOARCH](https://pkg.go.dev/runtime?tab=doc#pkg-constants). |
| `.chezmoi.args` | `[]string` | The arguments passed to the `chezmoi` command, starting with the program command. |
| `.chezmoi.configFile` | `string` | The path to the configuration file used by chezmoi, if any. |
| `.chezmoi.executable` | `string` | The path to the `chezmoi` executable, if available. |
| `.chezmoi.fqdnHostname` | `string` | The fully-qualified domain name hostname of the machine chezmoi is running on. |
| `.chezmoi.group` | `string` | The group of the user running chezmoi. |
Expand Down
1 change: 1 addition & 0 deletions internal/cmd/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -930,6 +930,7 @@ func (c *Config) defaultTemplateData() map[string]interface{} {
"chezmoi": map[string]interface{}{
"arch": runtime.GOARCH,
"args": os.Args,
"configFile": c.configFileAbsPath.String(),
"executable": executable,
"fqdnHostname": fqdnHostname,
"group": group,
Expand Down

0 comments on commit ecb6c1d

Please sign in to comment.