about summary refs log tree commit diff
path: root/Completion/Unix
diff options
context:
space:
mode:
Diffstat (limited to 'Completion/Unix')
-rw-r--r--Completion/Unix/Command/.distfiles4
-rw-r--r--Completion/Unix/Command/_rar37
-rw-r--r--Completion/Unix/Command/_sed27
-rw-r--r--Completion/Unix/Command/_ssh44
-rw-r--r--Completion/Unix/Command/_uniq26
5 files changed, 110 insertions, 28 deletions
diff --git a/Completion/Unix/Command/.distfiles b/Completion/Unix/Command/.distfiles
index 8efe54c00..60662c689 100644
--- a/Completion/Unix/Command/.distfiles
+++ b/Completion/Unix/Command/.distfiles
@@ -22,6 +22,6 @@ _global                     _ant          _lsof         _mt           _xmlsoft
 _perforce     _python       _antiword     _screen       _renice       _apm
 _ecasound     _gpg	    _subversion   _aap          _sablotron    _nmap
 _chmod        _du           _getent       _gphoto2
-_nice	      _rar	    _vorbis
-_printenv
+_nice	      _printenv
+_rar	      _sed          _uniq         _vorbis
 '
diff --git a/Completion/Unix/Command/_rar b/Completion/Unix/Command/_rar
index c766b198f..8b12dc8eb 100644
--- a/Completion/Unix/Command/_rar
+++ b/Completion/Unix/Command/_rar
@@ -22,10 +22,10 @@ common=(
   '-ow[save or restore file owner and group]'
   '-p\-[do not query password]'
   '-r[recurse subdirectorie]'
-  '-ta[process files modified after <date> in YYYYMMDDHHMMSS format]'
-  '-tb[process files modified before <date> in YYYYMMDDHHMMSS format]'
-  '-tn[process files newer than <time>]'
-  '-to[process files older than <time>]'
+  '-ta+[process files modified after a date]:date (YYYYMMDDHHMMSS)'
+  '-tb+[process files modified before a date]:date (YYYYMMDDHHMMSS)'
+  '-tn+[process files newer than a specified time]:time'
+  '-to+[process files older than a specified time]:time'
   '-u[update files]'
   '-v[create volumes with size autodetection or list all volumes]'
   '-ver[file version control]'
@@ -44,10 +44,33 @@ case $service in
   ;;
   rar)
     if (( CURRENT == 2 )); then
-      _wanted commands expl 'rar command' compadd \
-	  a c cf cw d e f i k l lt m mf p r rc rr rv s t u v vt x && return
+      _values 'rar command' \
+	'a[add files to archive]' \
+	'c[add archive comment]' \
+	'cf[add files comment]' \
+	'cw[write archive comment to file]' \
+	'd[delete files from archive]' \
+	'e[extract files to current directory]' \
+	'f[freshen files in archive]' \
+	'i[find string in archives]' \
+	'k[lock archive]' \
+	'l[list archive]' \
+	'lt[list archive (technical format)]' \
+	'm[move to archive]' \
+	'mf[move to archive (files only)]' \
+	'p[print file to stdout]' \
+	'r[repair archive]' \
+	'rc[reconstruct missing volumes]' \
+	'rr[add data recovery record]' \
+	'rv[create recovery volumes]' \
+	's[convert archive to or from SFX]' \
+	't[test archive files]' \
+	'u[update files in archive]' \
+	'v[verbosely list archive]' \
+	'vt[verbosely list archive (technical format)]' \
+	'x[extract files with full path]' && return
     else
-      _arguments -s \
+      _arguments -S \
 	'-ag[generate archive name using the current date]' \
 	'-as[synchronize archive contents]' \
 	'-av[put authenticity verification (registered versions only)]' \
