Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
PATCH: handle ssh-keyscan in _ssh completion function
- X-seq: zsh-workers 42584
- From: Oliver Kiddle <okiddle@xxxxxxxxxxx>
- To: Zsh workers <zsh-workers@xxxxxxx>
- Subject: PATCH: handle ssh-keyscan in _ssh completion function
- Date: Thu, 05 Apr 2018 00:41:46 +0200
- Authentication-results: amavisd4.gkg.net (amavisd-new); dkim=fail (2048-bit key) reason="fail (body has been altered)" header.d=yahoo.co.uk
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.co.uk; s=s2048; t=1522894256; bh=fO0oI84azNueLYrkfWOp/gK139G2S3R8TM4jViJYp6U=; h=From:To:Subject:Date:From:Subject; b=LOhk0lJ9R6dpzPYZ6qFhsO7+OpZL3kaFEXFP+w1YVeG4cW21988OMEL5qgmswMs2bzGy8lcqnlkpmxc8oA6/OipB1RybewzYPKvDXJSUrZxvp7kVtQR/WQnwh2+6UWFwqdQuKuLgaKbCaqUdqAbmwKs1pNUpZt0PSPC6i5KCwzXOUDFQovl0Y6OdmrviB+WOotP6UHI+LbcoVOwdVv+Dm2Cio4zFMR/0yWZasu6xn77cdUu0ShTxBbJ5AG4k8OLiYHTHUXGnJhKKo+7xM6g4RCdRjTLA/LW+u9sTD57MZHPl/i1KZlrneAADGvHXL+rizCwU7rZ/H126KSkU+pLsbA==
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- List-unsubscribe: <mailto:zsh-workers-unsubscribe@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
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
Messages sorted by:
Reverse Date,
Date,
Thread,
Author