From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8944 invoked by alias); 6 Dec 2010 01:14: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: 28484 Received: (qmail 2372 invoked from network); 6 Dec 2010 01:14:26 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.1 Received-SPF: pass (ns1.primenet.com.au: SPF record at _spf.google.com designates 209.85.212.43 as permitted sender) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:date:message-id :subject:from:to:content-type; bh=kVN1y9eb4RobASI5wLrfqAiz3AUsuZ8Oy16BsZR20Yg=; b=oJt9YgFWbmE7bN2IaKP8JGBBhHoHQHzzxdGP29EIbiv888qi7UXTyKave1UIlRDoSM angVR10EMuYEaH+gaQNgculxDEKbV52Ffp7JU1/4rDmrZz8CXlsHCOV1epphm+txCGrH BIuqx27+mtXn2gy0QvNEHbb+N5SNcZJ71J8+o= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; b=Q0Cl9rsDIsCdg74MVsQW1KwY/X59dvDk2n8nOpeeCL+whH4KqkwyCy0Xs4ZsiHu00s YrTRBikKRsKcE3SfKAuNtVp7QeQik/wT86iNNxXVgLIvHyCPVTulEyaNTeH0/3sf9Mbp edJBdLHUE7NBL7rvVC7SHDY9fe/yoO1E3j6bE= MIME-Version: 1.0 Date: Mon, 6 Dec 2010 02:14:21 +0100 Message-ID: Subject: Almost updated completion for GNU du From: Mikael Magnusson To: zsh workers Content-Type: text/plain; charset=UTF-8 This almost works, well, it does work. But if you swap the order of the --time and --time-style lines, --time-style stops working, ie --time-style= produces no completions. Can anyone explain this? I've tried in zsh -f. http://mika.l3ib.org/patches/zsh-du-almost.patch commit 4e00244a570925dc9602828795129fa845e28016 Author: Mikael Magnusson Date: Sun Jun 8 07:05:08 2008 +0200 _du: Add new GNU options. diff --git a/Completion/Unix/Command/_du b/Completion/Unix/Command/_du index 11122f3..8c3c886 100644 --- a/Completion/Unix/Command/_du +++ b/Completion/Unix/Command/_du @@ -7,22 +8,42 @@ if _pick_variant gnu=Free\ Soft unix --version /dummy/no-such-file; then '(-B --block-size -k)'{-B,--block-size=}'[specify block size]:size (bytes)' \ '(-B --block-size -k --apparent-size -b --bytes)'{-b,--bytes}'[equivalent to --apparent-size --block-size=1]' \ '(-c --total)'{-c,--total}'[produce a grand total]' \ - '(-D --dereference-args -L --dereference)'{-D,--dereference-args}'[dereference arguments that are symlinks]' \ + '(-H -D --dereference-args -L --dereference -P --no-dereference)'{-H,-D,--dereference-args}'[dereference arguments that are symlinks]' \ + '(-H -D --dereference-args -L --dereference -P --no-dereference)'{-P,--no-dereference}'[do not dereference any symlinks]' \ '(-h --human-readable -H --si)'{-h,--human-readable}'[print sizes in human readable format]' \ - '(-H --si -h --human-readable)'{-H,--si}'[human readable form using powers of 1000]' \ + '(--si -h --human-readable)--si[human readable form using powers of 1000]' \ '(-B --block-size)-k[use block size of 1k]' \ + '(-B --block-size)-m[use block size of 1M]' \ '(-l --count-links)'{-l,--count-links}'[count sizes many times if hard linked]' \ - '(-L --dereference -D --dereference-args)'{-L,--dereference}'[dereference all symlinks]' \ + '(-L --dereference -H -D --dereference-args -P --no-dereference)'{-L,--dereference}'[dereference all symlinks]' \ '(-S --separate-dirs)'{-S,--separate-dirs}'[do not include size of subdirectories]' \ '(-s --summarize --max-depth -a --all)'{-s,--summarize}'[only display total for each argument]' \ '(-x --one-file-system)'{-x,--one-file-system}'[skip directories on different filesystems]' \ + '(-0 --null)'{-0,--null}'[end each output line with NUL instead of newline]' \ \*{-X+,--exclude-from=}'[exclude files matching any pattern in file]:file:_files' \ '*--exclude=[exclude files matching pattern]:pattern' \ '(-s --summarize)--max-depth=[maximum levels to recurse]:levels' \ + '--files0-from=[use NUL-terminated list of files from file]:file' \ + '--time-style=[show times using given style, +FORMAT for strftime formatted args]:style:->timestyle' \ + '--time=-[show time of last modification of any file in the directory]:property:->time' \ '(* -)--help[display help information]' \ '(* -)--version[display version information]' \ '*:file:_files' - return + + case $state in + (time) + local -a property + property=(atime access use ctime status) + _wanted property expl property compadd -a property + ;; + (timestyle) + local -a style desc + style=(full-iso long-iso iso +) + desc=('full-iso' 'long-iso' 'iso' '+FORMAT like `date'\''') + _wanted -V style expl style compadd -d desc -a style + ;; + esac + else # based on $OSTYPE = solaris2.8 local xdev='[skip directories on different filesystems]' @@ -40,5 +61,4 @@ else '-r[notify about unreadable files/directories]' \ '(-a)-s[only display total for each argument]' \ '*:file:_files' - return fi -- Mikael Magnusson