Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
PATCH: _init_d completion fixes
- X-seq: zsh-workers 16514
- From: Clint Adams <clint@xxxxxxx>
- To: zsh-workers@xxxxxxxxxx
- Subject: PATCH: _init_d completion fixes
- Date: Tue, 29 Jan 2002 22:33:43 -0500
- Mailing-list: contact zsh-workers-help@xxxxxxxxxx; run by ezmlm
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