about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJun T <takimoto-j@kba.biglobe.ne.jp>2013-10-28 01:06:55 +0900
committerPeter Stephenson <p.w.stephenson@ntlworld.com>2013-10-27 16:38:24 +0000
commit973f8491edc782f019a336f8a97242ee5b9fdc4f (patch)
tree1580b4499258fcc63b8b0048af80672154919762
parenteec5140dde1c211454590536a7b43370d07f3bb6 (diff)
downloadzsh-973f8491edc782f019a336f8a97242ee5b9fdc4f.tar.gz
zsh-973f8491edc782f019a336f8a97242ee5b9fdc4f.tar.xz
zsh-973f8491edc782f019a336f8a97242ee5b9fdc4f.zip
31909: new cat completion
-rw-r--r--ChangeLog4
-rw-r--r--Completion/Unix/Command/.distfiles1
-rw-r--r--Completion/Unix/Command/_cat43
3 files changed, 48 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index 09c2bba15..8fd52635f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2013-10-27  Peter Stephenson  <p.w.stephenson@ntlworld.com>
+
+	* 31909: Jun T: Completion/Unix/Command/_cat: new completion.
+
 2013-10-26  Barton E. Schaefer  <schaefer@zsh.org>
 
 	* 31906: Src/jobs.c, Test/A05execution.ztst: printjob() should not
diff --git a/Completion/Unix/Command/.distfiles b/Completion/Unix/Command/.distfiles
index 232d4d03c..178406ffd 100644
--- a/Completion/Unix/Command/.distfiles
+++ b/Completion/Unix/Command/.distfiles
@@ -20,6 +20,7 @@ _bzip2
 _bzr
 _cal
 _calendar
+_cat
 _ccal
 _cdcd
 _cdrdao
diff --git a/Completion/Unix/Command/_cat b/Completion/Unix/Command/_cat
new file mode 100644
index 000000000..e223d90d9
--- /dev/null
+++ b/Completion/Unix/Command/_cat
@@ -0,0 +1,43 @@
+#compdef cat
+
+local -a args
+
+if _pick_variant gnu=GNU unix --version; then
+  args=(
+    '(-A --show-all)'{-A,--show-all}'[equivalent to -vET]'
+    '(-b --number-nonblank -n --number)'{-b,--number-nonblank}'[number nonempty output lines, overrides -n]'
+    '-e[equivalent to -vE]'
+    '(-E --show-ends)'{-E,--show-ends}'[display $ at end of each line]'
+    '(-n --number)'{-n,--number}'[number all output lines]'
+    '(-s --squeeze-blank)'{-s,--squeeze-blank}'[suppress repeated empty output lines]'
+    '-t[equivalent to -vT]'
+    '(-T --show-tabs)'{-T,--show-tabs}'[display TAB characters as ^I]'
+    '-u[ignored]'
+    '(-v --show-nonprinting)'{-v,--show-nonprinting}'[use ^ and M- notation, except for LFD and TAB]'
+    '(- : *)--help[display help and exit]'
+    '(- : *)--version[output version information and exit]'
+    '*:files:_files'
+  )
+
+elif [[ "$OSTYPE" == (freebsd|dragonfly|darwin)* ]]; then
+  args=(
+    '(-n)-b[number non-blank output lines]'
+    '(-v)-e[display $ at the end of each line (implies -v)]'
+    '-n[number all output lines]'
+    '-s[squeeze multiple blank lines into one]'
+    '(-v)-t[display tab as ^I (implies -v)]'
+    '-u[do not buffer output]'
+    '-v[display non-printing chars as ^X or M-a]'
+    '(-)*:files:_files'
+  )
+
+else
+  # POSIX reqires '-u', and most OSes may support '-n'
+  args=(
+    '-n[number all output lines]'
+    '-u[do not buffer output]'
+    '*:files:_files'
+  )
+fi
+
+_arguments -s -S : $args