about summary refs log tree commit diff stats
path: root/hm
diff options
context:
space:
mode:
authorSoispha <soispha@vhack.eu>2023-10-02 18:39:31 +0200
committerSoispha <soispha@vhack.eu>2023-10-02 18:39:31 +0200
commit75cebefbdc93199fca57692565125d141b75c069 (patch)
treed09c15d0862a10488b241b87857cc3a8bd4ca698 /hm
parentfeat(hm/conf/taskwarrior): Add taskserver based syncing (diff)
downloadnixos-config-75cebefbdc93199fca57692565125d141b75c069.tar.gz
nixos-config-75cebefbdc93199fca57692565125d141b75c069.zip
fix(hm/conf/taskwarrior/hooks/on-add_policies): Support Numbers in projects
Diffstat (limited to '')
-rwxr-xr-xhm/soispha/conf/taskwarrior/hooks/scripts/on-add_enforce-policies.sh5
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";