From 5bf09e1a0468529cf416b88c71598963cc68a0e4 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=B6rg=20Sachse?= <joerg.sachse@slub-dresden.de>
Date: Fri, 14 Oct 2022 11:53:19 +0200
Subject: [PATCH] fix: correct grep of CLI options using quantifiers and
 extended regex mode

---
 test_complete.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/test_complete.sh b/test_complete.sh
index 235857e..08df3d6 100644
--- a/test_complete.sh
+++ b/test_complete.sh
@@ -4,7 +4,7 @@ _validate_workflow_completion() {
     COMPREPLY=()
     cur="${COMP_WORDS[COMP_CWORD]}"
     prev="${COMP_WORDS[COMP_CWORD-1]}"
-    opts=$(cat $SELF | grep "^#hh\s-., --[a-z]" | sed -e "s/^#hh.*\(-.\), \(--[a-z-]*\).*/\1 \2/g")
+    opts=$(grep -rE "^#hh\s+-., --[a-z]+" "${SELF}" | sed -e "s/^#hh.*\(-.\), \(--[a-z-]*\).*/\1 \2/g")
     2>&1 echo "OPTS:$opts" 
     case "$prev" in
         --pipe)
-- 
GitLab