Skip to content

Commit

Permalink
address review comments
Browse files Browse the repository at this point in the history
Signed-off-by: Jeffrey Faer <[email protected]>
  • Loading branch information
JeffFaer committed Dec 5, 2024
1 parent 76d900b commit 9771cb0
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion bash_completionsV2.go
Original file line number Diff line number Diff line change
Expand Up @@ -226,9 +226,11 @@ __%[1]s_handle_completion_types() {
comp=${comp%%%%$tab*}
# Only consider the completions that match
if [[ $comp == "$cur"* ]]; then
COMPREPLY+=( "$comp" )
COMPREPLY+=("$comp")
fi
done
IFS=$'\n' read -ra COMPREPLY -d '' < <(printf "%%q\n" "${COMPREPLY[@]}")
;;
*)
Expand All @@ -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
Expand Down

0 comments on commit 9771cb0

Please sign in to comment.