From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1510 invoked from network); 13 May 2008 15:55:57 -0000 X-Spam-Checker-Version: SpamAssassin 3.2.4 (2008-01-01) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00 autolearn=ham version=3.2.4 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 13 May 2008 15:55:57 -0000 Received-SPF: none (ns1.primenet.com.au: domain at sunsite.dk does not designate permitted sender hosts) Received: (qmail 60997 invoked from network); 13 May 2008 15:55:51 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 13 May 2008 15:55:51 -0000 Received: (qmail 20582 invoked by alias); 13 May 2008 15:55:47 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 25018 Received: (qmail 20567 invoked from network); 13 May 2008 15:55:46 -0000 Received: from bifrost.dotsrc.org (130.225.254.106) by sunsite.dk with SMTP; 13 May 2008 15:55:46 -0000 Received: from photonix.site5.com (photonix.site5.com [209.59.179.2]) by bifrost.dotsrc.org (Postfix) with ESMTP id 3BD4180ED172 for ; Tue, 13 May 2008 17:55:38 +0200 (CEST) Received: from pool-96-231-102-184.washdc.east.verizon.net ([96.231.102.184] helo=cameron) by photonix.site5.com with esmtpa (Exim 4.68) (envelope-from ) id 1Jvwqo-0006KJ-7P for zsh-workers@sunsite.dk; Tue, 13 May 2008 11:55:39 -0400 Received: by cameron (sSMTP sendmail emulation); Tue, 13 May 2008 11:55:32 -0400 Date: Tue, 13 May 2008 11:55:32 -0400 From: Omari Norman To: zsh-workers@sunsite.dk Subject: New completions for awk cut join sort - attached Message-ID: <20080513155532.GA17790@cameron> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="4Ckj6UjgE2iN1+kY" Content-Disposition: inline User-Agent: Mutt/1.5.13 (2006-08-11) X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - photonix.site5.com X-AntiAbuse: Original Domain - sunsite.dk X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - smileystation.com X-Source: X-Source-Args: X-Source-Dir: X-Virus-Scanned: ClamAV 0.91.2/7110/Tue May 13 16:12:33 2008 on bifrost X-Virus-Status: Clean --4Ckj6UjgE2iN1+kY Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Hi all, I just wrote some completions for awk, cut, join, and sort. I was surprised that zsh didn't include these already. The awk one isn't perfect but it's a lot better than nothing. The awk one only completes basic POSIX awk options (i.e. not gawk or mawk options) while cut, join, and sort completions are for the GNU versions. I find these helpful, particularly because these commands all use different flags ("-F", "-t", and "-d") to do the exact same thing, even though these commands will often appear in the same pipeline! awk often trips me up in other ways, and this completion really helps with that too. I have attached the completions. Hopefully they can be included in the next zsh release, though the awk completion could use some expert attention (see comments in _awk). Thanks. --Omari -- Though the bag does not inflate, oxygen is flowing. --4Ckj6UjgE2iN1+kY Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=_awk #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' --4Ckj6UjgE2iN1+kY Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=_cut #compdef cut # zsh completions for GNU cut version 5.97 local arguments arguments=( '(-f --fields -b --bytes -c --characters)'{-b+,--bytes=}'[select only these bytes]:bytes:' '(-f --fields -b --bytes -c --characters)'{-c+,--characters=}'[select only these characters]:characters:' '(-f --fields -b --bytes -c --characters)'{-f+,--fields=}'[select only these fields; also print any line that contains no delimiter character, unless the -s option is specified]:fields:' '(-d --delimiter)'{-d+,--delimiter=}'[use delimiter instead of tab for field delimiter]:delimiter:' -n'[(ignored)]' --complement'[complement the set of selected bytes, characters or fields]' '(-s --only-delimited)'{-s+,--only-delimited=}'[do not print lines not containing delimiters]' '--output-delimiter=[use string as the output delimiter; the default is to use the input delimiter]:string:' --help'[display help and exit]' --version'[display version information and exit]' '*:filename:_files' ) _arguments -s $arguments --4Ckj6UjgE2iN1+kY Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=_join #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 --4Ckj6UjgE2iN1+kY Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=_sort #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 --4Ckj6UjgE2iN1+kY--