about summary refs log tree commit diff
path: root/Completion
diff options
context:
space:
mode:
authorChmouel Boudjnah <chmou@users.sourceforge.net>2001-05-29 15:11:40 +0000
committerChmouel Boudjnah <chmou@users.sourceforge.net>2001-05-29 15:11:40 +0000
commit9ce16aeeecbd4cea4d8d91e0b5c9b7e5176c7503 (patch)
tree8fc8e17b61218ed644346cb11b324ca11680e006 /Completion
parent23e2a3e5f894c06203de2c2377dad81c9a37d01d (diff)
downloadzsh-9ce16aeeecbd4cea4d8d91e0b5c9b7e5176c7503.tar.gz
zsh-9ce16aeeecbd4cea4d8d91e0b5c9b7e5176c7503.tar.xz
zsh-9ce16aeeecbd4cea4d8d91e0b5c9b7e5176c7503.zip
Add support for rpm update-alternatives.
Diffstat (limited to 'Completion')
-rw-r--r--Completion/Debian/Command/_update-alternatives20
1 files changed, 13 insertions, 7 deletions
diff --git a/Completion/Debian/Command/_update-alternatives b/Completion/Debian/Command/_update-alternatives
index 3d85f6118..eaeb300b8 100644
--- a/Completion/Debian/Command/_update-alternatives
+++ b/Completion/Debian/Command/_update-alternatives
@@ -1,8 +1,14 @@
 #compdef update-alternatives
 
-local curcontext="$curcontext" context state line expl ret
+local curcontext="$curcontext" context state line expl ret alterdir
 typeset -A opt_args
 
+if [[ -d /var/lib/dpkg/alternatives ]];then
+    alterdir=/var/lib/dpkg/alternatives
+elif [[ -d /var/lib/rpm/alternatives/ ]];then
+    alterdir=/var/lib/rpm/alternatives
+fi
+
 _arguments -C '--verbose' \
            '--quiet' \
            '--test' \
@@ -12,9 +18,9 @@ _arguments -C '--verbose' \
            '--admindir:admindir:_files -/' \
     '--install:*::alt:= ->install' \
     '--remove:*::alt:= ->remove' \
-    '--auto:name:_files -W /var/lib/dpkg/alternatives' \
-    '--display:name:_files -W /var/lib/dpkg/alternatives' \
-    '--config:name:_files -W /var/lib/dpkg/alternatives' && return 0
+    '--auto:name:_files -W $alterdir' \
+    '--display:name:_files -W $alterdir' \
+    '--config:name:_files -W $alterdir' && return 0
 
 while true; do
 case "$state" in
@@ -22,7 +28,7 @@ case "$state" in
         _call_function ret _update_alternatives_$state && return ret
 	state=
 	_arguments -C '1:link:_files' \
-                   '2:name:_files -W /var/lib/dpkg/alternatives' \
+                   '2:name:_files -W $alterdir' \
                    '3:path:_files' \
                    '--slave:*::more:= ->islave' && return 0
         [[ -z $state ]] && return 1
@@ -31,7 +37,7 @@ case "$state" in
 	install)
         _call_function ret _update_alternatives_$state && return ret
 	_arguments -C '1:link:_files' \
-                   '2:name:_files -W /var/lib/dpkg/alternatives' \
+                   '2:name:_files -W $alterdir' \
                    '3:path:_files' \
                    '4:priority:' \
                    '--slave:*::slave:= ->islave' && return 0
@@ -41,7 +47,7 @@ case "$state" in
 	remove)
         _call_function ret _update_alternatives_$state && return ret
 	_arguments \
-                   '1:name:_files -W /var/lib/dpkg/alternatives' \
+                   '1:name:_files -W $alterdir' \
                    '2:path:_files' && return 0
         return 1
 	;;