Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: [PATCH] new completion for "sv"
- X-seq: zsh-workers 33377
- From: Oliver Kiddle <okiddle@xxxxxxxxxxx>
- To: fREW Schmidt <frioux@xxxxxxxxx>
- Subject: Re: [PATCH] new completion for "sv"
- Date: Tue, 07 Oct 2014 17:28:52 +0200
- Cc: zsh-workers@xxxxxxx
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.co.uk; s=s1024; t=1412695733; bh=inKTQ8Wvmmful7uE7ZJSjxHuhDB5eBhJZbrb5/FevIU=; h=X-Yahoo-Newman-Id:X-Yahoo-Newman-Property:X-YMail-OSG:X-Yahoo-SMTP:Received:cc:In-reply-to:From:References:To:Subject:MIME-Version:Content-Type:Content-ID:Date:Message-ID; b=vbfr/lXF7wkzlOPybgTFlVKZu/Tvj3k6ZUSER82P2js+mMQ6sNcmTzPE0e7rw7bO9Gqb5JVwlx3j14ikFb3WfnCc7BDegERjmN79e8K3EtKhz+Gh+/+INSgwgbT/2OTDOUCbfnTHAsBN55T2a3tPUPj8Zq0tEKxUPsYXwrZrO9Y=
- In-reply-to: <20141007132025.GA6252@gae-bulg.lan.mitsi.com>
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <20141005200135.GD58824@wanderlust.lan.mitsi.com> <5624.1412624240@quattro> <20141007132025.GA6252@gae-bulg.lan.mitsi.com>
fREW Schmidt wrote:
> Ok, I think I did this right this time.
Looks good.
> ok, I switched it to use _alternative and 3 functions as seems to be
> somewhat common in other compltion scripts in the codebase.
At least based on the documentation, _alternative is supposed to take
_arguments like specifications. Apparently it works with a list of
functions as you have done. An example would be:
_alternative \
'additional-commands:additional command:((check\:check\ status\ of\ service))' \
'lsb-commands: : _describe -t lsb-commands "LSB command" sv_lsb_ary' \
'sv-commands:sv command:_sv_commands'
> This raises an interesting question. I did what you said, but as
> Christian Neukirchen pointed out, on his system the default SVDIR is
> /var/service, and on ubuntu the default is /etc/service. I guess it's
> up to the packager to tweak the script or something?
I guess it could try to find out what distribution you have by checking
for release files in /etc and choosing a suitable default accordingly.
> Additionally, I like Christian Neukirchen's single-character shortcut
> completion. For majority of the commands they work already since
> nothing else starts with that letter, but s and c both have multiple
> options. If I understood what I was doing more I'd take his idea, but
> I don't.
I'm not sure that I do like it because it is a departure from the way
completion normally works: "s" will complete to status but not
start or stop while "st" will offer all three. It is possible to
configure this using tag-order and ignored-patterns styles.
> Completion/Unix/Command/_sv | 73 +++++++++++++++++++++++++++++++++++++++++++++
One thing I forgot to mention is that it should be named _runit:
functions are normally named after the software rather than the command,
e.g. _subversion for svn.
Oliver
Messages sorted by:
Reverse Date,
Date,
Thread,
Author