Only quote the last arg.

The other ones should already have been quoted by the completion script.

Signed-off-by: Jeffrey Faer <jeffrey.faer@gmail.com>
This commit is contained in:
Jeffrey Faer 2024-12-05 21:33:06 -07:00
parent df206d9f38
commit 7a9725b587

View File

@ -61,7 +61,10 @@ __%[1]s_get_completion_results() {
args=("${words[@]:1}")
requestComp="${words[0]} %[2]s"
if [[ "${#args[@]}" -gt 0 ]]; then
requestComp+="$(printf " %%q" "${args[@]}")"
# Previous args should already be escaped...
requestComp+=" ${args[*]::${#args[@]}-1}"
# ...but the current arg might not yet be escaped.
requestComp+=" $(printf "%%q" "${args[${#args[@]}-1]}")"
fi
lastParam=${words[$((${#words[@]}-1))]}