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

PATCH: _mplayer, _gpg and _ecasound

I'm now going to commit these three completion functions which were all
posted some time ago but never committed before due to being unfinished
or whatever:

  _ecasound - posted by Mario Lang in 13691, modified by Sven (13701)
              I've based this on what was on his web site though.
  _gpg      - posted by Bruno Bonfils in 15822 and 15838
  _mplayer  - both Bruno Bonfils (16380, 16541) and
              GoTaR <gotar@xxxxxxxxxxxxxx> (users/6013) posted functions
	      I merged the best of both

I've made a good number of my own changes to them, especially where
they were unfinished. Plenty of scope remains for further improvements
though. Both gpg and mplayer have way too many options so I left
descriptons off those which are either obscure or had long descriptive
names anyway.


#compdef ecasound

local curcontext="$curcontext" state line expl
typeset -A opt_args

_arguments \
  '-c[start in interactive mode]' \
  '(-q)-d\:-[debug level]:debug level' \
  '-D[print all debug information to stderr]' \
  '(-d)-q[quiet mode, no output]' \
  '(-)--help[show usage information]' \
  '(-)--version[show version information]' \
  '-n\:-[set the name of chainsetup]:chainsetup name' \
  '-s\:-[create a new chainsetup from file]:chainsetup file:_files' \
  '-sr\:-[set internal sampling rate]:Internal sampling rate:(8000 11025 22050 44100 48000)' \
  '*-a\:-[select active signal chains]:chain name' \
  '-b\:-[set the size of buffer in samples]:buffer size:->b' \
  '-m\:-[force use of specified mix mode]:Mix mode:((auto\:Automatic simple\:Only\ one\ input/cain/output normal\:Normal\ single-threaded\ mode))' \
  '-r[use realtime scheduling policy (SCHED_FIFO)]' \
  '-r\:-[use realtime scheduling policy (SCHED_FIFO)]:sched_priority' \
  '-x[truncate outputs]' \
  '*-z\:-[enable feature]:feature:->z' \
  '-t\:-[set processing time in seconds]:seconds (int/float)' \
  '-tl[enable looping]' \
  '*-f\:-[set sampling parameters for the following input/output files]: :->f' \
  '*-y\:-[set starting position for last specified input/output]:seconds' \
  '*-i\:-[specifies a new input source]:input source:->io' \
  '*-o\:-[specifies a new output source]:output source:->io' \
  '*-Md\:-[set the active MIDI-device]:device name:_files' \
  '*-Mms\:-[send MMC start/stop to MIDI device-id]:device id' \
  '*-mss[sends MIDI-sync to the selected MIDI-device]' \
  '*-pf\:-[use the first preset found from file as chain operator]:preset file:_files -g *.epp' \
  '*-pn\:-[find preset from global preset database]:preset name:->pn' \
  '*-ev[analyze sample data to find max apm value without clipping]' \
  '*-ezf[find the optimal value for DC-adjusting]' \
  '*-eS\:-[audio stamp]:stamp-id (int)' \
  '*-ea\:-[amplify signal]:amplification value (percent)' \
  '*-eac\:-[amplify signal of channel]: :->eac' \
  '*-eaw\:-[amplify singal (clipping)]: :->eaw' \
  '*-eal\:-[limits audio level]:limit (percent)' \
  '*-ec\:-[compressor (a simple one)]: :->ec' \
  '*-eca\:-[a more advanced compressor]: :->eca' \
  '*-enm\:-[noise gate. (each channel is processes separately)]: :->enm' \
  '*-ei\:-[pitch shifter (modifies audio pitch by altering its length)]:pitch-shift (percent)' \
  '*-epp\:-[normal pan effect]:panning (0=left, 50=center, 100=right)' \
  '*-ezx\:-[adjusts the signal DC (use -ezf to find optimal values)]: :->ezx' \
  '*-eem-[envelope modulation]: :->emod' \
  '*-ef-[apply filter effects]: :->filters' \
  '*-erc\:-[copy channel]: :->erc' \
  '*-erm\:-[mix all channels to one channel]:to channel' \
  '*-et-[time based effects]: :->teffects' \
  '*-el\:-[LADSPA Plugin]: :->el' \
  '*-eli\:-[LADSPA Plugin]: :->el' \
  '*-gc\:-[time crop gate]: :->gc' \
  '*-ge\:-[threshold gate]: :->ge' \
  && return 0

