Watch
1
0
Fork
You've already forked dotfiles
0

bin: Add watch-run

This commit is contained in:
Jeremy Kaplan 2026-09-12 08:50:21 -04:00
commit fb7101a65b
2 changed files with 19 additions and 2 deletions

18
bin/watch-run Executable file
View file

@ -0,0 +1,18 @@
#!/usr/bin/env bash
set -euo pipefail
if [ "$#" -lt 2 ]; then
>&2 echo "usage: $0 dir command [args]"
exit 1
fi
dir="$1"; shift
cmd=("$@")
# I specifically want the command to expand here.
#
# shellcheck disable=SC2068
until fd . "${dir}" | entr -dr ${cmd[@]}; do
echo 'Press Space or edit a file to re-run command'
done

View file

@ -10,10 +10,9 @@ fi
dir="$1"; shift dir="$1"; shift
cmd=("$@") cmd=("$@")
echo 'Press Space or edit a file to run tests'
# I specifically want the command to expand here. # I specifically want the command to expand here.
# #
# shellcheck disable=SC2068 # shellcheck disable=SC2068
until fd . "${dir}" | entr -cdpr ${cmd[@]}; do until fd . "${dir}" | entr -cdr ${cmd[@]}; do
echo 'Press Space or edit a file to re-run tests' echo 'Press Space or edit a file to re-run tests'
done done