From 56036b13c38819cee6c0c53464195ecc16aa9168 Mon Sep 17 00:00:00 2001 From: colin Date: Fri, 19 Aug 2022 02:26:59 -0700 Subject: [PATCH] sane-scripts: sane-dev-cargo-loop: add `tput reset` between runs --- pkgs/sane-scripts/default.nix | 1 + pkgs/sane-scripts/src/sane-dev-cargo-loop | 21 +++++++++++++++++---- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/pkgs/sane-scripts/default.nix b/pkgs/sane-scripts/default.nix index e337f72e..786d8079 100644 --- a/pkgs/sane-scripts/default.nix +++ b/pkgs/sane-scripts/default.nix @@ -24,6 +24,7 @@ resholve.mkDerivation { gnugrep ifuse inotifyTools + ncurses oath-toolkit openssh rmlint diff --git a/pkgs/sane-scripts/src/sane-dev-cargo-loop b/pkgs/sane-scripts/src/sane-dev-cargo-loop index 9189f084..c8bc5af7 100755 --- a/pkgs/sane-scripts/src/sane-dev-cargo-loop +++ b/pkgs/sane-scripts/src/sane-dev-cargo-loop @@ -5,13 +5,26 @@ external_cmd="cargo build --all" if [ "x$1" != "x" ] then - external_cmd=$1 + external_cmd=$1 fi -inotifywait -mr \ +# run this once before starting the inotify +$external_cmd + +# other interesting commands to monitor: +# - -e move +# - -e create +# - -e delete +# - -e close_write +# but most (except close_write) seem to cause multiple events per vim :w +# TODO: consider using watchman: https://facebook.github.io/watchman/ +# - watchman waits for the root to settle before invoking my command +# so, fewer runs +inotifywait --monitor --recursive \ --timefmt '%d/%m/%y %H:%M' --format '%T %w %f' \ - -e close_write ./ | + -e modify ./ | while read -r date time dir file do - $external_cmd + tput reset + $external_cmd done