From 6e809e16438ff50f3ecdfc711311d3caf92bde94 Mon Sep 17 00:00:00 2001 From: andrewvious <106849954+andrewvious@users.noreply.github.com> Date: Wed, 7 Aug 2024 15:33:56 -0500 Subject: [PATCH] Add support for `ignore-nothing` env variable (#14) Ref #9 Adds script support for `ignore-nothing` env var, and reorder logic regarding the ignore patterns --- nix-watch.nix | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/nix-watch.nix b/nix-watch.nix index b822002..6b04ba5 100644 --- a/nix-watch.nix +++ b/nix-watch.nix @@ -210,16 +210,20 @@ let fi debug "Watching directory: ''${ANSI_BLUE}$WATCH_DIR''${ANSI_RESET}" + if [[ "$CLEAR" == false && -n "$NIX_WATCH_CLEAR" ]]; then + CLEAR=$(convert_int_to_bool $NIX_WATCH_CLEAR) + fi + + if [[ "$IGNORE_NOTHING" == false && -n "$NIX_WATCH_IGNORE_NOTHING" ]]; then + IGNORE_NOTHING=$(convert_int_to_bool $NIX_WATCH_IGNORE_NOTHING) + fi + if [ "$IGNORE_NOTHING" == true ]; then IGNORE_PATTERNS=() fi ignore_patterns="[''${IGNORE_PATTERNS[@]}]" debug "The following patterns will be ignored: ''${ANSI_BLUE}$ignore_patterns''${ANSI_RESET}" - if [[ "$CLEAR" == false && -n "$NIX_WATCH_CLEAR" ]]; then - CLEAR=$(convert_int_to_bool $NIX_WATCH_CLEAR) - fi - if [[ "$DEBUG" == false && -n "$NIX_WATCH_DEBUG" ]]; then DEBUG=$(convert_int_to_bool $NIX_WATCH_DEBUG) fi