mirror of
git://git.code.sf.net/p/zsh/code
synced 2025-10-10 22:31:24 +02:00
25018: Omari Norman: completion for awk, join, sort
This commit is contained in:
parent
8a30b5f0df
commit
547adf2021
7 changed files with 103 additions and 0 deletions
|
@ -1,3 +1,11 @@
|
|||
2008-05-13 Peter Stephenson <pws@csr.com>
|
||||
|
||||
* 25018: Omari Norman: Completion/Unix/Command/{_awk,_cut,_join}:
|
||||
new completions.
|
||||
|
||||
* unposted: Doc/Zsh/builtins.yo, Doc/Zsh/grammar.yo: comment
|
||||
on aliases.
|
||||
|
||||
2008-05-12 Peter Stephenson <pws@csr.com>
|
||||
|
||||
* 25006, 25009: Src/Zle/complist.c: do "or" symlink orphan
|
||||
|
|
|
@ -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
|
||||
|
|
21
Completion/Unix/Command/_awk
Normal file
21
Completion/Unix/Command/_awk
Normal 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'
|
23
Completion/Unix/Command/_join
Normal file
23
Completion/Unix/Command/_join
Normal 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
|
31
Completion/Unix/Command/_sort
Normal file
31
Completion/Unix/Command/_sort
Normal 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
|
|
@ -98,6 +98,10 @@ If the tt(-L) flag is present, then print each
|
|||
alias in a manner suitable for putting in a startup script. The exit
|
||||
status is nonzero if a var(name) (with no var(value)) is given for
|
||||
which no alias has been defined.
|
||||
|
||||
For more on aliases, include common problems,
|
||||
ifzman(see the section ALIASING in zmanref(zshmisc))\
|
||||
ifnzman(noderef(Aliasing)).
|
||||
)
|
||||
findex(autoload)
|
||||
cindex(functions, autoloading)
|
||||
|
|
|
@ -479,6 +479,19 @@ if an alias is defined for the word tt(foo), alias expansion
|
|||
may be avoided by quoting part of the word, e.g. tt(\foo).
|
||||
But there is nothing to prevent an alias being defined
|
||||
for tt(\foo) as well.
|
||||
|
||||
There is a commonly encountered problem with aliases
|
||||
illustrated by the following code:
|
||||
|
||||
example(alias echobar='echo bar'; echobar)
|
||||
|
||||
This prints a message that the command tt(echobar) could not be found.
|
||||
This happens because aliases are expanded when the code is read in;
|
||||
the entire line is read in one go, so that when tt(echobar) is executed it
|
||||
is too late to expand the newly defined alias. This is often
|
||||
a problem in shell scripts, functions, and code executed with `tt(source)'
|
||||
or `tt(.)'. Consequently, use of functions rather than aliases is
|
||||
recommended in non-interactive code.
|
||||
texinode(Quoting)()(Aliasing)(Shell Grammar)
|
||||
sect(Quoting)
|
||||
cindex(quoting)
|
||||
|
|
Loading…
Reference in a new issue