chezmoi runs hooks before and after each chezmoi command as specified by the
hooks configuration variable.
Before running command, chezmoi runs
.pre.command with the
.pre.args. Similarly, after running command,
When running hooks, the
CHEZMOI_* environment variables will
be set. Notably,
CHEZMOI_COMMAND is set to the chezmoi command being run and
CHEZMOI_ARGS contains the full arguments to chezmoi, starting with the path to
Unlike scripts, hooks are always run, irrespective of whether
specified or not.
[hooks.add.pre] command = "echo" args = ["pre-add-hook"] [hooks.apply.post] command = "echo" args = ["post-apply-hook"]