From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4110 invoked from network); 9 Sep 2005 10:53:49 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 9 Sep 2005 10:53:49 -0000 Received: (qmail 61592 invoked from network); 9 Sep 2005 10:53:43 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 9 Sep 2005 10:53:43 -0000 Received: (qmail 27274 invoked by alias); 9 Sep 2005 10:53:41 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 21712 Received: (qmail 27265 invoked from network); 9 Sep 2005 10:53:41 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by sunsite.dk with SMTP; 9 Sep 2005 10:53:41 -0000 Received: (qmail 61315 invoked from network); 9 Sep 2005 10:53:41 -0000 Received: from cluster-e.mailcontrol.com (HELO rly08e.srv.mailcontrol.com) (217.79.216.190) by a.mx.sunsite.dk with SMTP; 9 Sep 2005 10:53:31 -0000 Received: from iris.logica.co.uk (iris.logica.co.uk [158.234.9.163]) by rly08e.srv.mailcontrol.com (MailControl) with ESMTP id j89ArRra022569 for ; Fri, 9 Sep 2005 11:53:27 +0100 Received: from trentino.logica.co.uk ([158.234.142.59]) by iris.logica.co.uk (8.12.3/8.12.3/Debian -4) with ESMTP id j89ArRTp004455 for ; Fri, 9 Sep 2005 11:53:27 +0100 Received: from trentino.groupinfra.com (localhost [127.0.0.1]) by trentino.logica.co.uk (Postfix) with ESMTP id 110477F066 for ; Fri, 9 Sep 2005 12:53:27 +0200 (CEST) X-VirusChecked: Checked X-StarScan-Version: 5.0.7; banners=.,-,- In-reply-to: <20050907190129.GA9049@scowler.net> From: Oliver Kiddle References: <20050907190129.GA9049@scowler.net> To: zsh-workers@sunsite.dk Subject: Re: PATCH: _date revisited Date: Fri, 09 Sep 2005 12:53:27 +0200 Message-ID: <6061.1126263207@trentino.groupinfra.com> X-Scanned-By: MailControl A-05-01-05 (www.mailcontrol.com) X-Spam-Checker-Version: SpamAssassin 3.0.4 (2005-06-05) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.0.4 Clint Adams wrote: > Solaris 9 and FreeBSD 4.11. > > Index: Completion/Unix/Command/_date > =================================================================== > RCS file: /cvsroot/zsh/zsh/Completion/Unix/Command/_date,v > retrieving revision 1.1 > diff -u -r1.1 _date > --- Completion/Unix/Command/_date 3 Sep 2005 00:17:02 -0000 1.1 > +++ Completion/Unix/Command/_date 7 Sep 2005 19:00:28 -0000 > @@ -1,6 +1,7 @@ > #compdef date > > -_arguments \ > +if _pick_variant -r is_gnu gnu="Free Software Foundation" unix --version; then You don't need -r is_gnu unless you're wanting to save the result of _pick_variant. If used, you'd need to declare is_gnu local. It is also a good idea to include a fallback for functions that check $OSTYPE so that something is done on other systems. Following patch does a bit of reindenting, and rearranging. Oliver Index: Completion/Unix/Command/_date =================================================================== RCS file: /cvsroot/zsh/zsh/Completion/Unix/Command/_date,v retrieving revision 1.3 diff -u -r1.3 _date --- Completion/Unix/Command/_date 7 Sep 2005 19:12:53 -0000 1.3 +++ Completion/Unix/Command/_date 9 Sep 2005 10:49:41 -0000 @@ -1,48 +1,48 @@ #compdef date -if _pick_variant -r is_gnu gnu="Free Software Foundation" unix --version; then - _arguments \ - '-d[date]:time string:' \ - '-f[file]:date file:_files' \ - '-I[iso-8601]:time spec:' \ - '-r[reference]:file:_files' \ - '-R[rfc-2822]' \ - '-s[set]:time string:' \ - '-u[utc]' \ - -- \ - '*=FILE*:file:_files' \ - '*=DATEFILE*:date file:_files' \ - ':format or date:' +local -a args + +if _pick_variant gnu="Free Software Foundation" unix --version; then + args=( + '-d[output specified date]:time string' + '-f[output dates specified in file]:file:_files' + '-I-[iso-8601]:precision:(date hours minutes seconds)' + '-r[reference]:file:_files' + '-R[rfc-2822]' + '-s[set]:time string' + -- + '*=FILE*:file:_files' + '*=DATEFILE*:date file:_files' + ) else case "$OSTYPE" in - (solaris*) - _arguments \ - '-u[utc]' \ - '-a:adjustment:' \ - ':format or date:' - ;; - (freebsd*) - _arguments \ - '-u[utc]' \ - '-n[only set time on current machine]' \ - '-d:daylight savingg time value:' \ - '-j[do not try to set date]' \ - '-f:parsing format:' \ - '-r:seconds since epoch:' \ - '-t:minutes west of GMT:' \ - '-v:adjustment value:' \ - ':format or date:' - ;; - (openbsd*) - _arguments \ - '-u[utc]' \ - '-n[only set time on current machine]' \ - '-d:daylight savingg time value:' \ - '-a[gradually skew]' \ - '-r:seconds since epoch:' \ - '-t:minutes west of GMT:' \ - ':format or date:' - ;; + solaris*) + args=( '-a:adjustment' ) + ;; + freebsd*) + args=( + '-n[only set time on current machine]' + '-d:daylight saving time value' + '-j[do not try to set date]' + '-f:parsing format' + '-r:seconds since epoch' + '-t:minutes west of GMT' + '-v:adjustment value' + ) + ;; + openbsd*) + args=( + '-n[only set time on current machine]' + '-d:daylight saving time value' + '-a[gradually skew]' + '-r:seconds since epoch' + '-t:minutes west of GMT' + ) + ;; esac fi +_arguments \ + '-u[display or set time in UTC]' \ + ':format or date' \ + $args[@] This message has been scanned for viruses by MailControl - www.mailcontrol.com