style(bash): out is not an array variable, do not refer to it as such (#1684)
For legacy bash completions, similarly as commit
4f0facbcee 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.
			
			
This commit is contained in:
		@ -99,7 +99,7 @@ __%[1]s_handle_go_custom_completion()
 | 
				
			|||||||
        directive=0
 | 
					        directive=0
 | 
				
			||||||
    fi
 | 
					    fi
 | 
				
			||||||
    __%[1]s_debug "${FUNCNAME[0]}: the completion directive is: ${directive}"
 | 
					    __%[1]s_debug "${FUNCNAME[0]}: the completion directive is: ${directive}"
 | 
				
			||||||
    __%[1]s_debug "${FUNCNAME[0]}: the completions are: ${out[*]}"
 | 
					    __%[1]s_debug "${FUNCNAME[0]}: the completions are: ${out}"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if [ $((directive & shellCompDirectiveError)) -ne 0 ]; then
 | 
					    if [ $((directive & shellCompDirectiveError)) -ne 0 ]; then
 | 
				
			||||||
        # Error code.  No completion.
 | 
					        # Error code.  No completion.
 | 
				
			||||||
@ -125,7 +125,7 @@ __%[1]s_handle_go_custom_completion()
 | 
				
			|||||||
        local fullFilter filter filteringCmd
 | 
					        local fullFilter filter filteringCmd
 | 
				
			||||||
        # 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
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -136,7 +136,7 @@ __%[1]s_handle_go_custom_completion()
 | 
				
			|||||||
        # File completion for directories only
 | 
					        # File completion for directories only
 | 
				
			||||||
        local subdir
 | 
					        local subdir
 | 
				
			||||||
        # Use printf to strip any trailing newline
 | 
					        # Use printf to strip any trailing newline
 | 
				
			||||||
        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"
 | 
				
			||||||
            __%[1]s_handle_subdirs_in_dir_flag "$subdir"
 | 
					            __%[1]s_handle_subdirs_in_dir_flag "$subdir"
 | 
				
			||||||
@ -147,7 +147,7 @@ __%[1]s_handle_go_custom_completion()
 | 
				
			|||||||
    else
 | 
					    else
 | 
				
			||||||
        while IFS='' read -r comp; do
 | 
					        while IFS='' read -r comp; do
 | 
				
			||||||
            COMPREPLY+=("$comp")
 | 
					            COMPREPLY+=("$comp")
 | 
				
			||||||
        done < <(compgen -W "${out[*]}" -- "$cur")
 | 
					        done < <(compgen -W "${out}" -- "$cur")
 | 
				
			||||||
    fi
 | 
					    fi
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user