zsh-workers
 help / color / mirror / code / Atom feed
* PATCH: completion for SysV initscripts
@ 2001-03-18 14:15 Clint Adams
  2001-03-18 17:57 ` Bart Schaefer
  0 siblings, 1 reply; 3+ messages in thread
From: Clint Adams @ 2001-03-18 14:15 UTC (permalink / raw)
  To: zsh-workers

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


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: PATCH: completion for SysV initscripts
  2001-03-18 14:15 PATCH: completion for SysV initscripts Clint Adams
@ 2001-03-18 17:57 ` Bart Schaefer
  2001-03-18 19:49   ` Clint Adams
  0 siblings, 1 reply; 3+ messages in thread
From: Bart Schaefer @ 2001-03-18 17:57 UTC (permalink / raw)
  To: Clint Adams, zsh-workers

On Mar 18,  9:15am, Clint Adams wrote:
} Subject: PATCH: completion for SysV initscripts
}
} This is perhaps a bit too Debian-centric, but should be okay
} on any OS if the script uses a case statement.

Isn't this going to conflict with Completion/User/_init_d ?  Does _init_d
not work on Debian?

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com

Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net   


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: PATCH: completion for SysV initscripts
  2001-03-18 17:57 ` Bart Schaefer
@ 2001-03-18 19:49   ` Clint Adams
  0 siblings, 0 replies; 3+ messages in thread
From: Clint Adams @ 2001-03-18 19:49 UTC (permalink / raw)
  To: Bart Schaefer; +Cc: zsh-workers

> Isn't this going to conflict with Completion/User/_init_d ?  Does _init_d
> not work on Debian?

Ugh.  I appear to have completely missed that thread.  I'll
remove the new stuff.

This incorporates rcS.d, and force-re{load,start} possibilities.
Debian policy mandates `start', `stop', `restart', and `force-reload'.
`reload' is optional, and, of course, you'll find other arguments
in various scripts.

I guess the easiest thing would be to have a style setting for
when the file can't be parsed (defaulting to start,stop).

Index: Completion/User/_init_d
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/User/_init_d,v
retrieving revision 1.2
diff -u -r1.2 _init_d
--- Completion/User/_init_d	2001/03/08 10:17:04	1.2
+++ Completion/User/_init_d	2001/03/18 19:37:40
@@ -1,4 +1,4 @@
-#compdef -P */(init|rc[0-9]#).d/*
+#compdef -P */(init|rc[0-9S]#).d/*
 
 local magic cmds what
 
@@ -7,7 +7,7 @@
 # If the file starts with `#!' we hope that this is a shell script
 # and get lines looking like <space>foo|bar) with the words in $what.
 
-what='(st(art|op|atus)|re(start|load)|debug_(up|down)|dump(|_stats)|add|delete|clean|list)'
+what='(st(art|op|atus)|(force-|)re(start|load)|debug_(up|down)|dump(|_stats)|add|delete|clean|list)'
 
 read -u0k 2 magic < $words[1] && [[ $magic = '#!' ]] &&
     cmds=( ${${(j:|:s:|:)${(M)${(f)"$(< $words[1])"}:#[[:blank:]]#(\'|)${~what}(|${~what})#(\'|)\)}}//[^a-z_]} )


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2001-03-18 19:49 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-03-18 14:15 PATCH: completion for SysV initscripts Clint Adams
2001-03-18 17:57 ` Bart Schaefer
2001-03-18 19:49   ` Clint Adams

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).