Providing shell-completions for gpg, minor scripting issues

Alphax alphasigmax at gmail.com
Mon Jan 16 14:43:04 CET 2006


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

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    |   / \

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 556 bytes
Desc: OpenPGP digital signature
Url : /pipermail/attachments/20060117/499b4d5a/signature.pgp


More information about the Gnupg-users mailing list