new script: sane-dev-cargo-loop for running a build command on fs change

This commit is contained in:
colin 2022-08-19 02:01:27 -07:00
parent 118007075f
commit 1446f5e8ca
2 changed files with 19 additions and 0 deletions

View File

@ -35,6 +35,8 @@ resholve.mkDerivation {
keep = {
# we write here: keep it
"/tmp/rmlint.sh" = true;
# intentionally escapes (into user code)
"$external_cmd" = true;
};
fake = {
external = [

View File

@ -0,0 +1,17 @@
#!/usr/bin/env bash
# watches PWD for any changes underneath it and re-runs `cargo build --a>
# optionally, provide your own build command as the first argument
external_cmd="cargo build --all"
if [ "x$1" != "x" ]
then
external_cmd=$1
fi
inotifywait -mr \
--timefmt '%d/%m/%y %H:%M' --format '%T %w %f' \
-e close_write ./ |
while read -r date time dir file
do
$external_cmd
done