diff --git a/Completion/Unix/Command/_sed b/Completion/Unix/Command/_sed
new file mode 100644
index 000000000..46c3eb475
--- /dev/null
+++ b/Completion/Unix/Command/_sed
@@ -0,0 +1,27 @@
+#compdef sed
+
+local args
+
+args=(
+  '(-n --quiet --silent)'{-n,--quiet,--silent}'[suppress automatic printing of pattern space]'
+  '(1)*'{-e,--expresssion=}'[add sed commands to run]:sed script'
+  '(1)*'{-f,--file=}'[add contents of file to commands to run]:file:_files'
+  '(-e)1: :_guard "^-*" sed script'
+  ':input file:_files'
+)
+
+if _pick_variant gnu=GNU unix --version; then
+  args+=(
+    '(-i --in-place)'{-i,--in-place=}'[edit files in place]::suffix for backup'
+    '(-l --line-length)'{-l,--line-length=}'[specify line-wrap length for the l command]'
+    '(-r --regexp-extended)'{-r,--regexp-extended}'[use extended regular expressions]'
+    '(-s --separate)'{-s,--separate}'[consider files separately instead of as a combined stream]'
+    '(-u --unbuffered)'{-u,--unbuffered}'[disable data buffering]'
+    '(- 1 :)--help[print program usage]'
+    '(- 1 :)'{-V,--version}'[print program version]'
+  )
+else
+  args=( "${(@)args:#(|\(*\))(|\*)--*}" )
+fi
+
+_arguments "$args[@]"
diff --git a/Completion/Unix/Command/_ssh b/Completion/Unix/Command/_ssh
index 8716c676c..66cde3e56 100644
--- a/Completion/Unix/Command/_ssh
+++ b/Completion/Unix/Command/_ssh
@@ -4,9 +4,9 @@ _remote_files () {
   # There should be coloring based on all the different ls -F classifiers.
   local expl remfiles remdispf remdispd args suf ret=1
 
-  if zstyle -T ":completion:${curcontext}:" remote-access; then
+  if zstyle -T ":completion:${curcontext}:files" remote-access; then
     zparseopts -D -E -a args p: 1 2 4 6 F:
-    remfiles=(${(M)${(f)"$(ssh $args -a -x ${IPREFIX%:} ls -d1F ${(Q)PREFIX%%[^./][^/]#}\* 2>/dev/null)"}%%[^/]#(|/)})
+    remfiles=(${(M)${(f)"$(_call_program files ssh $args -a -x ${IPREFIX%:} ls -d1F ${(Q)PREFIX%%[^./][^/]#}\* 2>/dev/null)"}%%[^/]#(|/)})
     compset -P '*/'
     compset -S '/*' || suf='remote file'
 
@@ -29,7 +29,7 @@ _remote_files () {
 }
 
 _ssh () {
-  local curcontext="$curcontext" state line expl common tmp ret=1
+  local curcontext="$curcontext" state line expl common tmp cmds suf ret=1
   typeset -A opt_args
 
   common=(
@@ -82,8 +82,8 @@ _ssh () {
       '-v[verbose mode]' \
       '-B[batch mode]' \
       '-q[disables the progress meter]' \
-      '-P+[specify port on remote host]:port number on remote host:' \
-      '-S+[specify path to ssh]:path to ssh:_files -g \*\(-\*\)' \
+      '-P+[specify port on remote host]:port number on remote host' \
+      '-S+[specify ssh program]:path to ssh:_command_names -e' \
       '*:file:->file' "$common[@]" && ret=0
     ;;
   ssh-add)
@@ -106,21 +106,24 @@ _ssh () {
     return
     ;;
   ssh-keygen)
+    cmds=( -p -i -e -y -c -l -B -D -U )
     _arguments \
-      '(-p -c -u -P)-b[specify number of bits in key]:bits in key:' \
-      '(-c)-f[key file]:key file:_files' \
-      '(-c -u)-N[specify new passphrase]:new passphrase:' \
-      '(-b -u -f)-P[specify old passphrase]:old passphrase:' \
-      '(-p -u)-C[specify new comment]:new comment:' \
-      '(-b -C -u -c)-p[change passphrase of private key file]' \
-      '(-b -N -p -u)-c[change comment in private and public key files]' \
-      '-l[show fingerprint of specified private or public key file]' \
       '-q[silence ssh-keygen]' \
-      '-R[exit 0 or 1 if RSA support is functional]' \
-      '-x[read a DSA private key and print a SSH2 public key to stdout]'\
-      '-X[read a SSH2 public key and print a DSA public key to stdout]'\
-      '-y[read a DSA private key and print a DSA public key to stdout]'\
-      '(-b -N -C -p -c)-u[change key cipher to default]'
+      "($cmds -P)-b[specify number of bits in key]:bits in key" \
+      "($cmds -P)-t[specify the type of the key to create]:key type:(rsa1 rsa dsa)" \
+      "(${cmds#-p })-N[provide new passphrase]:new passphrase" \
+      "($cmds -b -t)-C[provide new comment]:new comment" \
+      '(-D)-f[key file]:key file:_files' \
+      '('${(j. .)cmds:#-[pc]}' -t -b)-P[provide old passphrase]:old passphrase' \
+      "($cmds -q -b -t -C)-p[change passphrase of private key file]" \
+      "($cmds -q -b -t -N -C -P)-i[import key to OpenSSH format]" \
+      "($cmds -q -b -t -N -C -P)-e[export key to SECSH file format]" \
+      "($cmds -q -b -t -N -C -P)-y[get public key from private key]" \
+      "($cmds -q -b -t -N)-c[change comment in private and public key files]" \
+      "($cmds -q -b -t -N -C -P)-l[show fingerprint of key file]" \
+      "($cmds -q -b -t -N -C -P)-B[show the bubblebabble digest of key]" \
+      "($cmds -q -b -t -N -C -P -f)-D[download key stored in smartcard reader]:reader" \
+      "($cmds -q -b -t -N -C -P)-U[upload key to smartcard reader]:reader"
     return
     ;;
   sftp)
@@ -129,6 +132,7 @@ _ssh () {
       '-F+[specify alternate config file]:config file:_files' \
       '(-1)-s[invoke subsystem]' \
       '-S+[specify program]:program:_command_names -e' \
+      '-B+[specify buffer size]:buffer size' \
       '-b+[specify batch file to read]:batch file:_files' \
       '*-v[verbose mode]' \
       '-1[forces ssh to try protocol version 1 only]' \
@@ -265,7 +269,9 @@ _ssh () {
       if compset -P '*:'; then
         _remote_files ${(kv)~opt_args[(I)-[FP1246]]/-P/-p} && ret=0
       elif compset -P '*@'; then
-        _wanted hosts expl host _ssh_hosts -S: && ret=0
+        suf=( -S '' )
+        compset -S ':*' || suf=( -S : )
+        _wanted hosts expl host _ssh_hosts $suf && ret=0
       else
         _alternative \
 	    'files:: _files' \
diff --git a/Completion/Unix/Command/_uniq b/Completion/Unix/Command/_uniq
new file mode 100644
index 000000000..be58fd775
--- /dev/null
+++ b/Completion/Unix/Command/_uniq
@@ -0,0 +1,26 @@
+#compdef uniq
+
+local args
+
+args=(
+  '(-c --count)'{-c,--count}'[prefix lines by the number of occurrences]'
+  '(-d --repeated)'{-d,--repeated}'[only print duplicate lines]'
+  '(-D --all-repeated)'{-D,--all-repeated=}'[print all duplicate lines]:delimit method:(none prepend separate)'
+  '(-f --skip-fields)'{-f,--skip-fields=}'[avoid comparing initial fields]:number of fields'
+  '(-i --ignore-case)'{-i,--ignore-case}'[ignore differences in case when comparing]'
+  '(-s --skip-chars)'{-s,--skip-chars=}'[avoid comparing initial characters]:number of characters'
+  '(-t --separator)'{-t,--separator=}'[specify field delimiter]:separator'
+  '(-u --unique)'{-u,--unique}'[only print unique lines]'
+  '(-w --check-chars)'{-w,--check-chars=}'[specify maximum number of characters to compare]:characters'
+  '(-W --check-fields)'{-W,--check-fields=}'[specify maximum number of fields to compare]:fields'
+  '(- *)--help[display help information]'
+  '(- *)--version[display version information]'
+)
+
+if ! _pick_variant gnu=Free\ Soft unix --version; then
+  args=( ${(M)args:#(|\*)(|\(*\))-[cdufs]*} )
+fi
+
+_arguments "$args[@]" \
+  '1::input file:_files' \
+  '2::output file:_files'