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

Re: Cryptsetup completion



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@xxxxxxxxxxxxxxxxxx> 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
>



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