zsh-workers
 help / color / mirror / code / Atom feed
* PATCH: complete more specific values for ssh key sizes
@ 2021-07-06 23:12 Oliver Kiddle
  2021-07-07  2:38 ` Mikael Magnusson
  0 siblings, 1 reply; 2+ messages in thread
From: Oliver Kiddle @ 2021-07-06 23:12 UTC (permalink / raw)
  To: Zsh workers

This adds specific values in the completion after ssh-keygen -b
depending on any key type that might have been specified. ecdsa keys
needing 521 and not 512 is an oddity it can be useful to have a reminder
of. I think any value will work with rsa but this adds the common
choices.

The mailing list software had got its database locked so this message
also serves as a test of that.

Oliver

diff --git a/Completion/Unix/Command/_ssh b/Completion/Unix/Command/_ssh
index 82a2a1827..af5ef48a0 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'
+      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" \


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: PATCH: complete more specific values for ssh key sizes
  2021-07-06 23:12 PATCH: complete more specific values for ssh key sizes Oliver Kiddle
@ 2021-07-07  2:38 ` Mikael Magnusson
  0 siblings, 0 replies; 2+ messages in thread
From: Mikael Magnusson @ 2021-07-07  2:38 UTC (permalink / raw)
  To: Oliver Kiddle; +Cc: Zsh workers

On 7/7/21, Oliver Kiddle <opk@zsh.org> wrote:
> This adds specific values in the completion after ssh-keygen -b
> depending on any key type that might have been specified. ecdsa keys
> needing 521 and not 512 is an oddity it can be useful to have a reminder
> of. I think any value will work with rsa but this adds the common
> choices.

I wonder if the 521 should even have a comment, to prevent helpful
fixes later (I had this problem trying to add "A bright coloured fish"
to the ID3 spec page on wikipedia :).

-- 
Mikael Magnusson


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-07-07  2:38 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-06 23:12 PATCH: complete more specific values for ssh key sizes Oliver Kiddle
2021-07-07  2:38 ` Mikael Magnusson

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).