about summary refs log tree commit diff
path: root/Completion
diff options
context:
space:
mode:
authorOliver Kiddle <opk@zsh.org>2021-07-09 00:08:25 +0200
committerOliver Kiddle <opk@zsh.org>2021-07-09 00:14:02 +0200
commitbffe543142978b036621291dcfe08771ad6b4bda (patch)
treeef4a7f2d4946570639c8ffd0445a3833d88551d7 /Completion
parentf1d4a07845a3210401f3619aa59a2653e415f99a (diff)
downloadzsh-bffe543142978b036621291dcfe08771ad6b4bda.tar.gz
zsh-bffe543142978b036621291dcfe08771ad6b4bda.tar.xz
zsh-bffe543142978b036621291dcfe08771ad6b4bda.zip
49149: add specific values in completion after ssh-keygen -b depending on the key type
Diffstat (limited to 'Completion')
-rw-r--r--Completion/Unix/Command/_ssh11
1 files changed, 8 insertions, 3 deletions
diff --git a/Completion/Unix/Command/_ssh b/Completion/Unix/Command/_ssh
index 82a2a1827..c896f9316 100644
--- a/Completion/Unix/Command/_ssh
+++ b/Completion/Unix/Command/_ssh
@@ -5,7 +5,7 @@
 _ssh () {
   local curcontext="$curcontext" state line expl suf arg ret=1
   local args sigargs common common_transfer options algopt tmp p1 file cmn cmds sdesc tdesc
-  typeset -A opt_args
+  typeset -A opt_args tsizes
 
   common=(
     '(-6)-4[force ssh to use IPv4 addresses only]'
@@ -188,9 +188,14 @@ _ssh () {
     cmds=( -p -i -e -y -c -l -B -D -F -H -K -R -r -M -s -L -A -k -Q -Y ) # basic commands
     cmn=( -a -b -P -N -C -l -m -O -v -w -Z ) # options common to many basic commands (except -f which is common to most)
     cms=( -E -q -t -g -M -I -h -n -V -u -U ) # options specific to one basic command
+    tsizes=(
+      dsa 1024
+      ecdsa '256 384 521' # values appear in key names as listed with ssh -Q key - 521 really is correct
+      rsa '1024 2048 4096'
+    )
     _arguments -s $args \
-      "${p1}(${${(@)cmds:#-[pcKAO]}} ${${(@)cms:#-[t]}} -O)-a+[specify number of rounds]:rounds" \
-      "(${${(@)cmds:#-M}} -P ${${(@)cms:#-[MS]}})-b+[specify number of bits in key]:bits in key" \
+      "${p1}(${${(@)cmds:#-[pcKAO]}} ${${(@)cms:#-[t]}} -O)-a+[specify number of rounds]:rounds [16]" \
+      "(${${(@)cmds:#-M}} -P ${${(@)cms:#-[MS]}})-b+[specify number of bits in key]:bits in key [2048]:"'compadd ${expl\:/-X/-x} ${_comp_mesg\:=-} ${=tsizes[${opt_args[create--t]\:-rsa}]}' \
       "$p1(${${(@)cmds:#-[pc]}} -b $cms)-P+[provide old passphrase]:old passphrase" \
       "(${${(@)cmds:#-p}} -v ${${(@)cms:#-[qt]}})-N+[provide new passphrase]:new passphrase" \
       "(${${(@)cmds:#-c}} -v $cms)-C+[provide new comment]:new comment" \