zsh-users
 help / color / mirror / code / Atom feed
From: Oliver Kiddle <okiddle@yahoo.co.uk>
To: Paul Ruane <paul.ruane@oniony.com>
Cc: Daniel Shahaf <d.s@daniel.shahaf.name>, zsh-users@zsh.org
Subject: Re: Cryptsetup completion
Date: Thu, 04 Jun 2020 13:50:48 +0200	[thread overview]
Message-ID: <56544-1591271448.415496@8V8i.speh.Bt-A> (raw)
In-Reply-To: <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

  parent reply	other threads:[~2020-06-04 11:51 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-02 16:17 Paul Ruane
2020-06-03  0:03 ` Mikael Magnusson
2020-06-03  0:55 ` Daniel Shahaf
2020-06-03 11:19   ` Paul Ruane
2020-06-03 12:52   ` Paul Ruane
2020-06-04  2:27     ` Daniel Shahaf
2020-06-04 11:50     ` Oliver Kiddle [this message]
2020-06-05  1:55       ` Daniel Shahaf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=56544-1591271448.415496@8V8i.speh.Bt-A \
    --to=okiddle@yahoo.co.uk \
    --cc=d.s@daniel.shahaf.name \
    --cc=paul.ruane@oniony.com \
    --cc=zsh-users@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).