Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 1 commit into from Apr 28, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 6 additions & 6 deletions bash_completionsV2.go
Expand Up @@ -78,7 +78,7 @@ __%[1]s_get_completion_results() {
directive=0
fi
__%[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() {
Expand Down Expand Up @@ -117,7 +117,7 @@ __%[1]s_process_completion_results() {

# Do not use quotes around the $out variable or else newline
# characters will be kept.
for filter in ${out[*]}; do
for filter in ${out}; do
fullFilter+="$filter|"
done

Expand All @@ -129,7 +129,7 @@ __%[1]s_process_completion_results() {

# Use printf to strip any trailing newline
local subdir
subdir=$(printf "%%s" "${out[0]}")
subdir=$(printf "%%s" "${out}")
if [ -n "$subdir" ]; then
__%[1]s_debug "Listing directories in $subdir"
pushd "$subdir" >/dev/null 2>&1 && _filedir -d && popd >/dev/null 2>&1 || return
Expand Down Expand Up @@ -164,7 +164,7 @@ __%[1]s_handle_completion_types() {
if [ -n "$comp" ]; then
COMPREPLY+=("$comp")
fi
done < <(printf "%%s\n" "${out[@]}")
done < <(printf "%%s\n" "${out}")
;;

*)
Expand All @@ -188,7 +188,7 @@ __%[1]s_handle_standard_completion_case() {
if ((${#comp}>longest)); then
longest=${#comp}
fi
done < <(printf "%%s\n" "${out[@]}")
done < <(printf "%%s\n" "${out}")

local completions=()
while IFS='' read -r comp; do
Expand All @@ -200,7 +200,7 @@ __%[1]s_handle_standard_completion_case() {
comp="$(__%[1]s_format_comp_descriptions "$comp" "$longest")"
__%[1]s_debug "Final comp: $comp"
completions+=("$comp")
done < <(printf "%%s\n" "${out[@]}")
done < <(printf "%%s\n" "${out}")

while IFS='' read -r comp; do
COMPREPLY+=("$comp")
Expand Down