Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

apt4rpm completion: _apt



The next step is to modify _apt completion so that it can check host
system type and use _rpm_packages whenever applicable:

--- zsh-4.2.4/Completion/Debian/Command/_apt-	2004-08-01 14:48:24 +0000
+++ zsh-4.2.4/Completion/Debian/Command/_apt	2005-03-11 10:33:49 +0000
@@ -1,6 +1,8 @@
 #compdef apt-get apt-cache apt-cdrom apt-config
 
 _apt () {
+  local deb=deb
+  [ -f /etc/debian_version ] || deb=rpm
   case "$service" in
     apt-get) _apt-get "$@";;
     apt-cache) _apt-cache "$@";;
@@ -423,16 +425,16 @@ _apt-get () {
     /$'update\0'/ \| \
     /$'upgrade\0'/ \| \
     \( \
-    /$'install\0'/ /$'[^\0]#\0'/ ':packages::_deb_packages "$expl_packages[@]" avail' \# \
+    /$'install\0'/ /$'[^\0]#\0'/ :packages::_${deb}_packages' "$expl_packages[@]" avail' \# \
     /$'[^\0/]#/'/ /$'[^\0/]#\0'/ ':release name::_apt_releases' \) \| \
-    /$'remove\0'/ /$'[^\0]#\0'/ ':packages::_deb_packages "$expl_packages[@]" installed' \# \| \
+    /$'remove\0'/ /$'[^\0]#\0'/ :packages::_${deb}_packages' "$expl_packages[@]" installed' \# \| \
     /$'dist-upgrade\0'/ \| \
     /$'dselect-upgrade\0'/ \| \
     /$'clean\0'/ \| \
     /$'autoclean\0'/ \| \
     /$'check\0'/ \| \
-    /$'source\0'/ /$'[^\0]#\0'/ ':packages::_deb_packages "$expl_packages[@]" avail' \# \| \
-    /$'build-dep\0'/ /$'[^\0]#\0'/ ':packages::_deb_packages "$expl_packages[@]" avail' \# \| \
+    /$'source\0'/ /$'[^\0]#\0'/ :packages::_${deb}_packages' "$expl_packages[@]" avail' \# \| \
+    /$'build-dep\0'/ /$'[^\0]#\0'/ :packages::_${deb}_packages' "$expl_packages[@]" avail' \# \| \
     /$'help\0/' \| \
     /"[]"/	':argument-1::compadd "$expl_action[@]" update upgrade install remove dist-upgrade dselect-upgrade clean autoclean check source build-dep help'
 
@@ -467,20 +469,20 @@ _apt-cache () {
     /$'help\0'/ \| \
     /$'add\0'/ /$'[^\0]#\0'/ ':files:index files:_files "$expl[@]"' \# \| \
     /$'gencaches\0'/ \| \
-    /$'showpkg\0'/ /$'[^\0]#\0'/ ':packages::_deb_packages "$expl_packages[@]" avail' \# \| \
-    /$'showsrc\0'/ /$'[^\0]#\0'/ ':packages::_deb_packages "$expl_packages[@]" avail' \# \| \
+    /$'showpkg\0'/ /$'[^\0]#\0'/ :packages::_${deb}_packages' "$expl_packages[@]" avail' \# \| \
+    /$'showsrc\0'/ /$'[^\0]#\0'/ :packages::_${deb}_packages' "$expl_packages[@]" avail' \# \| \
     /$'stats\0'/ \| \
     /$'dump\0'/ \| \
     /$'dumpavail\0'/ \| \
     /$'unmet\0'/ \| \
     /$'search\0'/ /$'[^\0]#\0'/ ':strings:pattern:' \| \
-    /$'show\0'/ /$'[^\0]#\0'/ ':packages::_deb_packages "$expl_packages[@]" avail' \# \| \
-    /$'depends\0'/ /$'[^\0]#\0'/ ':packages::_deb_packages "$expl_packages[@]" avail' \# \| \
-    /$'rdepends\0'/ /$'[^\0]#\0'/ ':packages::_deb_packages "$expl_packages[@]" avail' \# \| \
+    /$'show\0'/ /$'[^\0]#\0'/ :packages::_${deb}_packages' "$expl_packages[@]" avail' \# \| \
+    /$'depends\0'/ /$'[^\0]#\0'/ :packages::_${deb}_packages' "$expl_packages[@]" avail' \# \| \
+    /$'rdepends\0'/ /$'[^\0]#\0'/ :packages::_${deb}_packages' "$expl_packages[@]" avail' \# \| \
     /$'pkgnames\0'/ /$'[^\0]#\0'/ ':strings:prefix:' \| \
-    /$'dotty\0'/ /$'[^\0]#\0'/ ':packages::_deb_packages "$expl_packages[@]" avail' \# \| \
-    /$'xvcg\0'/ /$'[^\0]#\0'/ ':packages::_deb_packages "$expl_packages[@]" avail' \# \| \
-    /$'policy\0'/ /$'[^\0]#\0'/ ':packages::_deb_packages "$expl_packages[@]" avail' \# \| \
+    /$'dotty\0'/ /$'[^\0]#\0'/ :packages::_${deb}_packages' "$expl_packages[@]" avail' \# \| \
+    /$'xvcg\0'/ /$'[^\0]#\0'/ :packages::_${deb}_packages' "$expl_packages[@]" avail' \# \| \
+    /$'policy\0'/ /$'[^\0]#\0'/ :packages::_${deb}_packages' "$expl_packages[@]" avail' \# \| \
     /"[]"/ ':argument-1::compadd "$expl_action[@]" help add gencaches showpkg showsrc stats dump dumpavail unmet search show depends rdepends pkgnames dotty policy xvcg'
 
   _apt-cache () {
End of patch

Attachment: pgpgXJ3fUc778.pgp
Description: PGP signature



Messages sorted by: Reverse Date, Date, Thread, Author