diff --git a/data/share/bash-completion/completions/pkgcheck b/data/share/bash-completion/completions/pkgcheck index 8801391ba..972fc1e5c 100644 --- a/data/share/bash-completion/completions/pkgcheck +++ b/data/share/bash-completion/completions/pkgcheck @@ -43,18 +43,15 @@ _pkgcheck() { COMPREPLY=($(compgen -W "${base_options[*]}" -- "${cur}")) # find the subcommand - for ((i = 1; i < ${COMP_CWORD}; i++)); do - case "${COMP_WORDS[i]}" in - -*) ;; - *) - cmd=${COMP_WORDS[i]} - break - ;; - esac + for (( i=1; i < COMP_CWORD; i++ )); do + if [[ ${COMP_WORDS[i]} != -* ]]; then + cmd=${COMP_WORDS[i]} + break + fi done - if [[ ${i} == ${COMP_CWORD} ]]; then - COMPREPLY+=($(compgen -W "${subcommands[*]}" -- "${cur}")) + if (( i == COMP_CWORD )); then + COMPREPLY+=($(compgen -W "${subcommands}" -- "${cur}")) return fi @@ -73,7 +70,7 @@ _pkgcheck() { case ${prev} in --cache-dir) - COMPREPLY=($(compgen -d -- "${cur}")) + _filedir -d ;; -t | --type) COMPREPLY=($(compgen -W "$(