zsh-users
 help / color / mirror / code / Atom feed
From: Paul Ruane <paul.ruane@oniony.com>
To: Daniel Shahaf <d.s@daniel.shahaf.name>
Cc: zsh-users@zsh.org
Subject: Re: Cryptsetup completion
Date: Wed, 3 Jun 2020 12:19:09 +0100	[thread overview]
Message-ID: <CAJZHWOjh_t261QMg=Koj=_dZWmhm1bZzo+W3fskoDnkK=p_mGQ@mail.gmail.com> (raw)
In-Reply-To: <20200603005555.304cca04@tarpaulin.shahaf.local2>

Thanks for the detailed reply.

I'll have a crack at making these changes and integrating Mikael's
enlightening parameter expansion approach rather than my primitive
piping.

Paul

On Wed, 3 Jun 2020 at 01:56, Daniel Shahaf <d.s@daniel.shahaf.name> wrote:
>
> Paul Ruane wrote on Tue, 02 Jun 2020 17:17 +0100:
> > Hi,
> >
> > 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.
> >
>
> 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
> «fpath=( /path/to/zsh/Completions/**/*(/) )» prior to running compinit.).
>
> 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=}'[set cipher]:cipher specification' \
> > <   '(-h --hash)'{-h+,--hash=}'[hash algorithm]:hash algorithm' \
> > ---
> > >   '(-c --cipher)'{-c+,--cipher=}'[set cipher]:cipher specification:_ciphers' \
> > >   '(-h --hash)'{-h+,--hash=}'[hash algorithm]:hash algorithm:_hashes' \
> > 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+=($line[1])
> > > done
> > >
> > > _describe -t ciphers 'cipher' cipher_list "$@"
> > > }
> > >
> > > _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+=($line[1])
> > > done
> > >
> > > _describe -t hashes 'hash' hash_list "$@"
> > > }
> >
> > Paul
>

  reply	other threads:[~2020-06-03 11:20 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 [this message]
2020-06-03 12:52   ` Paul Ruane
2020-06-04  2:27     ` Daniel Shahaf
2020-06-04 11:50     ` Oliver Kiddle
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='CAJZHWOjh_t261QMg=Koj=_dZWmhm1bZzo+W3fskoDnkK=p_mGQ@mail.gmail.com' \
    --to=paul.ruane@oniony.com \
    --cc=d.s@daniel.shahaf.name \
    --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).