From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 11477 invoked from network); 6 Jul 2021 23:13:17 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 6 Jul 2021 23:13:17 -0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=zsh.org; s=rsa-20200801; h=List-Archive:List-Owner:List-Post:List-Unsubscribe: List-Subscribe:List-Help:List-Id:Sender:Message-ID:Date:Content-ID: Content-Type:MIME-Version:Subject:To:From:Reply-To:Cc: Content-Transfer-Encoding:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References; bh=yZ8gLRxU87NJ1zOCHqdQGtMMHPg8uzCU6qkoxWvRVhE=; b=EFGrTb6+wssoXHbRnbwqEkcbtp wym8AZWnA1qK+qy24NWkb2pmhrVY+tSFw/F0nDhSS0zZnn8AYOd5aePoY4Qvz9Y6fCbYyfLnQH5tV mxa+6qElRueao5R9Unodo4h6irHo0ruEmf3VRH4z/2KYNns9DNKljxVs6UBW+KStD9/z4FjLYvSo1 mEUJ8C1VFQPueavwETTZKKg9LExeVlIhEbvVJAY4pYJ2/Q1Q9ZyZqTbHxbc+1qQ+dyEjbvxgTa+wv YAp62z+5yvVz6GCgcbqPd2u9024913UNUBzOeqQ/SNZyX6ZTtQ6dMaOeyza9WbH7Yb+zFFyQNo22o Wc4Neu6w==; Received: from authenticated user by zero.zsh.org with local id 1m0uFf-000C77-7S; Tue, 06 Jul 2021 23:13:15 +0000 Received: from authenticated user by zero.zsh.org with esmtpsa (TLS1.3:TLS_AES_256_GCM_SHA384:256) id 1m0uFM-000Bpb-NF; Tue, 06 Jul 2021 23:12:57 +0000 Received: from [192.168.178.21] (helo=hydra) by mail.kiddle.eu with esmtp(Exim 4.94.2) (envelope-from ) id 1m0uFK-000KMx-SL for zsh-workers@zsh.org; Wed, 07 Jul 2021 01:12:55 +0200 From: Oliver Kiddle To: Zsh workers Subject: PATCH: complete more specific values for ssh key sizes MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <78301.1625613174.1@hydra> Date: Wed, 07 Jul 2021 01:12:54 +0200 Message-ID: <78302-1625613174.875252@Dkgx.MPUY.n4Lc> X-Seq: 49149 Archived-At: X-Loop: zsh-workers@zsh.org Errors-To: zsh-workers-owner@zsh.org Precedence: list Precedence: bulk Sender: zsh-workers-request@zsh.org X-no-archive: yes List-Id: List-Help: List-Subscribe: List-Unsubscribe: List-Post: List-Owner: List-Archive: 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" \