zsh-users
 help / color / mirror / code / Atom feed
From: Oliver Kiddle <okiddle@yahoo.co.uk>
To: Roman Neuhauser <neuhauser@sigpipe.cz>
Cc: zsh-users@zsh.org
Subject: Re: completion implementation woes
Date: Sun, 02 Oct 2016 03:31:54 +0200	[thread overview]
Message-ID: <14379.1475371914@hydra.kiddle.eu> (raw)
In-Reply-To: <20161002001931.GA686081@isis.sigpipe.cz>

Roman Neuhauser wrote:
> i have difficult time with completion for a git subcommand i wrote,
> and would appreciate a little help.

>     _git-dirs-_args \
>       - '(help)' \
>         '-h[display usage]' \
>         '--help[display man page]' \
>       - 'command' \
>         ":command:_git-dirs-_verb" \
>         "*:option or operand:_git-dirs-_verb-arg"

You'll find it solves quite a few of your issues if you change this to
the two colon form:

      "*::option or operand:_git-dirs-_verb-arg"

When handling subcommands, it is important to drop initial arguments
from the beginning of $words to avoid confusing later calls to
_arguments. If $words contains ( git dirs init ), _arguments sees a
command and two arguments. That's what _arguments called from _git
wants but not good from _git_dirs-init.

Getting rid of the sets in _git-dirs fixes completion after git
dirs init -N. Somehow it isn't getting past the first _arguments. --help
style options can usually just be given an exclusion list of (- :)

Oliver


  reply	other threads:[~2016-10-02  1:39 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-02  0:19 Roman Neuhauser
2016-10-02  1:31 ` Oliver Kiddle [this message]
2016-10-02 17:43   ` Roman Neuhauser

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=14379.1475371914@hydra.kiddle.eu \
    --to=okiddle@yahoo.co.uk \
    --cc=neuhauser@sigpipe.cz \
    --cc=zsh-users@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).