Subject: Re: [PATCH 3/4] _git: log: ignore numeric options
From: Daniel Shahaf <[email-masked]>
To: m0viefreak <[email-masked]>
Cc: [email-masked]
Date: Wed, 16 Mar 2016 22:39:32 +0000
List-Id: Zsh Workers List <zsh-workers.zsh.org>

m0viefreak wrote on Wed, Mar 16, 2016 at 21:43:37 +0100:
> 
> 
> On 15.03.2016 01:08, Daniel Shahaf wrote:
> > I couldn't reproduce that: with current master, none of «git log
> > -<TAB>», «git log -9<TAB>», or «git log -9 -<TAB>» go through the
> > 'first-commit-ranges-or-files' code branch.
> > 
> > m0viefreak, if there is still a (possibly latent) bug in current master,
> > could you please explain/show it?
> 
> git log -9 <TAB>
> 
> should go through the 'first-commit-ranges-or-files' branch because at
> that position the first argument is expected.
> 
> Without this patch it goes through the 'commit-ranges-or-files' branch,
> because '-9' is wrongly treated as the first non-option argument:

I see that.

> This patch makes _arguments ignore any words of the form '-[0-9]#' to
> work around that.

Using '_arguments -A' breaks «git log origin -<TAB>», which is a valid
syntax.

How about adding 10 options, -0 through -9, which each take an optional
argument that must be in the same word?  That is:
.
    _arguments : '-'{0..9}'-[lorem ipsum]: :_guard "[0-9]#" "numeric value"'
.
?