Skip to content

Some functionality of --autotemplate seems broken? #2147

Answered by twpayne
danpf asked this question in Q&A
Discussion options

You must be logged in to vote

Thanks for reporting this. To be honest --autotemplate is pretty sketchy as the fundamental problem of "reversing" the output and template variables to get the input template has no clearly-defined friendly solution. For example, if you have a template variable (e.g. machine_env) is the single character y then --autotemplate should replace every y character in the entire file with {{ .machine_env }}, which is probably not what you want.

With regards to --autotemplate implying --template, --autotemplate only makes the added file a template if an actual variable substitution was found. This is for when you use chezmoi add --autotemplate somedir/, in which case it's desirable that only the f…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@danpf
Comment options

Answer selected by danpf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants