Mailing List Archive

tcsh command line completion for gpg
Hi!

Here is some code to do command line completion for gpg when using
tcsh.

The goal is to save you some typing when using gpg.

gpg -[TAB]
will complete with all the the option names that start with a -

gpg --[TAB]
will complete with all the options that start with --

gpg --digest-algo[TAB]
will complete with all the digest algorithms names.


You should change the gpg_keyservers variable to contain the
keyservers that you use...

I could add completion for the --recipient option, but I don't know
how to get that information (it can be done with a shell command)...

If people find this usefull, it could be added to the gpg
distribution...

Add the following to your .cshrc and try it.


if ($?tcsh) then

set noglob

set gpg_keyservers = (wwwkeys.pgp.net ANOTHER_KEYSERVER)

complete gpg c/--/"(sign clearsign detach-sign encrypt symmetric \
store decrypt verify list-keys list-sigs check-sigs \
fingerprint list-secret-keys gen-key delete-key \
delete-secret-key sign-key lsign-key edit-key gen-revoke\
export send-keys recv-keys import list-packets \
export-ownertrust import-ownertrust update-trustdb \
check-trustdb fix-trustdb dearmor enarmor print-md armor\
recipient default-recipient default-recipient-self \
local-user textmode output verbose quiet no-tty \
force-v3-sigs force-mdc dry-run batch yes no keyring \
secret-keyring default-key keyserver charset options \
status-fd load-extension rfc1991 openpgp s2k-mode \
s2k-digest-algo s2k-cipher-algo cipher-algo digest-algo \
compress-algo throw-keyid notation-data help)"/\
c/-/"(s b e c d a r u z o v q n N -)"/\
n/{-z,--s2k-mode,--compress-algo}/"(0 1 2 3 4 5 6 7 8 9)"/\
n/{--digest-algo,--print-md,--s2k-digest-algo}\
/"(md5 sha1 ripemd160)"/\
n/{-u,--local-user}/u/\
n/{--cipher-algo,--s2k-cipher-algo}/"(3des cast5 blowfish \
rsa twofish elg-e dsa elg)"/\
n/{--keyserver}/\$gpg_keyservers/


unset noglob
endif


--dan

--
Archive is at http://lists.gnupg.org - Unsubscribe by sending mail
with a subject of "unsubscribe" to gnupg-users-request@gnupg.org
Re: tcsh command line completion for gpg [ In reply to ]
On Wed, 6 Sep 2000, Dan Nicolaescu wrote:

>
> complete gpg c/--/"(sign clearsign detach-sign encrypt symmetric \
> store decrypt verify list-keys list-sigs check-sigs \
> fingerprint list-secret-keys gen-key delete-key \
> delete-secret-key sign-key lsign-key edit-key gen-revoke\
> export send-keys recv-keys import list-packets \


Did you know that you can get the list of all gnupg options by using
gpg --dump-options. Maybe this helps, also I don't know anything
about tcsh completion feature.

My idea is that --dump-option caan be used to put all options into a
special ELF segment, so that the shell can get the options without
the overhead of running the process first.

Werner


--
Werner Koch GnuPG key: 621CC013
OpenIT GmbH http://www.OpenIT.de

--
Archive is at http://lists.gnupg.org - Unsubscribe by sending mail
with a subject of "unsubscribe" to gnupg-users-request@gnupg.org