case $state in
    _values -S : 'filter effect' \
      '1[resonant bandpass filter]: :->ef1' \
      '3[resonant lowpass filter]: :->ef3' \
      '4[resonant lowpass filter (3rd-order, 36dB)]: :->ef4' \
      'a[allpass filter]: :->efa' \
      'c[comb filter]: :->efc' \
      'b[bandpass filter]: :->efb' \
      'h[highpass filter]:cutoff frequency' \
      'i[inverse comb filter]: :->efi' \
      'l[lowpass filter]:cutoff frequency' \
      'r[bandreject filter]: :->efr' \
      's[resonator (resonating bandpass filter)]: :->efs'
    _values -S : 'time based effect' \
      'c[chorus]: :->etc' \
      'd[delay effect]: :->etd' \
      'e[a more advanced reverb effect]: :->ete' \
      'f[fake-stereo effect]:delay time (msec)' \
      'l[flanger]: :->etl' \
      'm[multitap delay]: :->etm' \
      'p[phaser]: :->etp' \
      'r[reverb effect]: :->etr'
    _values -S : 'envelopme modulation' \
      'b[pulse gate]: :->eemb' \
      'p[pulse gate (hz)]: :->eemp' \
      't[tremolo effect]: :->eemt'

case $state in
    _wanted -V sizes expl 'buffer size' compadd \
        1 2 4 8 16 32 64 128 256 512 1024 2048 4096 8192 16384 32768 65536
    if compset -P '*,*,*,'; then
      _values 'interleaving' \
        'i[interleaved stream format]' \
    elif compset -P '*,*,'; then
      _message 'sampling rate'
    elif compset -P '*,'; then
      _message 'channels'
      _values 'sampling parameters' \
        'u8[unsigned 8-bit]' \
	's16_le[signed 16-bit little endian]' \
	's16_be[signed 16-bit big endian]' \
	's24_le[signed 24-bit little endian]' \
	's24_be[signed 24-bit big endian]' \
	's32_le[signed 32-bit little endian]' \
	's32_be[signed 32-bit big endian]' \
	'f32_le[32-bit float (little endian)]' \
	'f32_be[32-bit float (big endian)]'
    _values -s , feature \
      '(nodb)db[enable double-buffering]' \
      '(db)nodb[disable double-buffering]' \
      'dbsize[set db buffer size]:buffer size in sample frames:(0 1 2 4 8 16)' \
      '(nointbuf)intbuf[use extra internal buffering for realtime devices]' \
      '(intbuf)nointbuf[prevent extra internal buffering for realtime devices]' \
      'xruns[processing will be halted when a under/overrun occurs]' \
      'psr[enable the precise-sample-rates]'
    if compset -P 'alsa,'; then
      if [[ -e /proc/asound ]]; then
	eval `grep "^[[:digit:]]" < /proc/asound/cards|awk 'BEGIN {print "_values '\''ALSA device'\''" }; {print "'\''" $1 "[" $6, $7, $8, $9 "]'\''"}'||echo _message Wrong`
	_message 'ALSA information bot found in proc filesystem'
      _alternative \
        'files:input/output file:_files -g "*.(aif|aiff|mid|wav|ewf|mp3|mp2)"' \
        'streams:stream:(stdin stdout)' \
	'devices:realtime device:((/dev/dsp alsa\:alsa\ device null\:null\ device))'
    _wanted presets expl preset compadd \
        ${${(M)${(f)"$(</usr/share/ecasound/effect_presets)"}:#[a-z]*}%% *}
    if compset -P 3 '*,'; then
      _message 'mix (wet) (percent)'
    elif compset -P 2 '*,'; then
      _message 'number of delays'
    elif compset -P '*,'; then
      _values -s , 'surround mode' \
              '0[normal]' \
              '1[surround]' \
      _message 'delay time (msec)'
    if compset -P 2 '*,'; then
      _values 'volume mode'
    elif compset -P '*,'; then
      _message 'close threshold (percent)'
      _message 'open threshold (percent)'
    # all the rest are comma separated lists for which we use a message prompt
    typeset -A msgs
    local str
      eac  'amplification value (percent):channel'								     				  
      eaw  'amplification value (percent):channel:max-clipped-samples'						     				  
      ec   'compression rate (decibels):threshold (0.0-1.0)'							     				  
      eca  'peak-level:release-time (seconds):fast compression rate (0.0-1.0):compression rate'		     				  
      enm  'threshold-level:pre-hold-time (msec):attack-time (msec):post-hold-time (msec):release-time (msec)'     				  
      ezx  'left DC fix value:right CD fix value'								     				  
      eemb 'pulse frequency (beats per minute):on time (msec)'
      eemp 'pulse frequency (hz):on time (percent)'
      eemt 'tremolo speed (beats per second):depth (percent)'
      ef1  'center frequency:width (Hz)'
      ef3  'cutoff frequency:resonance:gain'
      ef4  'cutoff:resonance'
      efa  'delay (samples):feedback (percent)'
      efc  'delay (samples):radius (0-1.0)'
      efb  'center frequency:width (Hz)'
      efi  'delay (samples):radius (0-1.0)'
      efr  'center frequency:width (Hz)'
      efs  'center frequency:width (Hz)'
      erc  'from channel:to channel'
      etc  'delay time (msec):variance time (samples):feedback (percent):lfo frequency'
      ete  'room size (metres):feedback level (percent):amount of reverbed signal added to the original (wet) (percent)'
      etl  'delay time (msec):variance time (samples):feedback (percent):lfo frequency'
      etm  'delay time (msec):number of delays:mix (wet) (percent)'
      etp  'delay time (msec):variance time (samples):feedback (percent):lfo frequency'
      etr  'delay time (msec):surround mode:feedback (percent)'
      el   'unique LADSPA name/number'
      gc   'start time (seconds):length (seconds)'
    while compset -P 1 '*,'; do
    _message "${str%%:*}"
#compdef mplayer gmplayer

local suf ret=1 curcontext="$curcontext"
local -a vals state line

_x_arguments -C -s \
  '!-abs:buffer size' \
  '-ac[force usage of a specific audio codec]:audio codec attachment:->audio-codecs' \
  '-af[activate audio filters]:filter' -af-adv:option \
  '-afm[force usage of a specific audio codec family]:audio codec family:->audio-codec-families' \
  '-aid:audio channel id' \
  '-alang[select the DVD audio language]:country code' \
  '(-nosound)-ao[specify audio driver]:audio-driver attachment:->audio-drivers' \
  '-aofile:file:_files' \
  '(-nosound)*-aop[specify audio output filter]:audio output filter:->audio-plugins' \
  '-aspect:ratio' \
  '-audiofile:audio file:_files -g "(#i)*.(wav|mp3|ogg)"' \
  -autoq:quality -autosync:factor \
  -bandwidth:bandwidth\ value -benchmark -bpp:depth \
  '(-nocache)-cache:cache size (kb)' \
  '-cdda:audio CD options:(spped paranoia generic-dev sector-size overlap toc-bias toc-offset skip noskip)' \
  '-cdrom-device:cdrom device:_files -g "*(-%b)"' \
  '-channels:playback channels:((2\:stereo 4\:surround 6\:full\ 5.1))' \
  '-chapter:chapter' -contract:value \
  '-csslib:libcss.so location:_files' \
  -cuefile -delay:delay -demuxer:number -dfbopts:value \
  '(-nodouble)-double[enable double buffering]' \
  '-dr[enable direct rendering]' \
  -dxr2:option -dumpaudio -dumpstream -dumpvideo \
  '-dumpfile:output file:_files' \
  -dumpmicrodvdsub -dumpmpsub -dumpsrtsub -dumpjacosub -dumpsami -dumpsub \
  '-dvd:title id' '-dvdauth:DVD device' \
  '-dvd-device:dvd device:_files -g "*(-%b)"' \
  '-dvdangle:angle id' '-dvdkey:key' \
  '-edl:edl file:_files' '-edlout:edl file:_files' -enqueue \
  '-fbmode:video mode' '-fbmodeconfig:config file:_files' \
  '-fb[specify framebuffer device to use]:device:_files -g "*(-%b)"' \
  '-ffactor:factor:(0 0.75 1 10)' \
  -flip '-font:font.desc file:_files' -forceidx -forcexv -format:format \
  '-fps[force frame rate]:frame-rate' \
  '-framedrop' \
  '-frames:frame number' \
  '-fs[fullscreen]' -fstype:type \
  -gui -{,gui}'wid:X window:_x_window' \
  {-h,-help,--help}'[display help info]' \
  -hardframedrop \-hr-mp3-seek \
  '-hue:video signal hue adjustment' \
  '(-rootwin)-icelayer:icewm layer:((0\:Desktop 2\:Below 4\:Normal 6\:OnTop 8\:Dock 10\:AboveDock 12\:Menu))' \
  '(-use-stdin)-idx[rebuild index of the avi]' \
  '-ifo:ifo file:_files' '-include:config-file:_files' \
  '-input:command:(conf ar-delay ar-rate keylist cmdlist js-dev file)' \
  '-jpeg:option' -lavdopts:option \
  '-lircconf:lirc config file:_files' '-loop:repetitions' \
  '-mc[specify max sync correction]:max sync correction' \
  '-mf[specify option when decoding multiple PNG or JPEG files]:option' \
  '-mixer:mixer device:_files -g "*(-%b)"' \
  '-monitoraspect:ratio' -monitor_dotclock -monitor_{h,v}freq:frequency \
  '-ni[force usage of non-interlaced avi parser]' \
  -noaspect -noautosub -overlapsub -nooverlapsub -nowaveheader \
  '(-cache)-nocache' -nobps \
  '(-double)-nodouble' -nodshow -noextbased -noframedrop \
  -nograbpointer -nokeepaspect -noslices -nojoystick -nolirc -nortc \
  '(-ao -aop)-nosound' \
  '-osdlevel:osd-level:((0\:subtitles\ only 1\:volume\ +\ seek 2\:volume\ +\ seek\ +\ timer\ +\ percentage 3\:volume\ +\ seek\ +\ timer\ +\ percentage\ +\ total\ time))' \
  -panscan:value \
  '-passwd[specify password for http authentication]:password' \
  '-playlist:file:_files' \
  '-pp[apply postprocess filter]:filter attachment' -pphelp \
  -quiet -really-quiet -rootwin \
  -rawaudio:option -rawvideo:option \
  '-rtsp-stream-over-tcp' -saturation:value \
  '-sb[seek to byte position]:byte' \
  -screen{w,h}:pixels \
  '-sdp[input file is a SDP file]' -shuffle \
  '-skin[skin directory]:skin directory:_directories' \
  -skipopening -slave \
  '-sid[turn on DVD subtitles]:language id' \
  '-speed[set playback speed rate]:playback speed rate' \
  '-srate[specify frequency of audio playback]:frequency (Hz)' \
  '-ss[seek to given time position]:position (hh:mm\[:ss\])' \
  '-sstep[specify time between displayed frames]:time (seconds)' \
  -ssf:mode -stop_xscreensaver \
  '-stereo:mode:((0\:stereo 1\:left\ channel 2\:right\ channel))' \
  '-sub[use specified subtitle file]:subtitle file:_files' \
  -subfps:rate -sub-bg-alpha:value -sub-bg-color:value -subcc  -subcp:codepage -subdelay:seconds \
  -subpos:vertical\ position -s{ub,pu}'align:alignment:((0\:top 1\:center 2\:bottom))' \
  '-subfont-autoscale:mode:((0\:no\ autoscale 1\:proportional\ to\ height 2\:proportional\ to\ width 3\:proportional\ to\ diagonal))' \
  -subfont-blur:radius -subfont-encoding:encoding -subfont-osd-scale:coefficient -subfont-outline:thickness -subfont-text-scale:coefficient \
  -sub-no-text-pp -spuaa:mode  -spugauss:gauss -sws:scalar\ type \
  '-tv[TV grabbing]:option' \
  -unicode -utf8 \
  '-user[specify username for http authentication]' \
  '(-idx)-use-stdin' \
  '-vcd[play video cd track]:track' \
  '-vc[force usage of a specific video codec]:video-codec attachment:->video-codecs' \
  '-v[enable verbose output]' \
  '*-vf[video output filters]:video output filters:->video-output-plugins' \
  '-vfm[force usage of a specific video codec family]:video-codec-family:(1 2 3 4 5)' \
  '-vid[select video channel]:video-channel' \
  '-vm[try to change to a better video mode]' \
  '-vo[specify video driver]:video-driver attachment:->video-drivers' \
  '-vop[specify video output filters]:video output filters:->video-output-plugins' \
  -vobsub:vobsub\ file -vobsubid:id -vsync \
  '-x[scale image to x width if driver supports]:width' \
  -xineramascreeen:screen -xvidopts:option \
  '-xy[scale image by factor if driver supports]:factor' \
  '-y[scale image to y height if driver supports]:height' \
  '-z[specify compression level for png output]:compression-level:((0\:no\ compression 1 2 3 4 5 6\:default\ compression 7 8 9\:max\ compression))' \
  '-zoom[use software scaling, where available (use with -nofs)]' \
  -zrbw -zrcrop -zrdev -zrfd -zrhelp -zrnorm -zrquality -zr{h,v}dec -zr{x,y}doff \
  '(-use-stdin)*:video file:->mfiles'

case "$state" in
    _tags files urls
    while _tags; do
      _requested files expl 'video file' _files -g \
          "*.(#i)(avi|mp3|mpg|mpe|mpeg|m1v|mov|asf|vob|mjpg|wma|wmv|asx|qt|rm)" && ret=0
      if _requested urls; then
        while _next_label urls expl url; do
          _urls "$expl[@]" && ret=0
	  compadd -S '' "$expl[@]" {dvd,vcd,cdda,cddb,tv}:// && ret=0
      (( ret )) || return 0
    vals=( help ${${${(f)"$(_call_program audio-codecs $words[1] -ac help -quiet 2>/dev/null)"}[(r)ac:*,-1]}[2,-1]/ ##[^ ]# #[^ ]# #/:} )
    _describe -t audio-codecs 'audio codec' vals && ret=0
    vals=( help ${${${(f)"$(_call_program audio-drivers mplayer -ao help 2>/dev/null)"}[(r)	*,-1]#?}/	/:} )
    _describe -t audio-drivers 'audio drivers' vals && ret=0
    compset -P '*,'
    compset -S ',*'
    vals=( help ${${${(f)"$(_call_program audio-codec-families mplayer -afm help 2>/dev/null)"}[(r) [^:]#,-1]## ##}/ ##/:} )
    _describe -t audio-codec-families 'audio drivers' vals && ret=0
    _values -s : 'audio output plugin' \
      'list[specify list of plugins]:plugin:(resample surround format volume extrastereo volnorm delay)' \
      'format[output format]:format' \
      'fout[output frequency]:frequency (Hz)' \
      'volume[volume level]:volume <0-255>' \
      'mul[stereo coefficient]:coefficient' \
      'softclip[compressor]' && ret=0
    vals=( help ${${${(f)"$(_call_program audio-codecs $words[1] -vc help -quiet 2>/dev/null)"}[(r)vc:*,-1]}[2,-1]/ ##[^ ]# #[^ ]# #/:} )
    _describe -t video-codecs 'video codec' vals && ret=0
    vals=( help ${${${(f)"$(_call_program video-drivers mplayer -vo help 2>/dev/null)"}[(r)	*,-1]#?}/	/:} )
    _describe -t video-drivers 'video drivers' vals && ret=0
    vals=( help ${${${${(f)"$(_call_program video-output-plugins mplayer -vop help 2>/dev/null)"}[(r)	*,-1]}/	/}/ #: /:} )
    _describe -t video-output-plugins 'video output plugin' vals && ret=0

return ret
#compdef gpg gpgv

local curcontext="$curcontext" state line expl
typeset -A opt_args

_arguments -C -s -S -A "-*" \
  '(-s --sign)'{-s,--sign}'[make a signature]' \
  '--clearsign[make a clear text signature]' \
  '(-b --detach-sign)'{-b,--detach-sign}'[make a detached signature]' \
  '(-e --encrypt)'{-e,--encrypt}'[encrypt data. this option may be combined  with --sign]' \
  '(-c --symmetric)'{-c,--symmetric}'[encrypt with symmetric cypher only]' \
  '--store[store only]' \
  '--decrypt[decrypt file or stdin]' \
  '--verify[verify a signature]:file attachment:_files' \
  '--verify-files[verify a list of files]:_files attachment_files' \
  '(-f --encrypt-files)'{-f,--encrypt-files}'[encrypt files]' \
  '--decrypt-files[decrypt files]' \
  '--list-keys[list all keys]' \
  '--list-public-keys[list all public keys]' \
  '--list-secret-keys[list all secret keys]' \
  '--list-sigs[lists keys and signatures]:key attachment:_pub-keys-list' \
  '--check-sigs[lists key, signatures and check them]:key attachment:_pub-keys-list' \
  '--fingerprint[list all keys with their fingerprints]:key attachment:_pub-keys-list' \
  '--list-packets[list only the sequence of packets]' \
  '--gen-key[generate a new pair key]' \
  '--edit-key[a menu for edit yours keys]:key attachment:_pub-keys-list' \
  '--sign-key[sign a key]:key attachment:_pub-keys-list '\
  '--lsign-key[sign a key but mark as non-exportable]:key attachment:_pub-keys-list' \
  '--nrsign-key[sign a key non-revocably]' \
  '--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:key attachment:_sec-keys-list' \
  '--gen-revoke[generate a revocation certificate]' \
  '--desig-revoke[generate a designated revocation certificate]' \
  '--export[export all key from all keyrings]' \
  '--send-keys[send keys to a keyserver]:key attachment:_pub-keys-list' \
  '--export-all[export all key and not OpenPGP compatible keys]' \
  '--export-secret-keys:key attachment:_sec-keys-list' \
  '--export-secret-subkeys:key attachment:_sec-keys-list' \
  '--import[import a gpg key from a file]:_files attachment:_files' \
  '--fast-import[import a file without build trustdb]:_files attachment:_files' \
  '--recv-keys[receive a list of keys from a keyserver]:key attachment:_pub-keys-list' \
  '--refresh-keys[update all keys from a keyserver]' \
  '--search-keys[search for keys on a key server]' \
  '--update-trustdb[update the trust database]' \
  '--check-trustdb[unattended trust database update]' \
  '--fix-trustdb[fix a corrupted trust database]' \
  '--export-ownertrust[list the assigned ownertrust values in ASCII format]:file:_files' \
  '--import-ownertrust[update the trustdb with a file]:file:_files' \
  '--dearmor[de-Armor a file or stdin]' \
  '--enarmor[en-Armor a file or stdin]' \
  '--print-md[print message digests]:algorithm:->ciphers::file:_files' \
  '--print-mds[print message digests]::file:_files' \
  '--gen-random:count' --gen-prime \
  '--version[print info on program version and supported algorithms]' \
  '--warranty[print warranty info]' \
  '(-h --help)'{-h,--help}'[display usage information]' \
  '(-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'\
  '--default-key[specify default user-id for signatures]:key:->secret-key' \
  '*'{-r+,--recipient}'[specify user to encrypt for]:recipient:->public-key' \
  '--default-recipient[specify default recipient]:recipient:->public-key' \
  '--default-recipient-self[use default key as default recipient]' \
  '--no-default-recipient[reset default recipient]' \
  '*--encrypt-to[specify recipient]:->public-key' \
  '(--encrypt-to)--no-encrypt-to[disable the use of all --encrypt-to keys]' \
  '(-q --quiet)*'{-v,--verbose}'[increase amount of output]' \
  '(-q --quiet -v --verbose)'{-q,--quiet}'[reduce amount of output]' \
  '(-z --compress)'{-z,--compress}'[specify compression level]:compression level:((0\:no\ compression 1\:minimum 2 3 4 5 6\:default 7 8 9\:maximum))' \
  '(-t --textmode)'{-t,--textmode}'[use canonical text mode]' \
  '(-n --dry-run)'{-n,--dry-run}"[don't make any changes]" \
  '(-i --interactive --batch)'{-i,--interactive}'[prompt before overwriting files]' \
  '(-i --interactive --no-batch)--batch[use batch mode]' \
  '--no-tty[never output to tty]' \
  '(--batch)--no-batch[disable batch mode]' \
  '(--no)--yes[assume "yes" on most questions]' \
  '(--yes)--no[assume "no" on most questions]' \
  '--default-cert-check-level:check level:((0\:no\ claim 1\:no\ verification 2\:casual\ verification 3\:extensive\ verification))' \
  '--trusted-key[assume that the specified key is trustworthy]:long key id' \
  '--always-trust[skip key validation]' \
  '--keyserver[specify key server to use]:key server:_hosts' \
  '--keyserver-options[specify keyserver options]:options' \
  '--import-options[specify options for importing keys]:options' \
  '--export-options[specify options for exporting keys]:options' \
  --show-photos --no-show-photos '--photo-viewer:command:_command_names -e'\
  --exec-path:path:_dir_list' \
  --show-keyring[display keyring name when listing keys]' \
  '--keyring[add specified file to list of keyrings]:file' \
  '--secret-keyring[add specified file to list of secret keyrings]:file' \
  --homedir:directory:_directories \
  '--charset:character set:(iso-8859-1 iso-8859-2 koi8-r utf-8)' \
  '--utf8-strings' '--no-utf8-strings[arguments are not in UTF8]' \
  '(--no-options)--options[specify file to read options from]:options file:_files' \
  "(--options)--no-options[don't read options file]" \
  --{status,logger,attribute,passphrase,command}-fd:file\ descriptor:_file_descriptors \
  '--sk-comments[include secret key comments when exporting keys]' \
  '(--emit-version)--no-version[omit version string in clear text signatures]' \
  '(--no-version)--emit-version[force writing of version string in clear text signatures]' \
  '(-N --notation-data)'{-N,--notation-data}'[put parameter in signature]:name=value' \
  '(--no-show-notation)--show-notation[show key signature notations]' \
  "(--show-notation)--no-show-notation[don't show key signature notations]" \
  '--set-policy-url:policy url' \
  '(--no-show-policy-url)--show-policy-url' \
  "(--show-policy-url)--no-show-policy-url" \
  '--set-filename[specify file which is stored in messages]:file:_files' \
  '(--for-your-eyes-only)--for-your-eyes-only' \
  "(--for-your-eyes-only)--no-for-your-eyes-only" \
  --completes-needed:number --marginals-needed:number --max-cert-depth:number \
  --{{,disable-,s2k-}cipher,{,s2k-,cert-}digest,disable-pubkey}'-algo:cipher:->ciphers' \
  --s2k-mode:value --simple-sk-checksum \
  '--compress-algo:compression algorithm:((0\:disable\ compression 1\:zlib 2\:rfc1950))' \
  --no-sig-cache --no-sig-create-check --{,no-}auto-check-trustdb --throw-keyid \
  --not-dash-escaped --escape-from-lines --use-agent \
  --rfc1991 --{,no-}pgp2 --{,no}pgp6 --{,no}pgp7 --openpgp \
  --{,no-}force-v3-sigs --{,no}force-v4-certs --force-mdc --disable-mdc \
  --{,no-}allow-non-selfsigned-uid --allow-freeform-uid \
  --ignore-time-conflict --ignore-valid-from \
  --ignore-crc-error --ignore-mdc-error --lock-once --lock-multiple --lock-never \
  --no-random-seed-file --no-verbose --no-greeting --no-secmem-warning \
  --no-permission-warning --no-mdc-warning --no-armor --no-default-keyring \
  --skip-verify --with-colons --with-key-data --with-fingerprint \
  --fast-list-mode --fixed-list-mode --list-only --no-literal --set-filesize \
  --emulate-md-encode-bug --show-session-key --override-session-key:string \
  --{,no-}ask-sig-expire --{,no}ask-cert-expire --{,no}expert \
  --merge-only --allow-secret-key-import --try-all-secrets \
  --enable-special-filenames --no-expensive-trust-checks --group:name=value \
  --preserve-permissions --personal-{cipher,digest,compress}-preferences:string \
  --default-preference-list:string \
  '*:args:->args' && return

if [[ $state = args ]]; then
  if (( ${+opt_args[--export]} || ${+opt_args[--list-keys]} )); then
  elif (( ${+opt_args[--list-secret-keys]} )); then
    _files && return

case "$state" in
    _wanted public-keys expl 'public key' \
	compadd ${${(Mo)$(gpg --list-keys 2>/dev/null):%<*>}//(<|>)/} && return
    _wanted secretkeys expl 'secret key' compadd \
	${${(Mo)$(gpg --list-secret-keys 2>/dev/null):%<*>}//(<|>)/} && return
    _wanted ciphers expl cipher compadd \
        ${${(s.,.)${(M)${(f)"$(gpg --version)"}:#Cipher*}#*:}# } && return

return 1

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