--- bash_completion~ 2009-01-06 19:12:03.000000000 +0200 +++ bash_completion 2009-01-06 19:31:06.000000000 +0200 @@ -1811,29 +1811,28 @@ # _rpm_installed_packages() { - local ver nodig nosig + local ver nodig="$1" nosig="$2" if [ -r /var/log/rpmpkgs -a \ /var/log/rpmpkgs -nt /var/lib/rpm/Packages ]; then # using RHL 7.2 or later - this is quicker than querying the DB COMPREPLY=( $( sed -ne \ - 's|^\('$cur'.*\)-[0-9a-zA-Z._]\+-[0-9a-z.@]\+.*\.rpm$|\1|p' \ + 's|^\('$cur'[^[:space:]]*\)-[^[:space:]-]\+-[^[:space:]-]\+\.rpm$|\1|p' \ /var/log/rpmpkgs ) ) else - nodig="" - nosig="" - ver=$(rpm --version) - ver=${ver##* } + if [ -z "$nodig" -a -z "$nosig" ]; then + ver=$(rpm --version) + ver=${ver##* } - if [[ "$ver" > "4.0.4" ]]; then - nodig="--nodigest" - fi - if [[ "$ver" > "4.0.99" ]]; then - nosig="--nosignature" + if [[ "$ver" > "4.0.4" ]]; then + nodig="--nodigest" + fi + if [[ "$ver" > "4.0.99" ]]; then + nosig="--nosignature" + fi fi - COMPREPLY=( $( rpm -qa $nodig $nosig | sed -ne \ - 's|^\('$cur'.*\)-[0-9a-zA-Z._]\+-[0-9a-z.@]\+$|\1|p' ) ) + COMPREPLY=( $( rpm -qa $nodig $nosig --qf='%{NAME} ' "$cur*" ) ) fi } @@ -1959,7 +1958,7 @@ COMPREPLY=( $( compgen -W '--allmatches --noscripts \ --notriggers --nodeps --test --repackage' -- $cur ) ) else - _rpm_installed_packages + _rpm_installed_packages "$nodig" "$nosig" fi ;; -@(q*|-query)) @@ -2011,7 +2010,7 @@ --fileid --tid --nodigest --nosignature \ --triggerscripts' -- $cur ) ) elif [ "${COMP_LINE#* -*([^ -])a}" == "$COMP_LINE" ]; then - _rpm_installed_packages + _rpm_installed_packages "$nodig" "$nosig" fi fi ;; @@ -2038,7 +2037,7 @@ elif [ "${COMP_LINE#* -*([^ -])p}" != "$COMP_LINE" ]; then _filedir 'rpm' else - _rpm_installed_packages + _rpm_installed_packages "$nodig" "$nosig" fi ;; -[bt]*) @@ -2068,7 +2067,7 @@ _filedir 'rpm' ;; --set@(perms|gids)) - _rpm_installed_packages + _rpm_installed_packages "$nodig" "$nosig" ;; --@(clean|rms@(ource|pec))) if [[ "$cur" == -* ]]; then