zsh-users
 help / color / mirror / code / Atom feed
From: Oliver Kiddle <okiddle@yahoo.co.uk>
To: "Jesper Nygårds" <jesper.nygards@gmail.com>
Cc: zsh-users@zsh.org
Subject: Re: Setting state in _arguments
Date: Wed, 16 Jan 2013 14:43:26 +0100	[thread overview]
Message-ID: <20477.1358343806@thecus.kiddle.eu> (raw)
In-Reply-To: <CABZhJg-ph80A7ZWAGH+ss4eoBoZz_f3OaGkxkEyf7-znNi=4Dw@mail.gmail.com>

=?ISO-8859-1?Q?Jesper_Nyg=E5rds?= wrote:
> On the command line, I write: "myfoo --<tab>", and the completion kicks in
> and gives me the options "--option1" and "--option2", which is what I
> expected. However, on /dev/pty2 I see "state: subcommand", which I did NOT
> expect. I would have thought that since only "--option1" or "--option2"
> could possibly match after "--", state would not have been set*, *but it is.

_arguments has no way of knowing that subcommands can't begin with "--"
so while it adds the completion matches for the options, it also
considers the *:... rule to be applicable.

> The trouble with this is that in the gradle completion, the possible
> subcommands are generated inside the if statement in this case, and thatis
> time consuming. I would thus like to avoid going into it when the "--" on
> the command line indicates that an option should be completed.

You can perform some explicit tests before starting the time consuming
operation, perhaps test whether the current word starts with "--".

Oliver


  reply	other threads:[~2013-01-16 13:49 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-16  9:47 Jesper Nygårds
2013-01-16 13:43 ` Oliver Kiddle [this message]
2013-01-17  6:39   ` Jesper Nygårds

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=20477.1358343806@thecus.kiddle.eu \
    --to=okiddle@yahoo.co.uk \
    --cc=jesper.nygards@gmail.com \
    --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).