support profiles and step aliases with spaces

This commit is contained in:
2022-05-29 12:42:26 +02:00
parent 51e3d774bd
commit 552927d25f
2 changed files with 27 additions and 21 deletions

View File

@@ -3,6 +3,7 @@
_sqn_completions()
{
local tempreply=()
# Current search string
local cur=${COMP_WORDS[COMP_CWORD]}
# Extract alias command with buildins same as:
@@ -35,7 +36,11 @@ _sqn_completions()
# provide completion for option with parameter
-p|--profile)
# sequencer.sh provides creation of a profile list with search functionality
read -r -a COMPREPLY <<<"$( "$curCmd" -pl "${cur}" 2>/dev/null)"
IFS=$'\n' read -r -d '' -a tempreply <<<"$( "$curCmd" -pl "${cur}" 2>/dev/null)"
for comp in "${tempreply[@]}" ; do
# Support for profile names with spaces
COMPREPLY+=("$(printf '%q' "${comp}")")
done
;;
*)
# Stop after step selection (last argument which is not an option (starting with "-|+")
@@ -50,7 +55,12 @@ _sqn_completions()
esac
fi
# sequencer.sh provides creation of a step list with search functionality
read -r -a COMPREPLY <<<"$( "$curCmd" -ls "$cur" )"
#read -r -a COMPREPLY <<<"$( "$curCmd" -ls "$cur" )"
IFS=$'\n' read -r -d '' -a tempreply <<<"$( "$curCmd" -ls "$cur" )"
for comp in "${tempreply[@]}" ; do
# Support for aliases with spaces
COMPREPLY+=("$(printf '%q' "${comp}")")
done
;;
esac
;;