From 20819febaee97206825dc1c06a2a371481f7680c 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 13:50:39 +0200 Subject: [PATCH] feat: parse get_cli_args() function, extract list of CLI options and discard the rest --- test_complete.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test_complete.sh b/test_complete.sh index 08df3d6..cdc8b61 100644 --- a/test_complete.sh +++ b/test_complete.sh @@ -4,7 +4,8 @@ _validate_workflow_completion() { COMPREPLY=() cur="${COMP_WORDS[COMP_CWORD]}" prev="${COMP_WORDS[COMP_CWORD-1]}" - opts=$(grep -rE "^#hh\s+-., --[a-z]+" "${SELF}" | sed -e "s/^#hh.*\(-.\), \(--[a-z-]*\).*/\1 \2/g") + # parse get_cli_args() function, extract list of CLI options and discard the rest + opts="$( type get_cli_args | grep -E -v "^[{}]" | grep -v "get_cli_args" | grep -E "^\s+-.|--[a-z]+)" | sed -e "s/^\s*\(-.\) | \(--[a-z-]*\).*/\1 \2/g" )" 2>&1 echo "OPTS:$opts" case "$prev" in --pipe) -- GitLab