Run script when external changes
Closed this issue · 3 comments
Is your feature request related to a problem? Please describe.
I'm always frustrated when I want to run a script after an external changes like git-repo
Describe the solution you'd like
Provide external's status in the chezmoi data.
For git-repo
it could be the current latest commit id,
For others it could be the checksum or other things.
So I can include something like
{{ .chezmoi.external.".emacs.d".status }}
or
add templete function like git
{{ gitStatus "~/.emacs.d" }}
and for dir
{{ dirHash "~/.emacs.d" }}
in my scripts and only run them if the external changes with run_on_change
prefix.
Describe alternatives you've considered
Give an run_on_external_change
prefix for script.
Could following by an external name like run_on_external_change_dot_emacs_d
Additional context
It could be helpful if we want run script only when the external changes.
I think {{ "output" "git" "-C" "~/.emacs.d" "rev-parse" "HEAD" }}
for git-repo
is ok
@ErrrorMaxx Thanks! Seemed I missed the output
function.
For others, the final version could be:
{{ output "git" "-C" (joinPath .chezmoi.homeDir ".emacs.d") "rev-parse" "HEAD" }}