From: Oliver Kiddle <okiddle@yahoo.co.uk>
To: Jordan Klassen <jordan@klassen.me.uk>
Cc: zsh-users@zsh.org
Subject: Re: git-subtree completions
Date: Fri, 13 May 2016 14:02:38 +0200 [thread overview]
Message-ID: <27621.1463140958@thecus.kiddle.eu> (raw)
In-Reply-To: <CAEsdBDkYMG6fopG9uAxXPZuDoOu5iW1QBBwM1r1-BCZ-iEtEpw@mail.gmail.com>
Jordan Klassen wrote:
> How do I fix my `THIS_IS_A_HACK` issue?
Use -A "-*" and change this line:
'*:: :->option-or-argument' && ret=0
to:
'*::: := ->option-or-argument' && ret=0
> And code review in general.
Otherwise, it looks good. I'd suggest using _default instead of _nothing
for an unknown subcommand. _nothing might be more accurate at the moment
but falling back to default completion is better if a new subcommand is
added to git-subtree and the completion isn't updated. I'm aware that
the same comment could apply elsewhere in _git.
The descriptions for subcommands also could do with adjusting.
References to things like <commit> and <repository> make less sense in
the absense of the rest of the help information these have been copied
from.
Coming back to the THIS_IS_A_HACK issue, I think there is arguably a bug
in _arguments. The documentation states that with two
colons, "the words special array and the CURRENT special parameter are
modified to refer only to the normal arguments". I would expect the
command to be a "normal argument" in this context but -P coming after it
appears to affect this.
For: git subtree add <tab> we get words=( add '' ) CURRENT=2
For: git subtree add -P <tab> we get words=( '' ) CURRENT=1
_arguments in the option-or-argument state needs
words=( anything '' ) CURRENT=2
Arguably, the -P is covered by the *: action and should be included too.
The relevant code for this is the following two lines in computil.c:
if ((restr = (arg->type == CAA_RARGS)))
restrict_range(ca_laststate.optbeg, ca_laststate.argend);
restrict_range appears to restrict the range based on a start and end
index so is not equipped to remove options interspersed with normal
arguments. So my question for -workers folks is how do we make sense of
struct castate to correct this? I think we need something like
ca_laststate.args along with compwords from ca_laststate.argbeg onwards.
Oliver
next prev parent reply other threads:[~2016-05-13 12:09 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-05-12 5:57 Jordan Klassen
2016-05-13 9:39 ` Bart Schaefer
2016-05-13 12:02 ` Oliver Kiddle [this message]
[not found] ` <27621.1463140958__28965.9567446963$1463141465$gmane$org@thecus.kiddle.eu>
2016-07-07 2:00 ` Daniel Shahaf
2016-07-13 4:24 ` Daniel Shahaf
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=27621.1463140958@thecus.kiddle.eu \
--to=okiddle@yahoo.co.uk \
--cc=jordan@klassen.me.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).