From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13669 invoked by alias); 2 Oct 2016 01:39:08 -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: 21998 Received: (qmail 20210 invoked from network); 2 Oct 2016 01:39:08 -0000 X-Qmail-Scanner-Diagnostics: from nm18-vm7.bullet.mail.ir2.yahoo.com by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.99.2/21882. spamassassin: 3.4.1. Clear:RC:0(212.82.96.231):SA:0(0.0/5.0):. Processed in 0.308733 secs); 02 Oct 2016 01:39:08 -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.0 required=5.0 tests=FREEMAIL_FROM,SPF_PASS, T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.1 X-Envelope-From: okiddle@yahoo.co.uk X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | Received-SPF: pass (ns1.primenet.com.au: SPF record at _spf.mail.yahoo.com designates 212.82.96.231 as permitted sender) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.co.uk; s=s2048; t=1475371915; bh=EXlVdb6Fn9omwpAKlgzCKiaSuKwjpwvjhVmcI3eHR6E=; h=cc:In-reply-to:From:References:To:Subject:Date:From:Subject; b=qF17OMC8K7PAIdw3Kng6+L8zBTnWi7LujeFFAkIbAXT7U/+h1cKFsygbeNjBwl9ar/UIyuEp9jEVaxtb4AdnKgprvce8V5CSFGU8r5/GixYYShDicFm16f81nfLabsRNsYm27QVQo2hmZd2u4gznlBl4i/MgIowK7ubpul1u4IQWiEKu0al1eQvyM3PZfVJRuln9J9FR/Dohs7oquKBy7d+8swkAMrlLudRoHLZ2IP1+dqjsxcSos/me9asKliwMQl2ekRL4Z0+cr0idT7v1TlFSNvtvGmRG4NYERD4rzbYkLMqy/F2e8wQ8PT5KkTvzd2LVfWYUYj0N+M0vGrNR7Q== X-Yahoo-Newman-Id: 684120.50459.bm@smtp138.mail.ir2.yahoo.com X-Yahoo-Newman-Property: ymail-3 X-YMail-OSG: EG4Dr28VM1niMvVOdcwZYU_wGmQ0VJa0HoZZKhpBo05xSaV 2X9uHrAubUBprWKWV0luakShTuXryeQ4eKl.smw6VuKSrldNYbr1Vu9Oo3Dp wmpiTcOhzPfQFJjs.G_YUqQRAfgUiyE3mI1wYFZRGIMEG1LCeLMzZzWcNOZX Z53Xe.zTTLLsxgjcvBLwUXvjf57p3op2gEJHVUtLa5Xrq2jgumjUehMHPjxg cdn7IaCERM3j39nJkn_yjpvxYtXpRvM0i7u8XE.YNStJyughCkjx91ATEcKm uPFajB_5Th3baFOaSA8T7ra0_TDixy08zE0XFft6yOb7mFWktmG6qWEzPByb igP4526HSKgKKl53A1ShwCyjerSxw92dbm6uvgsqdtgPu72Yz2uzGX_bNSRk qT1XuAjQxK4Yu66mZmmG2RwUtzmUt4uCXV1ewsaCzNC37GHZPAIgTWLGGnRF krcXfqIxy8DwRLvW5bXoDZhW5h8HM44smfiZ6OxZn_3aYWtxIpYXTnpKPHuW RcDJTOEWIbZMEtmclh.i97x66z4DTcm7_Lyc_Tp72bNk- X-Yahoo-SMTP: opAkk_CswBAce_kJ3nIPlH80cJI- cc: zsh-users@zsh.org In-reply-to: <20161002001931.GA686081@isis.sigpipe.cz> From: Oliver Kiddle References: <20161002001931.GA686081@isis.sigpipe.cz> To: Roman Neuhauser Subject: Re: completion implementation woes MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <14378.1475371914.1@hydra.kiddle.eu> Date: Sun, 02 Oct 2016 03:31:54 +0200 Message-ID: <14379.1475371914@hydra.kiddle.eu> Roman Neuhauser wrote: > i have difficult time with completion for a git subcommand i wrote, > and would appreciate a little help. > _git-dirs-_args \ > - '(help)' \ > '-h[display usage]' \ > '--help[display man page]' \ > - 'command' \ > ":command:_git-dirs-_verb" \ > "*:option or operand:_git-dirs-_verb-arg" You'll find it solves quite a few of your issues if you change this to the two colon form: "*::option or operand:_git-dirs-_verb-arg" When handling subcommands, it is important to drop initial arguments from the beginning of $words to avoid confusing later calls to _arguments. If $words contains ( git dirs init ), _arguments sees a command and two arguments. That's what _arguments called from _git wants but not good from _git_dirs-init. Getting rid of the sets in _git-dirs fixes completion after git dirs init -N. Somehow it isn't getting past the first _arguments. --help style options can usually just be given an exclusion list of (- :) Oliver