zsh-workers
 help / color / mirror / code / Atom feed
From: Oliver Kiddle <okiddle@yahoo.co.uk>
To: Zsh workers <zsh-workers@zsh.org>
Subject: PATCH: handle ssh-keyscan in _ssh completion function
Date: Thu, 05 Apr 2018 00:41:46 +0200	[thread overview]
Message-ID: <24421.1522881706@thecus> (raw)

This adds completion for ssh-keyscan to _ssh. The options to ssh-copy-id
have also been updated. openssh 7.7 doesn't appear to add any completion
relevant options by the way.

Oliver

diff --git a/Completion/Unix/Command/_ssh b/Completion/Unix/Command/_ssh
index 20a5536ee..2aae7027e 100644
--- a/Completion/Unix/Command/_ssh
+++ b/Completion/Unix/Command/_ssh
@@ -1,6 +1,6 @@
-#compdef ssh slogin=ssh scp ssh-add ssh-agent ssh-keygen sftp ssh-copy-id
+#compdef ssh slogin=ssh scp ssh-add ssh-agent ssh-copy-id ssh-keygen ssh-keyscan sftp
 
-# TODO: sshd, ssh-keyscan, ssh-keysign
+# TODO: sshd, ssh-keysign
 
 _ssh () {
   local curcontext="$curcontext" state line expl suf ret=1
@@ -187,7 +187,20 @@ _ssh () {
       "($cmn -I -h -n -O -V)-k[generate a KRL file]" \
       "$p1($cmn -I -h -n -O -V)-u[update a KRL]"
     return
-    ;;
+  ;;
+  ssh-keyscan)
+    _arguments \
+      '(-6)-4[forces ssh to use IPv4 addresses only]' \
+      '(-4)-6[forces ssh to use IPv6 addresses only]' \
+      '-c[request certificates from target hosts instead of plain keys]' \
+      '*-f+[read hosts from file, one per line]:file:_files' \
+      '-H[hash all hostnames and addresses in the output]' \
+      '-p+[specify port on remote host]:port number on remote host' \
+      '-T+[specify timeout]:timeout (seconds) [5]' \
+      '-t+[specify key types to fetch from scanned hosts]:key type:_sequence compadd - rsa dsa ecdsa ed25519' \
+      '-v[verbose mode]'
+    return
+  ;;
   sftp)
     _arguments -C -s \
       '-a[attempt to continue interrupted transfers]' \
@@ -199,10 +212,15 @@ _ssh () {
       '-s+[SSH2 subsystem or path to sftp server on the remote host]:subsystem/path' \
       '1:file:->rfile' '*:file:->file' "$common[@]" "$common_transfer[@]" && ret=0
     ;;
-  (ssh-copy-id)
+  ssh-copy-id)
     _arguments \
-      '-i+[select identity file]:SSH identity file:_files' \
-      ':remote host name:->userhost' \
+      '-i+[select identity file]:SSH identity file:_files -g "*(-.^AR)"' \
+      '-f[copy keys without trying to check if they are already installed]' \
+      '-n[dry run - no keys are actually copied]' \
+      '*-o+[specify ssh options]:option string:->option' \
+      '-p+[specify port on remote host]:port number on remote host' \
+      '(- 1)'{-h,-\?}'[display usage information]' \
+      ':remote host name:->userhost' && ret=0
     ;;
   esac
 


                 reply	other threads:[~2018-04-05  2:17 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=24421.1522881706@thecus \
    --to=okiddle@yahoo.co.uk \
    --cc=zsh-workers@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).