Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Id: Zsh Workers List <zsh-workers.zsh.org>
List-Post: <mailto:zsh-workers@zsh.org>
List-Help: <mailto:zsh-workers-help@zsh.org>
X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on f.primenet.com.au
X-Spam-Level: 
X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham
	autolearn_force=no version=3.4.1
Date: Wed, 16 Mar 2016 22:39:32 +0000
From: Daniel Shahaf <d.s@daniel.shahaf.name>
To: m0viefreak <m0viefreak.cm@googlemail.com>
Cc: zsh-workers@zsh.org
Subject: Re: [PATCH 3/4] _git: log: ignore numeric options
Message-ID: <20160316223932.GA31897@tarsus.local2>
References: <1457906520-2612-1-git-send-email-m0viefreak.cm@googlemail.com>
 <1457906520-2612-4-git-send-email-m0viefreak.cm@googlemail.com>
 <20160315000837.GA29956@tarsus.local2>
 <56E9C579.70608@googlemail.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
Content-Transfer-Encoding: 8bit
In-Reply-To: <56E9C579.70608@googlemail.com>
User-Agent: Mutt/1.5.23 (2014-03-12)
X-Seq: zsh-workers 38165

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"'
.
?

