test watch, split commands

This commit is contained in:
Tristan 2024-01-03 01:27:47 +00:00
parent 6b84ecb806
commit d146127911
3 changed files with 65 additions and 4 deletions

View file

@ -1,9 +1,13 @@
pkgs: cmd: pname:
pkgs: {
cmd,
stop ? null,
view ? null,
}:
pkgs.writeShellScriptBin "watch" ''
while true
do
${cmd} &
${cmd} ${if view == null then "" else "| ${view} "}&
${pkgs.inotify-tools}/bin/inotifywait -e modify -r .
pkill ${pname}
${toString stop}
done
''