Providing shell-completions for gpg, minor scripting issues

Axel Liljencrantz liljencrantz at gmail.com
Mon Jan 16 14:54:14 CET 2006


On 1/16/06, Alphax <alphasigmax at gmail.com> wrote:
> Axel Liljencrantz wrote:
> > Hello,
> >
> > I'm currently writing a set of gpg-specific completions for the fish
> > shell (http://roo.no-ip.org/fish). These completions already feature
> > all the switches for gpg, and a description of each switch, usually
> > the first sentence of the manpage description.
> >
> > While doing this, I've run across an issue with scripting. Fish allows
> > you to tab-complete sub-arguments to switches, so you can for instance
> > write
> >
> > fish> gpg --verify-options=show-photos,show-us<TAB>
> >
> > and the line will complete to
> >
> > fish> gpg --verify-options=show-photos,show-user-notations
> >
> > I'd like to do this for the various switches that accept a crypto
> > algorithm, unfortunatly I have some problems with getting a good
> > listing of the algorithms supported by the users GPG implementation.
> > Running 'gpg --version' prints them, but it does so in format that I'm
> > not very happy with:
> >
> > gpg (GnuPG) 1.4.1
> > Copyright (C) 2005 Free Software Foundation, Inc.
> > This program comes with ABSOLUTELY NO WARRANTY.
> > This is free software, and you are welcome to redistribute it
> > under certain conditions. See the file COPYING for details.
> >
> > Home: ~/.gnupg
> > Stödda algoritmer:
> > öppen nyckel: RSA, RSA-E, RSA-S, ELG-E, DSA
> > Chiffer: 3DES, CAST5, BLOWFISH, AES, AES192, AES256, TWOFISH
> > Kontrollsumma: MD5, SHA1, RIPEMD160, SHA256, SHA384, SHA512
> > Komprimering: Okomprimerad, ZIP, ZLIB, BZIP2
> >
> > As you can see, the format is locale dependant. I'm also worried that
> > changed phrasing, further algorithm subdivision, etc. will mean that
> > my parsing rules will break. To get a locale independant format, I
> > have to invoke GPG with a LC_ALL set to C. This doen't seem very
> > optimal to me. Is there some other way of getting this information
> > that I've missed? If not, could perhaps the --with-colons switch be
> > made to act on --version as well, to get an more robust format?
> >
>
> gpg --verbose --version

The only change in the output format when using verbose is that some
algorithms have what I assume to be an alternative name in
parenthesis, and that the listings of algorithms are now linebreaked.
The output is still locale dependant, it is still designed to be
human-readable rather than machine readable, and the multiline output
makes it slighly harder to parse, so this doesn't really help me.

>
> gpg (GnuPG) 1.4.1
> Copyright (C) 2005 Free Software Foundation, Inc.
> This program comes with ABSOLUTELY NO WARRANTY.
> This is free software, and you are welcome to redistribute it
> under certain conditions. See the file COPYING for details.
>
> Home: ~/.gnupg
> Supported algorithms:
> Pubkey: RSA, RSA-E, RSA-S, ELG-E, DSA
> Cipher: 3DES (S2), CAST5 (S3), BLOWFISH (S4), AES (S7), AES192 (S8),
>         AES256 (S9), TWOFISH (S10)
> Hash: MD5 (H1), SHA1 (H2), RIPEMD160 (H3), SHA256 (H8), SHA384 (H9),
>       SHA512 (H10)
> Compression: Uncompressed (Z0), ZIP (Z1), ZLIB (Z2)
>
> HTH,
> --
> Alphax                      |   /"\
> Encrypted Email Preferred   |   \ /     ASCII Ribbon Campaign
> OpenPGP key ID: 0xF874C613  |    X   Against HTML email & vCards
> http://tinyurl.com/cc9up    |   / \
>

--
Axel



More information about the Gnupg-users mailing list