Skip to content

Commit 21f39ca

Browse files
rsteubejharshman
authored andcommitted
1 parent f2b07da commit 21f39ca

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

bash_completions.go

+10-4
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,9 @@ __%[1]s_handle_reply()
7272
else
7373
allflags=("${flags[*]} ${two_word_flags[*]}")
7474
fi
75-
COMPREPLY=( $(compgen -W "${allflags[*]}" -- "$cur") )
75+
while IFS='' read -r c; do
76+
COMPREPLY+=("$c")
77+
done < <(compgen -W "${allflags[*]}" -- "$cur")
7678
if [[ $(type -t compopt) = "builtin" ]]; then
7779
[[ "${COMPREPLY[0]}" == *= ]] || compopt +o nospace
7880
fi
@@ -122,10 +124,14 @@ __%[1]s_handle_reply()
122124
if [[ ${#must_have_one_flag[@]} -ne 0 ]]; then
123125
completions+=("${must_have_one_flag[@]}")
124126
fi
125-
COMPREPLY=( $(compgen -W "${completions[*]}" -- "$cur") )
127+
while IFS='' read -r c; do
128+
COMPREPLY+=("$c")
129+
done < <(compgen -W "${completions[*]}" -- "$cur")
126130
127131
if [[ ${#COMPREPLY[@]} -eq 0 && ${#noun_aliases[@]} -gt 0 && ${#must_have_one_noun[@]} -ne 0 ]]; then
128-
COMPREPLY=( $(compgen -W "${noun_aliases[*]}" -- "$cur") )
132+
while IFS='' read -r c; do
133+
COMPREPLY+=("$c")
134+
done < <(compgen -W "${noun_aliases[*]}" -- "$cur")
129135
fi
130136
131137
if [[ ${#COMPREPLY[@]} -eq 0 ]]; then
@@ -160,7 +166,7 @@ __%[1]s_handle_filename_extension_flag()
160166
__%[1]s_handle_subdirs_in_dir_flag()
161167
{
162168
local dir="$1"
163-
pushd "${dir}" >/dev/null 2>&1 && _filedir -d && popd >/dev/null 2>&1
169+
pushd "${dir}" >/dev/null 2>&1 && _filedir -d && popd >/dev/null 2>&1 || return
164170
}
165171
166172
__%[1]s_handle_flag()

0 commit comments

Comments
 (0)