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

PATCH: _init_d completion fixes



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...



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