From 75cebefbdc93199fca57692565125d141b75c069 Mon Sep 17 00:00:00 2001 From: Soispha Date: Mon, 2 Oct 2023 18:39:31 +0200 Subject: fix(hm/conf/taskwarrior/hooks/on-add_policies): Support Numbers in projects --- hm/soispha/conf/taskwarrior/hooks/scripts/on-add_enforce-policies.sh | 5 +++-- 1 file 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"; -- cgit 1.4.1