Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Cryptsetup completion

Paul Ruane wrote:
> The new patch--in correct format :)--is here:


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


Messages sorted by: Reverse Date, Date, Thread, Author