From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 29036 invoked from network); 18 Mar 2001 14:15:35 -0000 Received: from sunsite.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 18 Mar 2001 14:15:35 -0000 Received: (qmail 13508 invoked by alias); 18 Mar 2001 14:15:25 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 13661 Received: (qmail 13496 invoked from network); 18 Mar 2001 14:15:24 -0000 Date: Sun, 18 Mar 2001 09:15:23 -0500 From: Clint Adams To: zsh-workers@sunsite.dk Subject: PATCH: completion for SysV initscripts Message-ID: <20010318091523.A6942@dman.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i This is perhaps a bit too Debian-centric, but should be okay on any OS if the script uses a case statement. Index: Completion/SysV/.distfiles =================================================================== RCS file: .distfiles diff -N .distfiles --- /dev/null Mon Dec 11 17:26:27 2000 +++ .distfiles Sun Mar 18 06:08:22 2001 @@ -0,0 +1,4 @@ +DISTFILES_SRC=' + .distfiles + _sysv_initscripts +' Index: Completion/SysV/_sysv_initscripts =================================================================== RCS file: _sysv_initscripts diff -N _sysv_initscripts --- /dev/null Mon Dec 11 17:26:27 2000 +++ _sysv_initscripts Sun Mar 18 06:08:22 2001 @@ -0,0 +1,17 @@ +#compdef -p /etc/(init|rc[0-9S]).d/* + +local stdargs nonstdargs expl + +if [[ -f $words[1] ]] +then +nonstdargs=(${${(s: :)${${${${(M)${(f)"$(<$words[1])"}:#[ a-z-|]##\)*}%\)*}##\ #}:gs/|/ /}:s/ //}:#(start|stop|restart|force-reload|reload)}) +stdargs=(${(M)${(s: :)${${${${(M)${(f)"$(<$words[1])"}:#[ a-z-|]##\)*}%\)*}##\ #}:gs/|/ /}:s/ //}:#(start|stop|restart|force-reload|reload)}) +else +nonstdargs=() +stdargs=(start stop restart force-reload) +fi + +_tags nonstdargs stdargs + +_wanted -V stdargs expl "standard arguments" compadd -a stdargs +_wanted nonstdargs expl "non-standard arguments" compadd -a nonstdargs