mirror of
https://github.com/spf13/cobra.git
synced 2024-12-23 20:15:21 -07:00
address review comments
Signed-off-by: Jeffrey Faer <jeffrey.faer@gmail.com>
This commit is contained in:
parent
76d900bc72
commit
9771cb0949
@ -229,6 +229,8 @@ __%[1]s_handle_completion_types() {
|
||||
COMPREPLY+=("$comp")
|
||||
fi
|
||||
done
|
||||
|
||||
IFS=$'\n' read -ra COMPREPLY -d '' < <(printf "%%q\n" "${COMPREPLY[@]}")
|
||||
;;
|
||||
|
||||
*)
|
||||
@ -249,6 +251,12 @@ __%[1]s_handle_standard_completion_case() {
|
||||
# they have the right prefix, so we also need to quote cur.
|
||||
local compgen_cur="$(printf "%%q" "${cur}")"
|
||||
IFS=$'\n' read -ra COMPREPLY -d '' < <(IFS=$'\n'; compgen -W "${compgen_words}" -- "${compgen_cur}")
|
||||
|
||||
# If there is a single completion left, escape the completion
|
||||
if ((${#COMPREPLY[*]} == 1)); then
|
||||
COMPREPLY[0]=$(printf %%q "${COMPREPLY[0]}")
|
||||
fi
|
||||
|
||||
return 0
|
||||
fi
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user