Skip to content

Commit f17e5a2

Browse files
authored
style(bash): out is not an array variable, do not refer to it as such (#1684)
For legacy bash completions, similarly as commit 4f0facb is for bash completions v2. As a side effect, fixes test suite with shellcheck 0.8.0 installed; apparently the 0.7.0 that's in GitHub Actions' ubuntu-latest at the moment does not flag the array quoting related issue that was provoked from 0.8.0 before this change.
1 parent 09d6ba6 commit f17e5a2

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

bash_completions.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ __%[1]s_handle_go_custom_completion()
9999
directive=0
100100
fi
101101
__%[1]s_debug "${FUNCNAME[0]}: the completion directive is: ${directive}"
102-
__%[1]s_debug "${FUNCNAME[0]}: the completions are: ${out[*]}"
102+
__%[1]s_debug "${FUNCNAME[0]}: the completions are: ${out}"
103103
104104
if [ $((directive & shellCompDirectiveError)) -ne 0 ]; then
105105
# Error code. No completion.
@@ -125,7 +125,7 @@ __%[1]s_handle_go_custom_completion()
125125
local fullFilter filter filteringCmd
126126
# Do not use quotes around the $out variable or else newline
127127
# characters will be kept.
128-
for filter in ${out[*]}; do
128+
for filter in ${out}; do
129129
fullFilter+="$filter|"
130130
done
131131
@@ -136,7 +136,7 @@ __%[1]s_handle_go_custom_completion()
136136
# File completion for directories only
137137
local subdir
138138
# Use printf to strip any trailing newline
139-
subdir=$(printf "%%s" "${out[0]}")
139+
subdir=$(printf "%%s" "${out}")
140140
if [ -n "$subdir" ]; then
141141
__%[1]s_debug "Listing directories in $subdir"
142142
__%[1]s_handle_subdirs_in_dir_flag "$subdir"
@@ -147,7 +147,7 @@ __%[1]s_handle_go_custom_completion()
147147
else
148148
while IFS='' read -r comp; do
149149
COMPREPLY+=("$comp")
150-
done < <(compgen -W "${out[*]}" -- "$cur")
150+
done < <(compgen -W "${out}" -- "$cur")
151151
fi
152152
}
153153

0 commit comments

Comments
 (0)