* PATCH: _init_d: handle spaces between words and pipe
@ 2007-10-06 12:33 arno
0 siblings, 0 replies; only message in thread
From: arno @ 2007-10-06 12:33 UTC (permalink / raw)
To: zsh-workers
[-- Attachment #1: Type: text/plain, Size: 1185 bytes --]
Hi,
_init_d completion parse init scripts to detect "case" pattern.
It does not work when there are several cases, and spaces between words and pipe
separator.
for example, in my /etc/init.d/apache2 file, there is
reload | force-reload)
reload and force-reload are not part of completion suggestion
If I modify that line to
reload|force-reload)
it works fine: reload and force-reload become part of completion suggestions.
Here is a patch that seems to fix the problem
arno.
--- _init_d.old 2007-10-04 17:33:45.000000000 +0200
+++ _init_d 2007-10-06 13:52:52.000000000 +0200
@@ -15,7 +15,7 @@
what='(st(art|op|atus)|(force-|)re(start|load)|debug_(up|down)|dump(|_stats)|add|delete|clean|list)'
read -u0 -k2 magic < $script && [[ $magic = '#!' ]] &&
- cmds=( ${${(j:|:s:|:)${(M)${(f)"$(< $script)"}:#[[:blank:]]#(\'|)${~what}(\|${~what})#(\'|)\)}}//[^-a-z_]} )
+ cmds=( ${${(j:|:s:|:)${(M)${(f)"$(< $script)"}:#[[:blank:]]#(\'|)${~what}([[:blank:]]#\|[[:blank:]]#${~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...
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2007-10-06 12:33 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-10-06 12:33 PATCH: _init_d: handle spaces between words and pipe arno
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).