Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Cryptsetup completion
- X-seq: zsh-users 24901
- From: Oliver Kiddle <okiddle@xxxxxxxxxxx>
- To: Paul Ruane <paul.ruane@xxxxxxxxxx>
- Subject: Re: Cryptsetup completion
- Date: Thu, 04 Jun 2020 13:50:48 +0200
- Authentication-results: amavisd4.gkg.net (amavisd-new); dkim=pass (2048-bit key) header.d=yahoo.co.uk
- Cc: Daniel Shahaf <d.s@xxxxxxxxxxxxxxxxxx>, zsh-users@xxxxxxx
- In-reply-to: <CAJZHWOiszxAafvx=5YbumTdKf2zKonU5pBdzs11tpJk2-Z0Qiw@mail.gmail.com>
- List-help: <mailto:zsh-users-help@zsh.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:zsh-users@zsh.org>
- List-unsubscribe: <mailto:zsh-users-unsubscribe@zsh.org>
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
- References: <CAJZHWOgdLXOKezG59vQNH6yVusyuq8iTiH9mHO1VFuj27HokWQ@mail.gmail.com> <20200603005555.304cca04@tarpaulin.shahaf.local2> <CAJZHWOiszxAafvx=5YbumTdKf2zKonU5pBdzs11tpJk2-Z0Qiw@mail.gmail.com>
Paul Ruane wrote:
> The new patch--in correct format :)--is here:
Thanks
> +++ b/Completion/Linux/Type/_crypto_ciphers
These are just the cyphers handled by the Linux kernel, right? Is this
naming perhaps too generic? _linux_ciphers perhaps? We wouldn't want
them to be used in other cases where something else such as openssl
ciphers are wanted. Does anyone know for what other commands these might
be relevant? If there are none, then I would contradict Daniel about
factoring them out.
> +cipher_list=( ${${${(M)${(s:name:)${(M)${(f)"$(</proc/crypto)"}:#(name|type)*}}:#*:
> cipher*}#*: }%% *} )
> +
> +_describe -t ciphers 'cipher' cipher_list
The _describe function is there to make it easier to format lists
containing both matches and descriptions. From my testing, this
cipher_list array is only a list of matches. So it is much more
efficient to just do:
local expl
_description ciphers expl cipher
compadd "$@" "$expl[@]" -a cipher_list
I know that looks slightly longer but it is doing much less underneath
so is more efficient.
Oliver
Messages sorted by:
Reverse Date,
Date,
Thread,
Author