mirror of
https://github.com/spf13/cobra.git
synced 2024-12-19 01:55:03 -07:00
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:
parent
df206d9f38
commit
7a9725b587
@ -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))]}
|
||||
|
Loading…
Reference in New Issue
Block a user