[Bash-completion-commits] [SCM] bash-completion branch, master, updated. 1.3-509-g2bb6add

David Paleino dapal at debian.org
Sat Nov 5 10:38:59 UTC 2011


The following commit has been merged in the master branch:
commit 2bb6addc869b13aacd87a4126b70e1a59b867a22
Author: David Paleino <dapal at debian.org>
Date:   Sat Nov 5 11:38:25 2011 +0100

    Correctly list purgeable packages for dpkg --listfiles and dpkg --purge (Debian: #647684)

diff --git a/completions/dpkg b/completions/dpkg
index 247171c..5794c2e 100644
--- a/completions/dpkg
+++ b/completions/dpkg
@@ -10,6 +10,22 @@ _comp_dpkg_installed_packages()
 {
     command grep -A 1 "Package: $1" /var/lib/dpkg/status | \
         command grep -B 1 -Ee "ok installed|half-installed|unpacked| \
+            half-configured" \
+            -Ee "^Essential: yes" | \
+        command grep "Package: $1" | cut -d\  -f2
+}
+}
+
+_have grep-status && {
+_comp_dpkg_purgeable_packages()
+{
+    grep-status -P -e '^ruby' -a -FStatus 'install ok installed' -o -FStatus 'deinstall ok config-files' -n -s Package
+}
+} || {
+_comp_dpkg_purgeable_packages()
+{
+    command grep -A 1 "Package: $1" /var/lib/dpkg/status | \
+        command grep -B 1 -Ee "ok installed|half-installed|unpacked| \
             half-configured|config-files" \
             -Ee "^Essential: yes" | \
         command grep "Package: $1" | cut -d\  -f2
@@ -54,10 +70,14 @@ _dpkg()
             _filedir
             return 0
             ;;
-        -r|-L|-P|--remove|--purge|--listfiles)
+        -r|--remove)
             COMPREPLY=( $( _comp_dpkg_installed_packages "$cur" ) )
             return 0
             ;;
+        -L|-P|--listfiles|--purge)
+            COMPREPLY=( $( _comp_dpkg_purgeable_packages "$cur" ) )
+            return 0
+            ;;
     esac
 
     $split && return

-- 
bash-completion



More information about the Bash-completion-commits mailing list