1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-11-01 18:30:55 +01:00

25018: Omari Norman: completion for awk, join, sort

This commit is contained in:
Peter Stephenson 2008-05-13 16:08:35 +00:00
parent 8a30b5f0df
commit 547adf2021
7 changed files with 103 additions and 0 deletions

View file

@ -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

View file

@ -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'

View file

@ -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

View file

@ -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