about summary refs log tree commit diff
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2008-05-13 16:08:35 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2008-05-13 16:08:35 +0000
commit547adf2021e2e57e421d27e5620170a8751d4274 (patch)
treec86db928284b551f8616bb76fc5263b8f9a8148b
parent8a30b5f0df3809bb70c28b786ac30e5cdd169693 (diff)
downloadzsh-547adf2021e2e57e421d27e5620170a8751d4274.tar.gz
zsh-547adf2021e2e57e421d27e5620170a8751d4274.tar.xz
zsh-547adf2021e2e57e421d27e5620170a8751d4274.zip
25018: Omari Norman: completion for awk, join, sort
-rw-r--r--ChangeLog8
-rw-r--r--Completion/Unix/Command/.distfiles3
-rw-r--r--Completion/Unix/Command/_awk21
-rw-r--r--Completion/Unix/Command/_join23
-rw-r--r--Completion/Unix/Command/_sort31
-rw-r--r--Doc/Zsh/builtins.yo4
-rw-r--r--Doc/Zsh/grammar.yo13
7 files changed, 103 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index a00a87be7..43878d90a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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
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
diff --git a/Doc/Zsh/builtins.yo b/Doc/Zsh/builtins.yo
index cca0a3972..dad180180 100644
--- a/Doc/Zsh/builtins.yo
+++ b/Doc/Zsh/builtins.yo
@@ -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)
diff --git a/Doc/Zsh/grammar.yo b/Doc/Zsh/grammar.yo
index 05530bff2..fb07a63e2 100644
--- a/Doc/Zsh/grammar.yo
+++ b/Doc/Zsh/grammar.yo
@@ -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)