From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 11354 invoked from network); 28 May 2001 19:05:21 -0000 Received: from sunsite.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 28 May 2001 19:05:21 -0000 Received: (qmail 19778 invoked by alias); 28 May 2001 19:05:12 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 14513 Received: (qmail 19751 invoked from network); 28 May 2001 19:05:10 -0000 Date: Mon, 28 May 2001 15:05:09 -0400 From: Clint Adams To: zsh-workers@sunsite.dk Subject: PATCH: update-alternatives completion Message-ID: <20010528150509.A19581@dman.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i 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