Skip to content

Commit 3f2dad7

Browse files
committed
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 <[email protected]>
1 parent fbc5c65 commit 3f2dad7

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

bash_completionsV2.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,8 @@ __%[1]s_handle_standard_completion_case() {
233233
234234
# Short circuit to optimize if we don't have descriptions
235235
if [[ "${completions[*]}" != *$tab* ]]; then
236-
IFS=$'\n' read -ra COMPREPLY -d '' < <(compgen -W "${completions[*]}" -- "$cur")
236+
local compgen_words=$(printf "%%s\n" "${completions[@]}")
237+
IFS=$'\n' read -ra COMPREPLY -d '' < <(IFS=$'\n' compgen -W "${compgen_words}" -- "$cur")
237238
238239
# If there is a single completion left, escape the completion
239240
if ((${#COMPREPLY[*]} == 1)); then

0 commit comments

Comments
 (0)