zsh-workers
 help / color / mirror / code / Atom feed
* PATCH: _init_d completion fixes
@ 2002-01-30  3:33 Clint Adams
  0 siblings, 0 replies; only message in thread
From: Clint Adams @ 2002-01-30  3:33 UTC (permalink / raw)
  To: zsh-workers

This gets rid of pesky error mesages if the initscript doesn't exist.
Also, it matches lines resembling "  restart|force-reload) ".
Finally, it doesn't remove hyphens from, f.ex, "force-reload".

Index: Completion/Unix/Command/_init_d
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Unix/Command/_init_d,v
retrieving revision 1.1
diff -u -r1.1 _init_d
--- Completion/Unix/Command/_init_d	2001/04/02 11:53:59	1.1
+++ Completion/Unix/Command/_init_d	2002/01/30 03:22:55
@@ -9,8 +9,8 @@
 
 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_]} )
+[[ -f $words[1] ]] && read -u0k 2 magic < $words[1] && [[ $magic = '#!' ]] &&
+    cmds=( ${${(j:|:s:|:)${(M)${(f)"$(< $words[1])"}:#[[:blank:]]#\'#${~what}(\|${~what})#\'#\)*}}//[^a-z_-]} )
 
 # This would be the pattern to use every line of the form <space>foo).
 # Some people say this might match too many lines...


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2002-01-30  4:45 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-01-30  3:33 PATCH: _init_d completion fixes 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).