zsh-workers
 help / color / mirror / code / Atom feed
From: Oliver Kiddle <okiddle@yahoo.co.uk>
To: fREW Schmidt <frioux@gmail.com>
Cc: zsh-workers@zsh.org
Subject: Re: [PATCH] new completion for "sv"
Date: Tue, 07 Oct 2014 17:28:52 +0200	[thread overview]
Message-ID: <26747.1412695732@thecus.kiddle.eu> (raw)
In-Reply-To: <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


  reply	other threads:[~2014-10-07 15:35 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-05 20:01 fREW Schmidt
2014-10-05 20:04 ` fREW Schmidt
2014-10-06  9:54   ` Christian Neukirchen
2014-10-06 19:37 ` Oliver Kiddle
2014-10-07 13:20   ` fREW Schmidt
2014-10-07 15:28     ` Oliver Kiddle [this message]
2014-10-07 16:03       ` fREW Schmidt

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=26747.1412695732@thecus.kiddle.eu \
    --to=okiddle@yahoo.co.uk \
    --cc=frioux@gmail.com \
    --cc=zsh-workers@zsh.org \
    /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).