From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13434 invoked by alias); 6 Oct 2014 19:43:38 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 33373 Received: (qmail 28387 invoked from network); 6 Oct 2014 19:43:36 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.2 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.co.uk; s=s1024; t=1412624242; bh=Zj90uPEBfpVw6wI1IADtmEV6NMVyAkagMVZWDGohFw4=; h=X-Yahoo-Newman-Id:X-Yahoo-Newman-Property:X-YMail-OSG:X-Yahoo-SMTP:Received:Received:cc:In-reply-to:From:References:To:Subject:MIME-Version:Content-Type:Content-ID:Date:Message-ID; b=CtiieX5B1uwHztP6PnTI8J7JqOMmOxNQf4NPRdmmR7Y9q3B/ABQT6lj0DN+9sHleveiYK+aiIirlRNmSVWWIzZeaLBNfKhpZ8hvn5nhLC6zq6VHVIfMWZzvjdoSR6dFIqIkoGiIvVi/2GcAHPDc0zc3Uf7of10E7KpvNOOwIkVw= X-Yahoo-Newman-Id: 51890.33229.bm@smtp146.mail.ir2.yahoo.com X-Yahoo-Newman-Property: ymail-3 X-YMail-OSG: tylLBnoVM1nBPmoqaBxAPiCOUOuS98hcNOjU4GRkTRvmHd1 bDIlb7fK0DU8ru_XTxfCylxLy5XHrDqwpFhryM_tMeb9zqnuTyfZacfnsEm3 TUO7iFj0Nsa6Qmj8b9DMNoNGBMXDu0Q_x9nQ.fM07QLF.chG.O2FxgXieFN_ fJeyi_jTFjvF3QphYBF2AwqGbLmSpqUuC2G3LSlYhrrpldyKNulfXEGsT4Fz EWrWuESVy9M6TmUvelT_E.79YKXupXh9v4lmaBDiKlr9dj_n4LJ86UziKNc9 HOFBaWVy2qmluI9oxndtRl985Zfw___1YiUs2nVKVCQ9YLI9QXrIpNOH4wfF nLnL3pqokjk2FJeFi21MlayWy.x7jy.6TvZfLfsznPvzMCo9jSNfRFOJX4b8 uDcTswnf6WIaCU6KDSmjqvdK1y0DNIDbQhEpafjWEWCL7gQfGu8iZ7Y.e7J6 AYEvAtL0_3q.rISwuAO9HgS9qbvudztaJHMb1okvMVen9Ymz9ST6UGQSqSRt NNlNVedTtCthh.MC8EF.j1kEnCFE- X-Yahoo-SMTP: opAkk_CswBAce_kJ3nIPlH80cJI- cc: zsh-workers@zsh.org In-reply-to: <20141005200135.GD58824@wanderlust.lan.mitsi.com> From: Oliver Kiddle References: <20141005200135.GD58824@wanderlust.lan.mitsi.com> To: fREW Schmidt Subject: Re: [PATCH] new completion for "sv" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <5623.1412624240.1@quattro> Date: Mon, 06 Oct 2014 21:37:20 +0200 Message-ID: <5624.1412624240@quattro> fREW Schmidt wrote: > > If anything is wrong just let me know, this would be my first > contribution to zsh so mistakes wouldn't surprise me. I've got a few comments. > +#compdef sv > + > +_arguments \ > + '-v[verbose]' \ > + '-w:wait time' \ What's the units for the time? How about something like: '-w[specify wait time]:time (seconds)' > + ':command:->command' \ > + '*::options:->options' If you use states with _arguments, you should declare a few array variables local: context, state and line. You then need to take care to make use of the context variable when calling other functions. In most cases, including the one above, only one state is possible at a time. So in this case, you should declare: local curcontext="$curcontext" state line and pass the -C option to _arguments. > + sv_ary=( > + 'status':'Get status of service (and log service if available)' The usual convention, which you have done elsewhere, is to start descriptions with a lowercase letter. > + _describe -t commands "sv commands" sv_ary -V sv_commands > + _describe -t commands "sv LSM init compat" sv_lsb_ary -V sv_init_compat > + _describe -t commands "sv additional commands" '("check:check status of service")' -V sv_addl_comm > + return This is ignoring the return status of the first two calls to _describe. The return value of a completion function determines whether the completion system carries on trying to find more matches, perhaps approximate matching if you have that configured. It's common to use a variable named ret for the return status: look for some examples. Perhaps also consider using three different tags for the matches and using _alternative or _tags with a loop. > + $SVDIR/*(N) Is SVDIR really always set or is there a default value that it could fall back on, e.g: ${SVDIR:-/service} Oliver