Skip to content

Commit

Permalink
Add NIX_WATCH_IGNORE_PATTERNS env var (#22)
Browse files Browse the repository at this point in the history
Ref #9 

Adds the `IGNORE_PATTERNS` environment variable handling.
  • Loading branch information
eureka-cpu authored Aug 20, 2024
1 parent 35ade1e commit 9c82b8c
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions nix-watch.nix
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ let
NO_RESTART=false
POSTPONE=false
WATCH_DIR="."
IGNORE_PATTERNS=("result*" ".*\.git")
IGNORE_PATTERNS=()
PRINT_BUILD_LOGS=false
DEBUG=false
Expand Down Expand Up @@ -222,12 +222,16 @@ let
CLEAR=$(convert_int_to_bool $NIX_WATCH_CLEAR)
fi
DEFAULT_IGNORE_PATTERNS=("result*" ".*\.git")
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=()
elif [[ -n "$NIX_WATCH_IGNORE_PATTERNS" ]]; then
IGNORE_PATTERNS+=($(process_args "''${NIX_WATCH_IGNORE_PATTERNS[@]}"))
else
IGNORE_PATTERNS+=("''${DEFAULT_IGNORE_PATTERNS[@]}")
fi
ignore_patterns="[''${IGNORE_PATTERNS[@]}]"
debug "The following patterns will be ignored: ''${ANSI_BLUE}$ignore_patterns''${ANSI_RESET}"
Expand Down

0 comments on commit 9c82b8c

Please sign in to comment.