--- pacman-bash_completion-011410 2010-01-17 04:12:52.382734901 -0430 +++ /etc/bash_completion.d/pacman 2010-01-17 04:18:26.000000000 -0430 @@ -1,4 +1,3 @@ -#!/bin/bash # pacman/makepkg completion by Andres Perera # # Distributed under the terms of the GNU General Public License v3 or @@ -29,7 +28,7 @@ _makepkg_deselect() { local o - if [[ $1 == [l] ]]; then + if [[ $1 == l ]]; then for o in "${!long[@]}"; do if [[ ${COMP_WORDS[w]} == ${long[o]} ]]; then unset 'long[o]'; break @@ -49,7 +48,7 @@ for (( w=0; w<${#COMP_WORDS[@]}; w++)); do [[ ${COMP_WORDS[w]} == @(-*([^- ])[hC]*|--@(help|cleancache)) ]] && return 0 - _makepkg_deselect $1 + _makepkg_deselect "$1" done } @@ -74,7 +73,8 @@ COMPREPLY=($(compgen -W "$(echo "${short[@]/#/-}" "${long[@]}")" -- "$cur")) elif [[ $prev == @(--config|-*([^- ])p*) ]]; then # Complete filenames for selected options - _filedir; _arch_rem_selected + _arch_rem_selected + return 0 else # Generate the list depending on current word case $cur in @@ -131,10 +131,10 @@ core=( --query --remove --sync --upgrade --version -Q -R -S -U -V ) if (( COMP_CWORD == 1 )) && [[ $cur != -[^-]* ]]; then - COMPREPLY=($(compgen -W "$(echo "${core[@]}" '--help' '-h')" -- "$cur")) + COMPREPLY=($(compgen -W "$(echo "${core[@]}") '--help' '-h'" -- "$cur")) return 0 elif [[ $prev == @(-*([^- ])[br]*|--@(config|logfile|root|dbpath|cachedir)) ]]; then - _filedir; _arch_rem_selected + _arch_rem_selected return 0 else # Main option check @@ -203,8 +203,8 @@ Q) case $COMP_LINE in @(* -*([^- ])g*|* --groups *)) _pacman_pkg Qgq sort ;; - @(* -*([^- ])o*|* --owns *)) _filedir ;; - @(* -*([^- ])p*|* --file *)) _filedir '*.pkg.tar.gz' ;; + @(* -*([^- ])o*|* --owns *)) ;; + @(* -*([^- ])p*|* --file *)) _filedir 'pkg.tar.gz' ;; @(* -*([^- ])u*|* --upgrades *)) _pacman_pkg Quq ;; *) _pacman_pkg Qq ;; esac @@ -220,7 +220,7 @@ esac ;; U) - _filedir '*.pkg.tar.gz' + _filedir 'pkg.tar.gz' ;; esac _arch_rem_selected @@ -230,5 +230,5 @@ COMPREPLY=($(compgen -W "$(echo "${list[@]}")" -- "$cur")) } -complete -F _makepkg $default $filenames makepkg -complete -F _pacman $default $filenames pacman +complete -F _makepkg -o default -o filenames -o plusdirs makepkg +complete -F _pacman -o default -o filenames -o plusdirs pacman