mirror of
https://github.com/spf13/cobra
synced 2024-11-24 14:47:12 +00:00
Use line-break as field separator in compgen words input
This ensures that completions with whitespace are treated as single completion. Signed-off-by: Toni Kangas <toni.kangas@upcloud.com>
This commit is contained in:
parent
fbc5c65ae1
commit
3f2dad7403
1 changed files with 2 additions and 1 deletions
|
@ -233,7 +233,8 @@ __%[1]s_handle_standard_completion_case() {
|
||||||
|
|
||||||
# Short circuit to optimize if we don't have descriptions
|
# Short circuit to optimize if we don't have descriptions
|
||||||
if [[ "${completions[*]}" != *$tab* ]]; then
|
if [[ "${completions[*]}" != *$tab* ]]; then
|
||||||
IFS=$'\n' read -ra COMPREPLY -d '' < <(compgen -W "${completions[*]}" -- "$cur")
|
local compgen_words=$(printf "%%s\n" "${completions[@]}")
|
||||||
|
IFS=$'\n' read -ra COMPREPLY -d '' < <(IFS=$'\n' compgen -W "${compgen_words}" -- "$cur")
|
||||||
|
|
||||||
# If there is a single completion left, escape the completion
|
# If there is a single completion left, escape the completion
|
||||||
if ((${#COMPREPLY[*]} == 1)); then
|
if ((${#COMPREPLY[*]} == 1)); then
|
||||||
|
|
Loading…
Reference in a new issue