new script: sane-dev-cargo-loop for running a build command on fs change
This commit is contained in:
parent
118007075f
commit
1446f5e8ca
|
@ -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 = [
|
||||
|
|
17
pkgs/sane-scripts/src/bin/sane-dev-cargo-loop
Executable file
17
pkgs/sane-scripts/src/bin/sane-dev-cargo-loop
Executable 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
|
Loading…
Reference in New Issue
Block a user