Chezmoi template helpers#
This page documents helper templates used across multiple rendered files.
expand-executable-paths.tmpl#
Input: full template context (
.).Behavior: reads
.executable_pathsfor.chezmoi.os, prepends.chezmoi.homeDirforhome_relativeentries, appendsabsoluteentries, returns JSON.Output: JSON array intended for
fromJsonat call sites.
expand-executable-paths.tmpl#
1{{- /* vim: set ft=gotmpl: */ -}}
2{{- $cfg := index .executable_paths .chezmoi.os -}}
3{{- $home := .chezmoi.homeDir -}}
4{{- $paths := list -}}
5{{- range $p := $cfg.home_relative -}}
6 {{- $paths = append $paths (joinPath $home $p) -}}
7{{- end -}}
8{{- range $p := $cfg.absolute -}}
9 {{- $paths = append $paths $p -}}
10{{- end -}}
11{{- $paths | toJson -}}
dotfiles-profile.tmpl#
Input:
VVN_DOTFILES_PROFILEenvironment variable.Behavior: normalizes to lowercase, allows
minimalorstandard, falls back tostandard.Output: selected profile name as plain text.
dotfiles-profile.tmpl#
1{{- /* vim: set ft=gotmpl: */ -}}
2{{- $profile := lower (env "VVN_DOTFILES_PROFILE") -}}
3{{- if or (eq $profile "minimal") (eq $profile "standard") -}}
4{{ $profile }}
5{{- else -}}
6standard
7{{- end -}}