Skip to content

Commit

Permalink
Use line-break as field separator in compgen words input
Browse files Browse the repository at this point in the history
This ensures that completions with whitespace are treated as single completion.

Signed-off-by: Toni Kangas <[email protected]>
  • Loading branch information
kangasta committed Aug 25, 2022
1 parent 99d15ec commit 5f27234
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion bash_completionsV2.go
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,8 @@ __%[1]s_handle_standard_completion_case() {
# Short circuit to optimize if we don't have descriptions
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 ((${#COMPREPLY[*]} == 1)); then
Expand Down

0 comments on commit 5f27234

Please sign in to comment.