Skip to content

Is there a way to get destination direcory in template? #3599

Answered by ErrrorMaxx
ErrrorMaxx asked this question in Q&A
Discussion options

You must be logged in to vote

Managed to implement one-time save of destDir:

destDir: &destDir {{ dig "cz" "destDir" .chezmoi.config.destDir . }}

data:
  cz:
    destDir: *destDir

It is trying to use saved destDir, or if this is first init it uses current destDir (possibly provided via --destination argument) and saves it.

Thanks @halostatue for pointing me to .chezmoi.config.destDir!

UPD: Changed usage of .chezmoi to .cz dict

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
2 replies
@halostatue
Comment options

@ErrrorMaxx
Comment options

Answer selected by ErrrorMaxx
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