Add post-change hooks feature

After rendering a template, `tmpl` will now run any commands specified
in the `hooks` property of a template instruction.  Hooks can either be
"immediate," meaning they will run as soon as the new file is written,
or "deferred," and will run after all templates have been rendered.
Deferred hooks are deduplicated: if multiple templates specify the
exact same command, it will only be run once.  Hook commands can include
the `%s` placeholder, which will be replaced by the path of the rendered
file.
This commit is contained in:
2024-01-11 20:02:37 -06:00
parent bd7b80dede
commit 6d0bfeedaf
4 changed files with 162 additions and 6 deletions

View File

@@ -7,10 +7,12 @@ edition = "2021"
[dependencies]
argparse = "0.2.2"
blake2 = "0.10.6"
file-mode = { version = "0.1.2", features = ["serde"] }
pwd-grp = "0.1.1"
serde = { version = "1.0.195", features = ["derive"] }
serde_yaml = "0.9.30"
shlex = "1.2.0"
tera = "1.19.1"
thiserror = "1.0.56"
tracing = { version = "0.1.40", features = ["log"] }