From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6365 invoked by alias); 14 Nov 2013 14:53:22 -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: 31984 Received: (qmail 12590 invoked from network); 14 Nov 2013 14:53:15 -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=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.2 X-Biglobe-Sender: From: "Jun T." Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Subject: [PATCH] _df: new completion for the df command Message-Id: <25A968EA-AA39-43BF-A3A3-F36F6DD2D398@kba.biglobe.ne.jp> Date: Thu, 14 Nov 2013 23:53:12 +0900 To: zsh-workers@zsh.org Mime-Version: 1.0 (Mac OS X Mail 7.0 \(1822\)) X-Mailer: Apple Mail (2.1822) --- Completion/Unix/Command/_df | 79 = +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 79 insertions(+) create mode 100644 Completion/Unix/Command/_df diff --git a/Completion/Unix/Command/_df b/Completion/Unix/Command/_df new file mode 100644 index 0000000..892f91f --- /dev/null +++ b/Completion/Unix/Command/_df @@ -0,0 +1,79 @@ +#compdef df + +local context state state_descr line args spec +local -A opt_args + +if _pick_variant gnu=3DGNU unix --version; then + args=3D( + '(-B --block-size -k)'{-B+,--block-size=3D}'[specify block = size]:size (bytes)' + '(-B --block-size -k)-k[like --block-size=3D1K]' + '(-P --portability)'{-P,--portability}'[use the POSIX output = format]' + '(-h --human-readable -H --si)'{-h,--human-readable}'[print sizes = in human readable format]' + '(-h --human-readable -H --si)'{-H,--si}'[human readable fomat, but = use powers of 1000 not 1024]' + '(-i --inodes)'{-i,--inodes}'[list inode information instead of = block usage]' + '--total[produce a grand total]' + '(-T --print-type)'{-T,--print-type}'[print file system type]' + '(-a --all)'{-a,--all}'[include dummy file systems]' + '(-l --local)'{-l,--local}'[limit listing to local file systems]' + '*'{-t+,--type=3D}'[limit listing to file systems of specified = type]:file system type:_file_systems' + '*'{-x+,--exclude-type=3D}'[exclude file systems of specified = type]:file system type:_file_systems' + '(--no-sync)--sync[invoke sync before getting usage info]' + '(--sync)--no-sync[do not invoke sync before getting usage info = (default)]' + '-v[(ignored)]' + '(- : *)--help[display help and exit]' + '(- : *)--version[output version information and exit]' + '*:files:_files' + ) +elif [[ "$OSTYPE" =3D=3D (darwin|freebsd|dragonfly)* ]]; then + args=3D( + '(-b -g -H -h -k -m)-b[use 512-byte blocks (default)]' + '(-b -g -H -h -k -m)-g[use 1024^3-byte blocks]' + '(-b -g -H -h -k -m)-H[human-readable output (base 10)]' + '(-b -g -H -h -k -m)-h[human-readable output (base 2)]' + '(-b -g -H -h -k -m)-k[use 1024-byte blocks]' + '(-b -g -H -h -k -m)-m[use 1024*1024-byte blocks]' + '-P[POSIX compliant output]' + '-a[show all mount points]' + '-i[include inode usage statistics (default)]' + '-l[only display locally-mounted file systems]' + '-n[use previously obtained statistics]' + '*:files:_files' + ) + spec=3D'[only display file systems of specified types]:file system = type:->fslist' + case "$OSTYPE" in + (darwin*) + args+=3D( + "-T+$spec" +# '-t[same as -T (obsolete)]:file system type:->fslist' + ) + ;; + (freebsd*|dragonfly*) + args+=3D( "-t+$spec" '-T[include file system type]' ) + ;; + esac +else + # POSIX + args=3D( + '-k[use 1024-byte blocks]' + '-P[POSIX compliant output]' + '-t[include total allocated-space figures in the output]' + '*:files:_files' + ) +fi + +_arguments -s -S : $args && return 0 + +case "$state" in + (fslist) + local -a fsys used pre disp expl + _file_systems -U -O fsys + pre=3D$IPREFIX + # offer 'no' only if at the beginning of the list + if ! compset -P '*,' && ! compset -P 'no'; then + disp=3D( 'no -- exclude file system types in the list' ) + _wanted list-prefix expl 'prefix to list' compadd -d disp 'no' + fi + used=3D( ${(s:,:)${${IPREFIX#$pre}#no}} ) + _wanted fsys-types expl "$state_descr" compadd -qS , -F used -a = fsys + ;; +esac --=20 1.8.3.4 (Apple Git-47)