hooks.read-source-state
discussion
#3342
Replies: 4 comments 3 replies
-
Adding a comment to this discussion as the intended effects of the new hook may or may not be too wide in scope. Having tested this now with https://github.com/arrrgi/dotfiles/blob/719c26d4ba0c10636d7d091e2e27338f4785f746/home/.chezmoi.yaml.tmpl#L159-L162 and https://github.com/arrrgi/dotfiles/blob/feature/setup-scripts/home/.hooks/.install-hcp-vlt.sh I could see that the read-source-state hook was also executed when running For me the impact was nil as my script is idempotent(ish) but it may catch others out. |
Beta Was this translation helpful? Give feedback.
-
Very interesting!
Sorry, it's still a template, dumb question. Will provide feedback when I get to test it. |
Beta Was this translation helpful? Give feedback.
-
Thanks for the feedback!
This is expected, as the source state can contain |
Beta Was this translation helpful? Give feedback.
-
How do I get the directory chezmoi was run in from a hook? |
Beta Was this translation helpful? Give feedback.
-
#3343 adds a
read-source-state
hook that allows you to run an arbitrary command before chezmoi reads the source state. This can be used, for example, to install your password manager duringchezmoi init
on a new machine.This is a powerful feature and is currently in beta.
If you use this hook, please describe any problems you encounter, or how it can be improved here.
Beta Was this translation helpful? Give feedback.
All reactions