diff options
Diffstat (limited to '')
-rwxr-xr-x | hm/soispha/conf/taskwarrior/hooks/scripts/on-add_enforce-policies.sh | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/hm/soispha/conf/taskwarrior/hooks/scripts/on-add_enforce-policies.sh b/hm/soispha/conf/taskwarrior/hooks/scripts/on-add_enforce-policies.sh index 59333a49..84322e6d 100755 --- a/hm/soispha/conf/taskwarrior/hooks/scripts/on-add_enforce-policies.sh +++ b/hm/soispha/conf/taskwarrior/hooks/scripts/on-add_enforce-policies.sh @@ -14,14 +14,15 @@ eprintln() { }; enable_hook_dbg() { - [ "$(task _get rc.debug.hooks)" -ge 1 ] && dbg_enable + debug_hooks="$(task _get rc.debug.hooks)"; + [ "$debug_hooks" ] && [ "$debug_hooks" -ge 1 ] && dbg_enable } enforce_project() { project="$(jq '.project' "$(ptmp "$1")")"; [ "$project" = "null" ] && die "No project supplied!" - if grep "^$(echo "$project" | sed 's|"\([a-z_-]*\).*"|\1|')\$" "$(ptmp "%PROJECTS_NEWLINE")"; then + if grep -q "^$(echo "$project" | sed 's|"\([a-z0-9_-]*\).*"|\1|')\$" "$(ptmp "%PROJECTS_NEWLINE")"; then dbg "project('$project') is a valid part of %PROJECTS_COMMA"; else die "The project '$(echo "$project" | sed 's|"||g')' is not registered with the nix config, registered projects: %PROJECTS_COMMA"; |