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

PATCH: update-alternatives completion



The problem I alluded to in 14512 is present here.  If one
tries to complete update-alternatives --remove,
it tries to complete an "alt" argument in between
--remove and the 1st argument.  Since the state is specified
rather than possible completions for that argument, it
doesn't seem very useful.

Also, the slave substate doesn't work, but I haven't
bothered to look into it yet.

Index: Completion/Debian/Command/.distfiles
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Debian/Command/.distfiles,v
retrieving revision 1.1
diff -u -r1.1 .distfiles
--- Completion/Debian/Command/.distfiles	2001/04/02 12:43:00	1.1
+++ Completion/Debian/Command/.distfiles	2001/05/28 18:59:57
@@ -1,4 +1,5 @@
 DISTFILES_SRC='
 .distfiles
 _apt          _bug          _dpkg         _dpkg_source  _dupload
+_update_alternatives
 '
Index: Completion/Debian/Command/_update-alternatives
===================================================================
RCS file: _update-alternatives
diff -N _update-alternatives
--- /dev/null	Thu May 24 22:33:05 2001
+++ _update-alternatives	Mon May 28 11:59:57 2001
@@ -0,0 +1,41 @@
+#compdef update-alternatives
+
+local curcontext="$curcontext" context state line expl ret
+typeset -A opt_args
+
+_arguments -C '--verbose' \
+           '--quiet' \
+           '--test' \
+           '--help' \
+           '--version' \
+           '--altdir:altdir:_files -/' \
+           '--admindir:admindir:_files -/' \
+    '--install:*::alt:->install' \
+    '--remove:*::alt:->remove' \
+    '--auto:altname:_files -W /var/lib/dpkg/alternatives' \
+    '--display:altname:_files -W /var/lib/dpkg/alternatives' \
+    '--config:altname:_files -W /var/lib/dpkg/alternatives' && return 0
+
+_call_function ret _update_alternatives_$state && return ret
+case "$state" in
+	islave)
+	_arguments -C '1:link:_files' \
+                   '2:name:_files -W /var/lib/dpkg/alternatives' \
+                   '3:path:_files' \
+                   '--slave:*::slave:->islave'
+	;;
+	install)
+	_arguments -C '1:link:_files' \
+                   '2:name:_files -W /var/lib/dpkg/alternatives' \
+                   '3:path:_files' \
+                   '4:priority:' \
+                   '--slave:*::slave:->islave' \
+	;;
+
+	remove)
+	_arguments \
+                   '1:altname:_files -W /var/lib/dpkg/alternatives' \
+                   '2:path:_files'
+	;;
+
+esac



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