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

Even though this to my surprise works, it doesn't accomplish anything
but some confusion. Remove it.
This commit is contained in:
Ville Skyttä 2022-04-28 05:27:52 +03:00 committed by GitHub
parent 2722a75ba3
commit 4f0facbcee
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -78,7 +78,7 @@ __%[1]s_get_completion_results() {
directive=0 directive=0
fi fi
__%[1]s_debug "The completion directive is: ${directive}" __%[1]s_debug "The completion directive is: ${directive}"
__%[1]s_debug "The completions are: ${out[*]}" __%[1]s_debug "The completions are: ${out}"
} }
__%[1]s_process_completion_results() { __%[1]s_process_completion_results() {
@ -117,7 +117,7 @@ __%[1]s_process_completion_results() {
# Do not use quotes around the $out variable or else newline # Do not use quotes around the $out variable or else newline
# characters will be kept. # characters will be kept.
for filter in ${out[*]}; do for filter in ${out}; do
fullFilter+="$filter|" fullFilter+="$filter|"
done done
@ -129,7 +129,7 @@ __%[1]s_process_completion_results() {
# Use printf to strip any trailing newline # Use printf to strip any trailing newline
local subdir local subdir
subdir=$(printf "%%s" "${out[0]}") subdir=$(printf "%%s" "${out}")
if [ -n "$subdir" ]; then if [ -n "$subdir" ]; then
__%[1]s_debug "Listing directories in $subdir" __%[1]s_debug "Listing directories in $subdir"
pushd "$subdir" >/dev/null 2>&1 && _filedir -d && popd >/dev/null 2>&1 || return pushd "$subdir" >/dev/null 2>&1 && _filedir -d && popd >/dev/null 2>&1 || return
@ -163,7 +163,7 @@ __%[1]s_handle_completion_types() {
if [ -n "$comp" ]; then if [ -n "$comp" ]; then
COMPREPLY+=("$comp") COMPREPLY+=("$comp")
fi fi
done < <(printf "%%s\n" "${out[@]}") done < <(printf "%%s\n" "${out}")
;; ;;
*) *)
@ -186,7 +186,7 @@ __%[1]s_handle_standard_completion_case() {
if ((${#comp}>longest)); then if ((${#comp}>longest)); then
longest=${#comp} longest=${#comp}
fi fi
done < <(printf "%%s\n" "${out[@]}") done < <(printf "%%s\n" "${out}")
local completions=() local completions=()
while IFS='' read -r comp; do while IFS='' read -r comp; do
@ -198,7 +198,7 @@ __%[1]s_handle_standard_completion_case() {
comp="$(__%[1]s_format_comp_descriptions "$comp" "$longest")" comp="$(__%[1]s_format_comp_descriptions "$comp" "$longest")"
__%[1]s_debug "Final comp: $comp" __%[1]s_debug "Final comp: $comp"
completions+=("$comp") completions+=("$comp")
done < <(printf "%%s\n" "${out[@]}") done < <(printf "%%s\n" "${out}")
while IFS='' read -r comp; do while IFS='' read -r comp; do
COMPREPLY+=("$comp") COMPREPLY+=("$comp")