Zsh Mailing List Archive
Messages sorted by:
Re: Setting state in _arguments
- X-seq: zsh-users 17571
- From: Oliver Kiddle <okiddle@xxxxxxxxxxx>
- To: Jesper Nygårds <jesper.nygards@xxxxxxxxx>
- Subject: Re: Setting state in _arguments
- Date: Wed, 16 Jan 2013 14:43:26 +0100
- Cc: zsh-users@xxxxxxx
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.co.uk; s=s1024; t=1358343807; bh=vC09LG7iGdfZpA/JKaOVps8Pg7K38AmpES13BnqavqY=; h=X-Yahoo-Newman-Id:X-Yahoo-Newman-Property:X-YMail-OSG:X-Yahoo-SMTP:Received:Received:cc:In-reply-to:From:References:To:Subject:Date:Message-ID; b=aAoDsQwVzvZkhtx15JHiXiWf89MGwT3SXxP3NsS9ljvouuxTeF14qg3gy3DAZZcHpZwMkk0mPjD+NsSl/mYKfUwFzfr6SOU1qNOILDgVgcpUNhG/LUkXgTE+N4qeqwD7NY86wF6fA//j57J0tHZIX3xnjASTDgQIGGScA84CCcg=
- In-reply-to: <CABZhJg-ph80A7ZWAGH+ss4eoBoZz_f3OaGkxkEyf7-znNi=4Dw@mail.gmail.com>
- List-help: <mailto:firstname.lastname@example.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:email@example.com>
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
- References: <CABZhJg-ph80A7ZWAGH+ss4eoBoZz_f3OaGkxkEyf7-znNi=4Dw@mail.gmail.com>
> 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 "--".
Messages sorted by: