Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: [(I)-foo] subscripting in _git
- X-seq: zsh-workers 29575
- From: Mikael Magnusson <mikachu@xxxxxxxxx>
- To: Nikolai Weibull <now@xxxxxxxx>
- Subject: Re: [(I)-foo] subscripting in _git
- Date: Thu, 21 Jul 2011 13:29:37 +0200
- Cc: zsh workers <zsh-workers@xxxxxxx>
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; bh=ph5/x0BQZPJDiat/b8dpSWqlv2VQ22RDpqqH39RVnhM=; b=gPt4TnrFRQILp9orfadIGpv+7t2/Wh5ACk1czfaJwaJgNkB8f61ga/wd/i9tVhUK2h 8r+op51/Df2+h6kuKngWklR4cnCXFRJ076DnnHPdqCZIRyv5Na+VUIyGmeLKPLrWjx/p DME6PupEoI91wfkIGUjLJEfC4w7moCXQbAHnI=
- In-reply-to: <CADdV=MtJcp380kG6T-fu0zfWWt=bxZZWrkqz=mY_BGFiHHw6mw@mail.gmail.com>
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <CAHYJk3SrWNf56jG0tgu0kbNwCqo6t0Ke2Pyaej=mzRPMbCZqgA@mail.gmail.com> <CADdV=MtJcp380kG6T-fu0zfWWt=bxZZWrkqz=mY_BGFiHHw6mw@mail.gmail.com>
On 21 July 2011 13:21, Nikolai Weibull <now@xxxxxxxx> wrote:
> On Thu, Jul 21, 2011 at 12:32, Mikael Magnusson <mikachu@xxxxxxxxx> wrote:
>> I noticed while looking at _git-add that _git does a lot of this type of thing:
>> if (( words[(I)-n|--dry-run] )); then
>> that particular example is fine, but further down is this
>> if [[ -n ${line[(I)-f|--force]} ]]; then
>> which seems to have two problems, first it uses line instead of words,
>> so it never matches.
>
> If you check out the latest revision, however, this has been fixed. I
> fixed it an hour or so ago. The correct pattern when checking for an
> option processed by _arguments is if [[ -n ${opt_args[(I)-o|--option]}
> ]]; then …; fi.
>
> There are, based on my checks, no other instances of the incorrect pattern.
You left out this part of my mail:
> Second it uses [[ -n ]] which will always be true as (I) returns a
> 0 when it didn't match.
The obvious part that I was missing is that opt_args is an associative
array, which changes the meaning of (I). :)
--
Mikael Magnusson
Messages sorted by:
Reverse Date,
Date,
Thread,
Author