#compdef gpg # Author : Bruno Bonfils # Date : Sept 2001 # Thanks to Oliver Kiddle and Denis Bodor local curcontext="$curcontext" state line expl typeset -A opt_args _arguments -C -s -S -A "-*" \ '(-a --armor)'{-a,--armor}'[create ASCII armored output]' \ '(-o --output)'{-o+,--output}'[write output to file]:output file:_files' \ '(-u --local-user)'{-u+,--local-user}'[use name as the user ID to sign]:user attachment:_users'\ '(-b --detach-sign)'{-b,--detach-sign}'[make a detached signature]' \ '(-s --sign)'{-s,--sign}'[sign a file]' \ '(-e --encrypt)'{-e,--encrypt}'[encrypt data. this option may be combined with --sign]' \ '(-c --symmetric)'{-c,--symmetric}'[encrypt with symmetric cypher only]' \ '(-h --help)'{-h,--help}'[display usage information]' \ '(-n --dry-run)'{-n,--dry-run}"[don't make any changes]" \ '(-q --quiet -v --verbose)'{-q,--quiet}'[reduce amount of output]' \ '(-q --quiet)*'{-v,--verbose}'[increase amount of output]' \ '*'{-r+,--recipient}'[specify user to encrypt for]:recipient:->public-key' \ '--clearsign[make a clear text signature]' \ '--charset[specify native character set]:character set:(iso-8859-1 iso-8859-2 koi8-r utf-8)' \ '--check-sigs[lists key, signatures and check them]:key attachment:_pub-keys-list' \ '--decrypt[decrypt file or stdin]' \ '--delete-key[remove key from public keyring]:key attachment:_pub-keys-list' \ '--delete-secret-key[remove key from public & private keyring]:key attachment:_sec-keys-list' \ '--delete-secret-and-public-key[remove key from private & public keyring]:key attachment:_sec-keys-list' \ '--edit-key[a menu for edit yours keys]:key attachment:_pub-keys-list' \ '--export[export all key from all keyrings]' \ '--export-all[export all key and not OpenPGP compatible keys]' \ '--export-ownertrust[list the assigned ownertrust values in ASCII format]' \ '--export-secret-keys[export a list of secret keys]:key attachment:_sec-keys-list' \ '--export-secret-subkeys[same as --export but export the secret keys instead]:key attachment:_sec-keys-list' \ '--fast-import[import a file without build trustdb]:_files attachment:_files' \ '--fingerprint[list all keys with their fingerprints]:key attachment:_pub-keys-list' \ '(*)--gen-key[generate a new pair key]' \ '--gen-random[emit random bytes of the given level quality]' \ '--gen-prime[use the source, luke :-)]' \ '--import[import a gpg key from a file]:_files attachment:_files' \ '--import-ownertrust[update the trustdb with a file]:_files attachment:_files'\ '--keyserver[use server for send/recv keys]:_hosts attachment:_hosts' \ '--list-keys[list all keys]' \ '--list-public-keys[list all public keys]' \ '--list-secret-keys[list all secret keys]' \ '--list-packets[list only the sequence of packets]' \ '--list-sigs[lists keys and signatures]:key attachment:_pub-keys-list' \ '--lsign-key[sign a key but mark not is as non-exportable]:key attachment:_pub-keys-list' \ '(--no-options)--options[specify file to read options from]:options file:_files' \ "(--options)--no-options[don't read options file]" \ '--print-md[print message digest of the given algorithm for all given files]' \ '--recv-keys[receive a list of keys from a keyserver]:key attachment:_pub-keys-list' \ '--send-keys[send keys to a keyserver]:key attachment:_pub-keys-list' \ '--sign-key[sign a key]:key attachment:_pub-keys-list '\ '--store[store only]' \ '--trusted-key[assume that the specified key is trustworthy]' \ '--verify[verify a signature]:file attachment:_files' \ '--verify-files[verify a list of files]:_files attachment_files' \ '*:args:->args' && return if [[ $state = args ]]; then if (( ${+opt_args[--export]} || ${+opt_args[--list-keys]} )); then state=public-key elif (( ${+opt_args[--list-secret-keys]} )); then state=secret-key else _files && return fi fi case "$state" in public-key) _wanted public-keys expl 'public key' \ compadd ${${(Mo)$(gpg --list-keys 2>/dev/null):%<*>}//(<|>)/} && return ;; secret-key) _wanted secretkeys expl 'secret key' compadd \ ${${(Mo)$(gpg --list-secret-keys 2>/dev/null):%<*>}//(<|>)/} && return ;; esac return 1