about summary refs log tree commit diff
path: root/Completion/Unix/Command/_ssh
diff options
context:
space:
mode:
Diffstat (limited to 'Completion/Unix/Command/_ssh')
-rw-r--r--Completion/Unix/Command/_ssh44
1 files changed, 25 insertions, 19 deletions
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' \