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=-1.0 required=5.0 tests=MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 23431 invoked from network); 3 Jun 2020 00:56:47 -0000 Received: from ns1.primenet.com.au (HELO primenet.com.au) (203.24.36.2) by inbox.vuxu.org with ESMTPUTF8; 3 Jun 2020 00:56:47 -0000 Received: (qmail 4764 invoked by alias); 3 Jun 2020 00:56:39 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: List-Unsubscribe: X-Seq: 24896 Received: (qmail 10140 invoked by uid 1010); 3 Jun 2020 00:56:39 -0000 X-Qmail-Scanner-Diagnostics: from out4-smtp.messagingengine.com by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.102.3/25828. spamassassin: 3.4.4. Clear:RC:0(66.111.4.28):SA:0(-2.6/5.0):. Processed in 4.176412 secs); 03 Jun 2020 00:56:39 -0000 X-Envelope-From: d.s@daniel.shahaf.name X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | Received-SPF: none (ns1.primenet.com.au: domain at daniel.shahaf.name does not designate permitted sender hosts) X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduhedrudefkedgfeeiucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepfffhvffukfgjfhfogggtgfesthhqtddtredtjeenucfhrhhomhepffgrnhhi vghlucfuhhgrhhgrfhcuoegurdhssegurghnihgvlhdrshhhrghhrghfrdhnrghmvgeqne cuggftrfgrthhtvghrnhephfdtteefheevuedthedutdeifeegteettdejtdffheduieei jeelteetkeduteehnecukfhppeejledrudejiedrfeelrdeileenucevlhhushhtvghruf hiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpegurdhssegurghnihgvlhdrshhh rghhrghfrdhnrghmvg X-ME-Proxy: Date: Wed, 3 Jun 2020 00:55:55 +0000 From: Daniel Shahaf To: Paul Ruane Cc: zsh-users@zsh.org Subject: Re: Cryptsetup completion Message-ID: <20200603005555.304cca04@tarpaulin.shahaf.local2> In-Reply-To: References: X-Mailer: Claws Mail 3.17.3 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Paul Ruane wrote on Tue, 02 Jun 2020 17:17 +0100: > Hi, >=20 > For my own system I have modified the Zsh completion of cryptsetup to > include completion of the hash and cipher based upon those declared > available in /proc/crypto. I thought this might be useful for other > users, too, so I have included my changes below for your > consideration. >=20 Thanks. The helper functions are in the global namespace so they should have names that are less likely to clash. Also, they aren't specific to cryptsetup, so we could break them out to separate, autoloadable files (with "#autoload" on their first line rather than "#compdef foo"). Would you be interested in updating the patch along these lines? It'd be best to do so by using zsh from git, but you needn't build zsh for that (you can simply clone the git repository and, for testing, set =C2=ABfpath=3D( /path/to/zsh/Completions/**/*(/) )=C2=BB prior to running c= ompinit.). Cheers, Daniel P.S. For future reference, always pass the -u option to diff(1), otherwise the patches cannot be applied except to the very same version of the original file. > 11,12c11,12 > < '(-c --cipher)'{-c+,--cipher=3D}'[set cipher]:cipher specification' \ > < '(-h --hash)'{-h+,--hash=3D}'[hash algorithm]:hash algorithm' \ > --- > > '(-c --cipher)'{-c+,--cipher=3D}'[set cipher]:cipher specification:_c= iphers' \ > > '(-h --hash)'{-h+,--hash=3D}'[hash algorithm]:hash algorithm:_hashes'= \ =20 > 157a158,183 > > > > _ciphers() { > > typeset -a cipher_list > > local line > > > > _call_program grep 'grep "^\(name\|type\)\s\+:" /proc/crypto | grep -B1= "^type\s\+:\s\+cipher" | grep "^name\s\+:" | cut -d ":" -f 2 | uniq | sed = "s/^ //"' | \ > > while read -A line > > do > > cipher_list+=3D($line[1]) > > done > > > > _describe -t ciphers 'cipher' cipher_list "$@" =20 > > } =20 > > > > _hashes() { > > typeset -a hash_list > > local line > > > > _call_program grep 'grep "^\(name\|type\)\s\+:" /proc/crypto | grep -B1= "^type\s\+:\s\+shash" | grep "^name\s\+:" | cut -d ":" -f 2 | uniq | sed "= s/^ //"' | \ > > while read -A line > > do > > hash_list+=3D($line[1]) > > done > > > > _describe -t hashes 'hash' hash_list "$@" =20 > > } =20 >=20 > Paul