Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Only quote the last arg.
Browse files Browse the repository at this point in the history
The other ones should already have been quoted by the completion script.

Signed-off-by: Jeffrey Faer <jeffrey.faer@gmail.com>
JeffFaer committed Dec 6, 2024
1 parent df206d9 commit 7a9725b
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion bash_completionsV2.go
Original file line number Diff line number Diff line change
@@ -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))]}

0 comments on commit 7a9725b

Please sign in to comment.