zsh-workers
 help / color / mirror / code / Atom feed
From: arno <arenevier@fdn.fr>
To: zsh-workers@sunsite.dk
Subject: PATCH: _init_d: handle spaces between words and pipe
Date: Sat, 6 Oct 2007 14:33:27 +0200	[thread overview]
Message-ID: <20071006123327.GA9926@localhost.localdomain> (raw)

[-- 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 --]

                 reply	other threads:[~2007-10-06 12:33 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20071006123327.GA9926@localhost.localdomain \
    --to=arenevier@fdn.fr \
    --cc=zsh-workers@sunsite.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).