From 00de75a43cabbfa6b6ea738238a72cb67eda2094 Mon Sep 17 00:00:00 2001 From: Jeremy Kaplan Date: Mon, 9 Aug 2021 18:38:40 -0700 Subject: [PATCH] bin: watch-test --- bin/watch-test | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100755 bin/watch-test diff --git a/bin/watch-test b/bin/watch-test new file mode 100755 index 0000000..d332511 --- /dev/null +++ b/bin/watch-test @@ -0,0 +1,19 @@ +#!/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=("$@") + +echo 'Press Space or edit a file to run tests' +# I specifically want the command to expand here. +# +# shellcheck disable=SC2068 +until fd . "${dir}" | entr -cdp ${cmd[@]}; do + echo 'Press Space or edit a file to re-run tests' +done