From: Roman Neuhauser <neuhauser@sigpipe.cz>
To: Oliver Kiddle <okiddle@yahoo.co.uk>
Cc: zsh-users@zsh.org
Subject: Re: completion implementation woes
Date: Sun, 2 Oct 2016 19:43:20 +0200 [thread overview]
Message-ID: <20161002174320.GV49062@isis.sigpipe.cz> (raw)
In-Reply-To: <14379.1475371914@hydra.kiddle.eu>
# okiddle@yahoo.co.uk / 2016-10-02 03:31:54 +0200:
> 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.
why does '*::' pop $words?
> 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 (- :)
is there any chance to get the - thing working with chained _arguments
calls? this seems to be the least-clutter notation...
in fact, i'd love to get as close to a grammatic pov as possible,
and the more faithful the representation the better. eg. activate
does not take any operands, so the '*::option or operand:..' rule
rubs me the really wrong way.
_git-dirs = "git" gitopt* "dirs" op
op = help
| cmd
help = "-h" | "--help"
cmd = activate
| active
| clone
| init
| list
activate = "activate" repo
active = "active" o_path?
list = "list" o_path?
clone = "clone" o_N? url repo
init = "init" o_N? repo
o_path = o_f | o_r | o_s
o_N = "-N" | "--no-activate"
o_f = "-f" | "--full"
o_r = "-r" | "--relative"
o_s = "-s" | "--short"
--
roman
prev parent reply other threads:[~2016-10-02 17:43 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
2016-10-02 17:43 ` Roman Neuhauser [this message]
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=20161002174320.GV49062@isis.sigpipe.cz \
--to=neuhauser@sigpipe.cz \
--cc=okiddle@yahoo.co.uk \
--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).