Skip to content
Myr

style(bash): out is not an array variable, do not refer to it as such (#1684)

Before adoption: this commit came in with the history the project adopted, so no landing records it.

For legacy bash completions, similarly as commit 4f0facbcee0aadb87179d3fed80e92709de491a9 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.

authored by Ville Skyttä · committed by GitHub · parent 09d6ba6 · Browse files · 1 file+4 added−4 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+4 added−4 removed

  • other:+4 added−4 removed

1 file+4 added−4 removed

modified:bash_completions.go+4 added-4 removed
97 unmodified lines
98 # There is not directive specified99 directive=0100 fi101 __%[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}"103104 if [ $((directive & shellCompDirectiveError)) -ne 0 ]; then105 # Error code. No completion.106 __%[1]s_debug "${FUNCNAME[0]}: received error from custom completion go code"
17 unmodified lines
124 # File extension filtering125 local fullFilter filter filteringCmd126 # Do not use quotes around the $out variable or else newline127 # characters will be kept.128 for filter in ${out[*]}; do128 for filter in ${out}; do129 fullFilter+="$filter|"130 done131132 filteringCmd="_filedir $fullFilter"
2 unmodified lines
135 elif [ $((directive & shellCompDirectiveFilterDirs)) -ne 0 ]; then136 # File completion for directories only137 local subdir138 # Use printf to strip any trailing newline139 subdir=$(printf "%%s" "${out[0]}")139 subdir=$(printf "%%s" "${out}")140 if [ -n "$subdir" ]; then141 __%[1]s_debug "Listing directories in $subdir"142 __%[1]s_handle_subdirs_in_dir_flag "$subdir"143 else
2 unmodified lines
146 fi147 else148 while IFS='' read -r comp; do149 COMPREPLY+=("$comp")150 done < <(compgen -W "${out[*]}" -- "$cur")150 done < <(compgen -W "${out}" -- "$cur")151 fi152}153154__%[1]s_handle_reply()
543 unmodified lines