From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14920 invoked by alias); 13 May 2016 12:09:42 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: X-Seq: 21560 Received: (qmail 7835 invoked from network); 13 May 2016 12:09:40 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=BAYES_00,FREEMAIL_FROM, MALFORMED_FREEMAIL,T_DKIM_INVALID autolearn=no autolearn_force=no version=3.4.1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.co.uk; s=s2048; t=1463140959; bh=COwIwKHCCuYBtLrmM4L4HKcheZoy3R380hX7jgoOyko=; h=cc:In-reply-to:From:References:To:Subject:Date:From:Subject; b=YvxKjMoea8O6CQJcw46nCaLAcclU1DJ4HKtOMx8UtLc/eC96oB1om3dLMUtgWOy8+igTnx1j58smnMrnMB1c1Bsiw59dnI+t3Gx/jWk8NmAWZAjpNSrm66KBXTm5muftV4zv920IPHBz6KcvQlsFCI8W7xprw/ul6oPFN2l7q4rT+EZwhPIpZdP5ICwENphwB4BLkYAjCxuGy/cUX2+3ME+EoAgPYJzlVcQdCn2kFngqdWXHgEzCTria20RgSQsJvxdFt2JqoyJ4/Ea3vOnfjbeeKxmyOi6Tl5i7lMWMUeeXiwXVMOmQSr7Hg6zxQiGo+lolkRLXkVB7YVz5OG9rTg== X-Yahoo-Newman-Id: 591360.89475.bm@smtp115.mail.ir2.yahoo.com X-Yahoo-Newman-Property: ymail-3 X-YMail-OSG: MeCNoX4VM1k3UOVDkUFzjgipNsDMKcPho_HNBz08fKMlQIj mykREzTPJT4Ex6Y4hO5INx6BS7RkKQ0sqqsBNdB4h0NjQCzxCpg55HJG2IEd Q6PxbmNQ2Hprlji6ryuzXQWBfysZ1NG7JRVUynvtmdNSTU.N4dCwX0KrUe6k qbDPa0sxntFPT7ha5Ualv9WkGCtKIj6GLqOpqcGhqOSJ_JYnxJ3e3syboQ2x YWvI5Yffyy6tZ7RCAIowWKjl_vf6SSiZWLW_ZC13tN3ihqUl4dbbr5ouQ.9a 6MCIjiY30mEGmjJL.C0mVuf.PtR9j.jw_XsNiIdSwxzMhxKlwZ9HlnlBvnv4 uhkKvVERnb9.Vtsjtoi3uDYa8CbXjr81JqGdAlw_cL_B17E8ykAJ.M.rA_93 Bk1rU4A6KYYfcSaaPxHWcP4QHPUiu0Pku2x2GM6GNZYELZUTORW8evp7.L_O ZImmvuPy7.pyzvjtDC6CVkRSUOuuMTaLZqTrXVy1d0mvbqVKAy1G9uNlkZZC DdFOqlcuqzEN7b9V8Lmx_GreCuVW3ng-- X-Yahoo-SMTP: opAkk_CswBAce_kJ3nIPlH80cJI- cc: zsh-users@zsh.org In-reply-to: From: Oliver Kiddle References: To: Jordan Klassen Subject: Re: git-subtree completions MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <27620.1463140958.1@thecus.kiddle.eu> Date: Fri, 13 May 2016 14:02:38 +0200 Message-ID: <27621.1463140958@thecus.kiddle.eu> Jordan Klassen wrote: > How do I fix my `THIS_IS_A_HACK` issue? Use -A "-*" and change this line: '*:: :->option-or-argument' && ret=0 to: '*::: := ->option-or-argument' && ret=0 > And code review in general. Otherwise, it looks good. I'd suggest using _default instead of _nothing for an unknown subcommand. _nothing might be more accurate at the moment but falling back to default completion is better if a new subcommand is added to git-subtree and the completion isn't updated. I'm aware that the same comment could apply elsewhere in _git. The descriptions for subcommands also could do with adjusting. References to things like and make less sense in the absense of the rest of the help information these have been copied from. Coming back to the THIS_IS_A_HACK issue, I think there is arguably a bug in _arguments. The documentation states that with two colons, "the words special array and the CURRENT special parameter are modified to refer only to the normal arguments". I would expect the command to be a "normal argument" in this context but -P coming after it appears to affect this. For: git subtree add we get words=( add '' ) CURRENT=2 For: git subtree add -P we get words=( '' ) CURRENT=1 _arguments in the option-or-argument state needs words=( anything '' ) CURRENT=2 Arguably, the -P is covered by the *: action and should be included too. The relevant code for this is the following two lines in computil.c: if ((restr = (arg->type == CAA_RARGS))) restrict_range(ca_laststate.optbeg, ca_laststate.argend); restrict_range appears to restrict the range based on a start and end index so is not equipped to remove options interspersed with normal arguments. So my question for -workers folks is how do we make sense of struct castate to correct this? I think we need something like ca_laststate.args along with compwords from ca_laststate.argbeg onwards. Oliver