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: Mon, 06 Oct 2014 21:37:20 +0200	[thread overview]
Message-ID: <5624.1412624240@quattro> (raw)
In-Reply-To: <20141005200135.GD58824@wanderlust.lan.mitsi.com>

fREW Schmidt wrote:
> 
> If anything is wrong just let me know, this would be my first
> contribution to zsh so mistakes wouldn't surprise me.

I've got a few comments.

> +#compdef sv
> +
> +_arguments \
> +  '-v[verbose]' \
> +  '-w:wait time' \

What's the units for the time? How about something like:
  '-w[specify wait time]:time (seconds)'

> +  ':command:->command' \
> +  '*::options:->options'

If you use states with _arguments, you should declare a few array
variables local: context, state and line. You then need to take care to
make use of the context variable when calling other functions. In most
cases, including the one above, only one state is possible at a time. So
in this case, you should declare:
  local curcontext="$curcontext" state line
and pass the -C option to _arguments.

> +    sv_ary=(
> +           'status':'Get status of service (and log service if available)'

The usual convention, which you have done elsewhere, is to start
descriptions with a lowercase letter.

> +      _describe -t commands "sv commands" sv_ary -V sv_commands
> +      _describe -t commands "sv LSM init compat" sv_lsb_ary -V sv_init_compat
> +      _describe -t commands "sv additional commands" '("check:check status of service")' -V sv_addl_comm
> +      return

This is ignoring the return status of the first two calls to _describe.
The return value of a completion function determines whether the
completion system carries on trying to find more matches, perhaps
approximate matching if you have that configured. It's common to use a
variable named ret for the return status: look for some examples.

Perhaps also consider using three different tags for the matches and using
_alternative or _tags with a loop.

> +      $SVDIR/*(N)

Is SVDIR really always set or is there a default value that it could
fall back on, e.g: ${SVDIR:-/service}

Oliver


  parent reply	other threads:[~2014-10-06 19:43 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 [this message]
2014-10-07 13:20   ` fREW Schmidt
2014-10-07 15:28     ` Oliver Kiddle
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=5624.1412624240@quattro \
    --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).