From 547adf2021e2e57e421d27e5620170a8751d4274 Mon Sep 17 00:00:00 2001 From: Peter Stephenson Date: Tue, 13 May 2008 16:08:35 +0000 Subject: 25018: Omari Norman: completion for awk, join, sort --- Completion/Unix/Command/.distfiles | 3 +++ Completion/Unix/Command/_awk | 21 +++++++++++++++++++++ Completion/Unix/Command/_join | 23 +++++++++++++++++++++++ Completion/Unix/Command/_sort | 31 +++++++++++++++++++++++++++++++ 4 files changed, 78 insertions(+) create mode 100644 Completion/Unix/Command/_awk create mode 100644 Completion/Unix/Command/_join create mode 100644 Completion/Unix/Command/_sort (limited to 'Completion') diff --git a/Completion/Unix/Command/.distfiles b/Completion/Unix/Command/.distfiles index 15cb2d661..ec4ac3975 100644 --- a/Completion/Unix/Command/.distfiles +++ b/Completion/Unix/Command/.distfiles @@ -9,6 +9,7 @@ _apm _arp _arping _attr +_awk _baz _bison _bittorrent @@ -88,6 +89,7 @@ _irssi _ispell _java _joe +_join _killall _knock _kvno @@ -169,6 +171,7 @@ _showmount _sisu _slrn _socket +_sort _spamassassin _sqsh _ssh diff --git a/Completion/Unix/Command/_awk b/Completion/Unix/Command/_awk new file mode 100644 index 000000000..da748e9be --- /dev/null +++ b/Completion/Unix/Command/_awk @@ -0,0 +1,21 @@ +#compdef awk + +# completions for awk +# This only aims to complete POSIX awk options, as described in +# awk(P). Most awk implementations, such as gawk and mawk, will have +# additional options that this does not complete. Also, currently +# this completion does not allow everything that POSIX allows. For +# example, awk(P) states that the user may specify assignments +# without using the -v option; this does not support that. +# +# In addition, the "program text" completion is not perfect. For +# instance, type "awk -" and then hit tab. You will be presented +# both with the dashed options and with the "program text" option. +# Fixing this is beyond my current _arguments expertise--help +# appreciated. + +_arguments -S -s '-F[define input field separator to be an extended regular expression]:extended regular expression:' \ + '*-v[assign values to variables]:assignment:' \ + '(1)-f[program file]:program file:_files' \ + '1:program text:' \ + '*:input files:_files' diff --git a/Completion/Unix/Command/_join b/Completion/Unix/Command/_join new file mode 100644 index 000000000..956d9d3b8 --- /dev/null +++ b/Completion/Unix/Command/_join @@ -0,0 +1,23 @@ +#compdef join + +# completions for GNU join version 5.97 + +local arguments + +arguments=( + '-a+[print unpairable lines coming from file FILENUM, where FILENUM is 1 or 2, corresponding to FILE1 or FILE2]:file number:(1 2)' + '-e+[replace missing input fields with EMPTY]:replacement string:' + '(-i --ignore-case)'{-i,--ignore-case}'[ignore differences in case when comparing fields]' + "-j+[equivalent to '-1 FIELD -2 FIELD']:field number:" + '-o+[obey FORMAT while constructing output line]:format string:' + '-t+[use CHAR as input and output field separator]:separator:' + '-v+[like -a FILENUM, but suppress joined output lines]:file number:(1 2)' + '-1+[join on this FIELD of file 1]:field number:' + '-2+[join on this FIELD of file 2]:field number:' + --help'[display help and exit]' + --version'[output version information and exit]' + '1:file 1:_files' + '2:file 2:_files' + ) + +_arguments -s $arguments diff --git a/Completion/Unix/Command/_sort b/Completion/Unix/Command/_sort new file mode 100644 index 000000000..1ea5a6e40 --- /dev/null +++ b/Completion/Unix/Command/_sort @@ -0,0 +1,31 @@ +#compdef sort + +# zsh completions for GNU sort version 5.97 +# limitation: --key does not work exactly right +local arguments + +arguments=( + '(-b --ignore-leading-blanks)'{-b,--ignore-leading-blanks}'[ignore leading blanks]' + '(-d --dictionary-order)'{-d,--dictionary-order}'[consider only blanks and alphanumeric characters]' + '(-f --ignore-case)'{-f,--ignore-case}'[fold lower case to upper case characters]' + '(-g --general-numeric-sort)'{-g,--general-numeric-sort}'[compare according to general numeric value]' + '(-i --ignore-nonprinting)'{-i,--ignore-nonprinting}'[consider only printable characters]' + '(-M --month-sort)'{-M,--month-sort}"[compare (unknown) < 'JAN' < ... < 'DEC']" + '(-n --numeric-sort)'{-n,--numeric-sort}'[compare according to string numerical value]' + '(-r --reverse)'{-r,--reverse}'[reverse the result of comparisons]' + '(-c --check)'{-c,--check}'[check whether input is sorted; do not sort]' + '(-k --key)'{-k+,--key=}'[start a key at POS1, end it as POS2 (origin 1)]:key:' + '(-m --merge)'{-m,--merge}'[merge already sorted files; do not sort]' + '(-o --output)'{-o+,--output=}'[write result to FILE instead of standard output]:filename:_files' + '(-s --stable)'{-s+,--stable=}'[stabilize sort by disabling last-resort comparison]' + '(-S --buffer-size)'{-S+,--buffer-size=}'[use SIZE for main memory buffer]:size:' + '(-t --field-separator)'{-t+,--field-separator=}'[use SEP instead of non-blank to blank transition]:separator:' + '(-T --temporary-directory)'{-T+,--temporary-directory=}'[use DIR for temporaries, not $TMPDIR or /tmp; multiple options specify multiple directories]:directory' + '(-u --unique)'{-u,--unique}'[with -c, check for strict ordering; without -c, output only the first of an equal run]' + '(-z --zero-terminated)'{-z,--zero-terminated}'[end lines with 0 byte, not newline]' + --help'[display help and exit]' + --version'[output version information and exit]' + '*:filename:_files' + ) + +_arguments -s $arguments -- cgit 1.4.1