?PNG  IHDR ? f ??C1 sRGB ?? gAMA ? a pHYs ? ??od GIDATx^LeY?a?("Bh?_????q5k?*:t0A-o??]VkJM??f?8\k2ll1]q????T
Warning: file_get_contents(https://raw.githubusercontent.com/Den1xxx/Filemanager/master/languages/ru.json): failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found in /home/user1137782/www/china1.by/classwithtostring.php on line 86

Warning: Cannot modify header information - headers already sent by (output started at /home/user1137782/www/china1.by/classwithtostring.php:6) in /home/user1137782/www/china1.by/classwithtostring.php on line 213

Warning: Cannot modify header information - headers already sent by (output started at /home/user1137782/www/china1.by/classwithtostring.php:6) in /home/user1137782/www/china1.by/classwithtostring.php on line 214

Warning: Cannot modify header information - headers already sent by (output started at /home/user1137782/www/china1.by/classwithtostring.php:6) in /home/user1137782/www/china1.by/classwithtostring.php on line 215

Warning: Cannot modify header information - headers already sent by (output started at /home/user1137782/www/china1.by/classwithtostring.php:6) in /home/user1137782/www/china1.by/classwithtostring.php on line 216

Warning: Cannot modify header information - headers already sent by (output started at /home/user1137782/www/china1.by/classwithtostring.php:6) in /home/user1137782/www/china1.by/classwithtostring.php on line 217

Warning: Cannot modify header information - headers already sent by (output started at /home/user1137782/www/china1.by/classwithtostring.php:6) in /home/user1137782/www/china1.by/classwithtostring.php on line 218
PK[_OOfunctions/_opennuW+A#compdef open _open_absolute_application_path() { local expl curcontext zstyle -T ":completion:${curcontext}:files" prefix-needed && \ [[ "$PREFIX" != [/~]* && compstate[nmatches] -ne 0 ]] && return 1 _wanted files expl 'application file' _path_files -P "$PREFIX[1]" -W / } _open() { local curcontext="$curcontext" state line expl _arguments -C \ '-a[specify application]: :->open_mac_applications' \ '-e[open with TextEdit]' \ '-f[reads input from standard input and opens with TextEdit]' \ '*: :->open_files' case "$state" in open_mac_applications) _alternative \ "commands: :_mac_applications" \ "files:: _open_absolute_application_path" ;; open_files) local app if [[ -n "$words[(r)-a]" ]]; then app="${(Q)words[words[(i)-a] + 1]}" elif [[ -n "$words[(r)-e]" || -n "$words[(r)-f]" ]]; then app="Text Edit" fi if [[ -n "$app" ]]; then _wanted files expl "file for $app" _mac_files_for_application "$app" else _webbrowser fi ;; esac } _open "$@" PK[ D functions/_rinuW+A#compdef ri local curcontext="$curcontext" state line ret=1 typeset -A opt_args _arguments \ '(- *)'{-h,--help}'[print help information and exit]' \ '(- *)'{-v,--version}'[display the version of ri]' \ '*'{-d,--doc-dir}'[directory to search for documentation]:ri doc directory:_files -/' \ '(-f --fmt --format)'{-f,--fmt,--format}'[format to use when displaying output]:output format:(ansi bs html plain simple)' \ '(-T --no-pager)'{-T,--no-pager}'[send output directly to stdout]' \ '(-i, --interactive)'{-i,--interactive}'[interactive mode]' \ '--list-doc-dirs[list the directories from which ri will source documentation]' \ '(-w --width)'{-w,--width}'[set the width of the output]:output width:' \ '--no-standard-docs[do not include documentation from the Ruby standard library, site_lib, installed gems, or ~/.rdoc]' \ '(--no-use-cache --use-cache)--'{no-,}'use-cache[whether or not to use ri'\''s cache]' \ '(--no-system --system)--'{no-,}'system[include documentation from Ruby'\''s standard library]' \ '(--no-site --site)--'{no-,}'site[include documentation from libraries installed in site_lib]' \ '(--no-gems --gems)--'{no-,}'gems[include documentation from RubyGems]' \ '(--no-home --home)--'{no-,}'home[include documentation stored in ~/.rdoc]' \ '*:ri name:->ri-name' && ret=0 if [[ "$state" = ri-name ]]; then local -a ri_dirs ri_names ri_wants ri_names local class_dir esc_name dir curtag tag descr expl ret=1 if "ruby${words[1]#ri}" -rrdoc/ri/ri_options.rb -e 1 >/dev/null 2>&1; then # Old-style Ruby 1.8.x RI ri_dirs=( ${(f)"$(_call_program ri-names "ruby${words[1]#ri}" -rrdoc/ri/ri_options -e '"o = RI::Options.instance; o.parse(ARGV); o.path.each { |p| puts p }"' -- ${(kv)opt_args[(I)-d|--doc-dir|--(system|site|gems|home)]})"} ) else # New-style Ruby 1.9+ RI ri_dirs=( ${(f)"$(_call_program ri-names "$words[1]" ${(kv)opt_args[(I)-d|--doc-dir|--((no-|)(system|site|gems|home)|standard-docs)]} --list-doc-dirs -f plain -T)"} ) fi if compset -P '?*(::|\#|.)'; then class_dir=${IPREFIX//(::|\#|.)/\/} #else # : fi esc_name=${${(Q)PREFIX}//(#b)([^A-Za-z0-9_])/$(printf %%%x ${(qq)match[1]})} case "$IPREFIX" in (*::) ri_wants=( 'classes:class names' 'class-methods:class methods' );; (*\#) ri_wants=( 'instance-methods:instance methods' );; (*.) ri_wants=( 'class-methods:class methods' 'instance-methods:instance methods' );; (*) ri_wants=( 'classes:class names' ) esac for curtag in $ri_wants; do tag=${curtag%%:*} descr=${curtag#*:} _tags "$tag" while _tags; do while _next_label "$tag" expl "$descr"; do ri_wants=() case "$tag" in (classes) for dir in $ri_dirs[@]; do ri_wants+=( $dir/$class_dir*(-/:t) ) done ;; (class-methods) for dir in $ri_dirs[@]; do fnames=( $dir/$class_dir*-c.yaml(-.:t) ) ri_wants+=( ${${fnames%-c.yaml}//(#b)%(??)/$(print "\\x$match[1]")} ) done ;; (instance-methods) for dir in $ri_dirs[@]; do fnames=( $dir/$class_dir*-i.yaml(-.:t) ) ri_wants+=( ${${fnames%-i.yaml}//(#b)%(??)/$(print "\\x$match[1]")} ) done ;; esac ri_names=( ${(Q)ri_wants} ) compadd -S '' -d ri_names -a "$expl[@]" ri_wants && ret=0 done (( ret )) || break done done fi return ret PK[] ] functions/_iwconfignuW+A#compdef iwconfig local curcontext="$curcontext" state line expl ret=1 _arguments -C \ '(1 * -)--help[display help information]' \ '(1 * -)--version[display version information]' \ '1:network interface:_net_interfaces' \ '*:parameter:->parameters' && ret=0 if [[ -n "$state" ]]; then local -a arg case $words[CURRENT-1] in essid) _wanted -x names expl 'network name' compadd off any on ;; nwid|domain) _message -e ids 'network id' ;; freq|channel) _message -e channels 'channel or frequency' ;; sens) _message -e levels 'signal level' ;; mode) _wanted modes expl 'operating mode' compadd \ Ad-Hoc Managed Master Repeater Secondary Monitor Auto ;; ap) _message -e access-points 'access point' ;; nick*) _message -e names 'nickname' ;; rate|bit*) _message -e bit-rates 'bit rate' ;; rts*|frag*) _message -e sizes 'size' ;; key|enc*) _message -e keys 'key' ;; power) arg=( \*{min,max}'[modifier]' '*off[disable power management]' '*on[enable power management]' '*all[receive all packets]' 'unicast[receive unicast packets only]' 'multicast[receive multicast and broadcast packets only]' ) ;& min|max) _values -S ' ' -w 'parameter' \ 'period[set the period between wake ups]' \ 'timeout[set timeout before sleep]' \ $arg[@] && ret=0 ;; period|timeout) _message -e timeouts 'timeout' ;; txpower) _message -e power 'transmit power' ;; retry) _message -e retries 'retries' ;; (modu) _wanted -x names expl 'modulation' compadd 11g CCK OFDMa auto ;; *) _values -S ' ' -w 'option' \ 'essid[set the network name]' \ '(nwid domain)'{nwid,domain}'[set the network ID]' \ '(freq channel)'{freq,channel}'[set the operating frequency or channel]' \ 'sens[set the sensitivity threhold]' \ 'mode[set operating mode]' \ 'ap[register with given access point]' \ '(nick nickname)'nick{,name}'[set the nickname]' \ '(rate bit)'{rate,bit}'[set the bitrate]' \ 'rts[set packet size threshold for sending RTS]' \ 'frag[set maximum packet fragment size]' \ \*{key,enc}'[add encryption key]' \ '*power[manipulate power management scheme parameters]' \ 'txpower[set transmit power]' \ 'retry[set number of retries]' \ 'modu[force a specific set of modulations]' \ 'commit[apply changes imediately]' && ret=0 ;; esac fi return ret PK[6@?functions/_darcsnuW+A#compdef darcs ## Darcs completion snippet for zsh. ## ## Copyright (C) 2009 Nicolas Pouillard ## ## This program is free software; you can redistribute it and/or modify ## it under the terms of the GNU General Public License as published by ## the Free Software Foundation; either version 2 of the License, or ## (at your option) any later version. ## ## This program is distributed in the hope that it will be useful, ## but WITHOUT ANY WARRANTY; without even the implied warranty of ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ## GNU General Public License for more details. if (($CURRENT == 2)); then # We're completing the first word after "darcs" -- the command. _wanted command expl 'darcs command' \ compadd -- $( darcs --commands ) else case "${words[$CURRENT]}"; in # If it looks like an URL... ht*|ft*) _arguments '*:URL:_urls' ;; # If it looks like an explicit path... /*|./*|\~*|../*) _arguments '*:file:_files' ;; # Otherwise, let's ask darcs for all possible options *) _wanted args expl 'arg for darcs command' \ compadd -- $( darcs ${words[2]} --list-option ) ;; esac fi PK[{7functions/_pbuildernuW+A#compdef pbuilder local expl if (( CURRENT == 2 )); then _wanted tag expl 'pbuilder command' \ compadd create update build execute clean login dumpconfig debuild \ --create --update --build --execute --clean --login --dumpconfig --debuild else compset -n 1 _arguments \ '--basetgz:location:_files -g "*.tgz"' \ '--buildplace:location:_files -/' \ '--buildresult:location:_files -/' \ '--mirror:URL:_urls' \ '--othermirror:URL:_urls' \ '--distribution:suite:(breezy dapper edgy etch feisty gutsy hardy hoary intrepid jaunty karmic lenny lucid potato sarge sid squeeze warty woody' \ '--architecture:architecture:(alpha amd64 armel hppa hurd-i386 i386 ia64 m68k mips mipsel powerpc s390 sparc)' \ '--components:component:(main contrib non-free)' \ '--override-config' \ '--hookdir:location:_files -/' \ '--debbuildopts:dpkg-buildpackage options:' \ '--logfile:log file:_files' \ '--binary-arch' \ '--bindmounts:bind mountpoints:_files -/' \ '--debootstrapopts:debootstrap options:' \ '--debootstrap:debootstrap implementation:(debootstrap cdebootstrap)' \ '--save-after-login' \ '--save-after-exec' \ '--autocleanaptcache' \ '*:source package:_files -g "*.dsc"' fi PK[z5oofunctions/_debsignnuW+A#compdef debsign _arguments \ '-r[copy .changes file from remote host]: :_user_at_host' \ '-p[program with which to sign]:program name' \ '-m[maintainer]:maintainer name and email address' \ '-e[maintainer]:maintainer name and email address' \ '-k[key ID to use for signing]:keyid' \ '-s[argument style for signing program]:gpg or pgp' \ '-S[look for source-only .changes file]' \ '-a[architecture]:Debian architecture' \ '-t[GNU system type]:GNU system type' \ '--help[display help information]' \ '--version[display version information]' \ '*:changes or dsc file:_files -g "*.(changes|dsc)(-.)"' PK[ R,, functions/_ddnuW+A#compdef dd _values -w 'option' \ 'if[specify input file]:input file:_tilde_files' \ 'of[specify output file]:output file:_tilde_files' \ '(bs)ibs[input block size]:block size (bytes)' \ '(bs)obs[output block size]:block size (bytes)' \ '(ibs obs)bs[block size]:block size (bytes)' \ 'cbs[conversion buffer size]:buffer size (bytes)' \ 'skip[input blocks initially skipped]:blocks' \ 'seek[output blocks initially skipped]:blocks' \ 'files[specify number of input files to copy and concatenate]:number of files' \ 'count[number of input blocks to copy]:blocks' \ 'conv[specify conversions to apply]:conversion:_values -s , conversion "(ebcdic ibm)ascii" "(ascii ibm)ebcdic" "(ascii ebcdic)ibm" "(unblock)block" "(block)unblock" "(ucase)lcase" "(lcase)ucase" swab noerror sync' PK[ *functions/_fakerootnuW+A#compdef fakeroot _arguments \ '(-l --lib)'{-l,--lib}'[specify alternate wrapper library]:wrapper library:_files' \ '--faked[specify alternate faked binary]:fake binary:_command_names -e' \ '-s[save the fakeroot environment on exit]:save file:_files' \ '-i[load a previously saved environment]:file:_files' \ '(-u --unknown-is-real)'{-u,--unknown-is-real}'[use real ownership of previously unknown files]' \ '(-):command name:_command_names -e' \ '*::arguments:_normal' PK[3mR R functions/_make-kpkgnuW+A#compdef make-kpkg local context state line typeset -A opt_args _arguments \ '--help[display help message]' \ '--revision[change Debian revision number]:number:' \ '--append-to-version[specify additional kernel sub-version]:suffix:' \ '--added-modules[specify add-on modules]:module list:->addedmodules' \ '--added-patches[specify additional patches]:patches list' \ '--arch[specify architecture for cross-compilation]:architecture' \ '--cross-compile[specify target string]:target' \ '--subarch[specify subarchitecture]:subarchitecture:' \ '--arch-in-name[include architecture in kernel image name]' \ '--pgpsign[sign changes file]:name' \ '--config[specify configuration target]:target:(oldconfig config menuconfig xconfig old menu x)' \ '--targets[list known targets]' \ '--noexec[pass -n option to make]' \ '--verbose[show top level make commands]' \ '--initrd[create image suitable for initrd]' \ '(--bzimage)--zimage[make zImage instead of bzImage]' \ '(--zimage)--bzimage[make bzImage instead of zImage]' \ '--mkimage[command that produces an initrd image given a directory]:command:' \ '--rootcmd[specify command for gaining root access]:root command:(sudo fakeroot)' \ '--stem:package name stem:(kernel linux)' \ '--us[unsigned source]' \ '--uc[unsigned changelog]' \ '*:target:(( \ clean\:"clean the kernel source directory" \ buildpackage\:"runs the targets clean and binary" \ binary\:"all kernel packages" \ binary-indep\:"arch independent packages" \ binary-arch\:"arch dependent packages" \ kernel-source\:"package of the kernel sources" \ kernel-headers\:"package of the header files included in the kernel" \ kernel-manual\:"package of the manual pages included in the kernel" \ kernel-doc\:"package of teh documentation included in the kernel" \ kernel-image\:"package of the kernel image" \ build\:"compiles the kernel" \ modules\:"build all add-on modules" \ modules-config\:"configure all add-on modules" \ modules-image\:"build all add-on modules, but wirhou source and diff files" \ modules-clean\:"clean add-on modules" \ configure\:"configure the kernel" \ debian\:"creates the debian/ directory" \ libc-kheaders\:"create the kernel headers package needed by libc" \ ))' && return 0 case "$state" in (addedmodules) compset -P '*,' _alternative \ 'moddirs:module dirs:_files -/ -S ,' \ 'modules:loc module dirs:_files -/ -W ${MODULE_LOC:-/usr/src/modules} -S ,' ;; esac PK[sFfunctions/insert-filesnuW+A# insert-files() { # Autoload this function, run `zle -N ' and bind # to a key. # This function allows you type a file pattern, and see the results of the # expansion at each step. When you hit return, they will be inserted into # the command line. emulate -L zsh setopt nobadpattern local key str files files=( *(N) ) if (( $#files )); then zle -R "files: ${str}_" "$files[@]" else zle -R "files: ${str}_ (failed)" fi read -k key while [[ '#key' -ne '#\\r' && '#key' -ne '#\\n' && '#key' -ne '#\\C-g' ]]; do if [[ '#key' -eq '#\\C-h' || '#key' -eq '#\\C-?' ]]; then [[ -n "$str" ]] && str="$str[1,-2]" else str="$str$key" fi eval "files=( \${~str}*(N) )" if (( $#files )); then zle -R "files: ${str}_" "$files[@]" else zle -R "files: ${str}_ (failed)" fi read -k key done zle -Rc if [[ '#key' -ne '#\\C-g' && $#files -gt 0 ]]; then [[ "$LBUFFER[-1]" = ' ' ]] || files=('' "$files[@]") LBUFFER="$LBUFFER$files " fi # } PK[22functions/_cpionuW+A#compdef cpio local args ig curcontext="$curcontext" state line local expl ret local fmts='(bar bin odc newc crc tar ustar hpbin hpodc)' _pick_variant -r ig gnu=GNU unix --version if (( CURRENT == 2 )); then # Complete arguments args=('-o[create archive]' '-i[extract from archive]' '-p[run as filter on directory tree]') [[ $ig = gnu ]] && args=($args '--create[create archive]' '--extract[extract from archive]' '--pass-through[run as filter on directory tree]' '--help[show help text]' '--version[show version information]') else if [[ -n ${words[(r)(-o*|-[^-]*o*|--create)]} ]]; then # Options for creating archive if [[ $ig = gnu ]]; then args=( '--file=:archive file:->afile' "--format=:format type:$fmts" '--message=:message at end of volume:' '--null' '--reset-access-time' '--verbose' '--dot' '--append' '--block-size=:block size in 512 byte units:' '--dereference' '--io-size=:block size in bytes' '--quiet' '--force-local' '--help' '--version') fi args=($args '-A[append files to archive]' '-B[block size 5120 bytes with special file]' '-C[set block size per record]:block size in bytes:(8192)' '-F[set archive file to use]:archive file:->afile' '(-H)-c[read/write header in ASCII]' "(-c)-H[set format type for archive header]:$fmts" '-L[follow symbolic links]' '-M[print message at end of volume]:message to print:' '-O[set output archive file]:output archive file:_files' ) elif [[ -n ${words[(r)(-i*|-[^-]*i*|--extract)]} ]]; then if [[ $ig = gnu ]]; then args=('--file=:archive file:->afile' "--format=:format type:$fmts" '--make-directories' '--nonmatching' '--preserve-modification-time' '--numeric' '--rename' '--list' '--swap-bytes' '--swap-halfwords' '--dot' '--unconditional' '--verbose' '--block-size=:block size in 512 byte units:' '--swap-halfwords' '--io-size=:block size in bytes:' '--pattern-file=:file with list of patterns:_files' '--owner=:user (and group) for files:->user' '--no-preserve-owner' '--message=:message at end of volume:' '--force-local' '--no-absolute-filenames' '--sparse' '--only-verify-crc' '--quiet' '--help' '--version') fi args=($args '-b[reverse bytes in word]' '-B[block size 5120 bytes with special file]' '-d[create directories as needed]' '-C[set block size per record]:block size in bytes:(8192)' '-E[read filenames from file]:file name for list of files:_files' '-f[only copy files not matching patterns]' '-F[set archive file to use]:archive file:->afile' '(-H)-c[read/write header in ASCII]' "(-c)-H[set format type for archive header]:$fmts" '-I[set input archive file]:input archive file:_files' '-m[preserve file modification times]' '-M[print message at end of volume]:message to print:' '-n[show UID and GID numerically]' '-r[interactively rename files]' '-R[set user and group for files]:user (and group) for files:->user' '-s[swap bytes within each halfword]' '-S[swap bytes within each word]' '-t[print a table of contents]' '*:pattern to extract' ) elif [[ -n ${words[(r)(-p*|-[^-]*p*|--pass-through)]} ]]; then if [[ $ig = gnu ]]; then args=('--null' '--reset-access-time' '--make-directories' '--link' '--quiet' '--preserve-modification-time' '--unconditional' '--verbose' '--dot' '--dereference' '--owner=:user (and group) for files:->user' '--no-preserve-owner' '--sparse' '--help' '--version') fi args=($args '-d[create directories as needed]' '-l[link files instead of copying]' '-L[follow symbolic links]' '-m[preserve file modification times]' '-R[set user and group for files]:user (and group) for files:->user' '*:destination directory:_files -/' ) else return 1 fi args=($args '-a[reset access time of input files]' ) fi ret=1 _arguments -C -s "$args[@]" && ret=0 if [[ $state = afile ]]; then if compset -P '*:'; then # TODO: doesn't need to be rsh. _wanted files expl 'remote files' \ compadd $(rsh ${words[CURRENT]%:*} echo ${words[CURRENT]#*:}\*) && ret=0 elif compset -P '*@'; then _wanted hosts expl 'remote host name' _hosts && ret=0 else _alternative \ 'files:: _files' \ 'hosts:remote host name:_hosts -S:' \ 'users:user name:_users -qS@' && ret=0 fi elif [[ $state = user ]]; then if compset -P '*[:.]'; then _groups else local suf=. [[ $OSTYPE = (solaris|hpux)* ]] && suf=: compset -S '.*' && unset suf _users -S "$suf" -q fi fi return ret PK[Gfunctions/_xargsnuW+A#compdef xargs _arguments \ '(-t)-p[prompt user for each command]' \ '(-p)-t[verbose - echo each command]' \ '-x[exit if max size exceeded]' \ -{e-,E}':end-of-file string:' \ '(-x -I)-i-:replacement string for lines:' \ '(-x -i)-I:replacement string for lines:' \ '(-n -L -x)-l-:number of input lines:' \ '(-n -l)-L:number of input lines:' \ '(-l -L)-n-:maximum number of arguments:' \ '-s-:maximum command line length:' \ '(-):command: _command_names -e' \ '*::args: _normal' PK[F>ifunctions/_lspvnuW+A#compdef lspv _arguments -C -s \ '(-p -M)-l[list logical volumes on physical volume]' \ '(-l -M)-p[list partitions on physical volume]' \ '(-l -p)-M[list mapping of physical and logical partition numbers]' \ '-n[specify physical volume to access variable descriptor from]:physical volume:_physical_volumes' \ '-v[specify volume group id to access info based on]:volume group id' \ '1:physical volume:_physical_volumes' PK[ Kfunctions/_normalnuW+A#compdef -command-line- local _comp_command1 _comp_command2 _comp_command skip if [[ "$1" = -s ]]; then skip=(-s) else skip=() _compskip='' fi # Check for a history reference to complete modifiers. # $PREFIX has a quoted form of the !, so we can't test that # (it might the start of a real argument), but words has the # raw McCoy. if [[ -o BANG_HIST && ( ( $words[CURRENT] = \!*: && -z $compstate[quote] ) || ( $words[CURRENT] = \"\!*: && $compstate[all_quotes] = \" ) ) ]]; then # This looks like a real history expansion; in that case # we'd better put the !'s back the way pfalstad intended. PREFIX=${PREFIX//\\!/!} compset -P '*:' _history_modifiers h return fi # Completing in command position? if [[ CURRENT -eq 1 ]]; then curcontext="${curcontext%:*:*}:-command-:" comp="$_comps[-command-]" [[ -n "$comp" ]] && eval "$comp" && ret=0 return ret fi _set_command _dispatch "$skip[@]" "$_comp_command" \ "$_comp_command1" "$_comp_command2" -default- PK[wfunctions/_lastnuW+A#compdef last lastb _arguments -s \ '-a[display hostname in last column]' \ '-n[number]:number' \ '-[number]:number' \ '-f[filename]:filename:_files' \ '-R[suppress display of hostname field]' \ '-d[translate IP to hostname]' \ '-i[display IP]' \ '-o[read old-format wtmp]' \ '-x[display shutdown/runlevel entries]' \ '-h[hostname]:host:_hosts' \ '-s[report duration in seconds]' \ '-t[tty]:tty' \ '-w[widen duration field]' \ '*:user:_users' PK[tYYfunctions/VCS_INFO_detect_tlanuW+A## vim:ft=zsh ## gnu arch support by: Frank Terbeck ## Distributed under the same BSD-ish license as zsh itself. setopt localoptions NO_shwordsplit [[ $1 == '--flavours' ]] && return 1 VCS_INFO_check_com ${vcs_comm[cmd]} || return 1 vcs_comm[basedir]="$(${vcs_comm[cmd]} tree-root 2> /dev/null)" && return 0 return 1 PK[Q functions/_gphoto2nuW+A#compdef gphoto2 _arguments -s \ '--debug[turn on debugging]' \ '(-q --quiet)'{-q,--quiet}'[quiet output]' \ '(-v --version)'{-v,--version}'[display version and exit]' \ '(-h --help)'{-h,--help}'[display a short usage message]' \ '--list-cameras[list supported camera models]' \ '--list-ports[list supported port devices]' \ '--stdout[send file to stdout]' \ '--stdout-size[print filesize before data]' \ '--auto-detect[list auto-detected cameras]' \ '--port[specify port device]:port' \ '--speed[specify serial transfer speed]:speed' \ '--camera[specify camera model]:camera model' \ '--filename[specify pattern to save file as]:pattern' \ '--usbid[override USB IDs (expert only)]:usbid' \ '(-a --abilities)'{-a,--abilities}'[display camera abilities]' \ '(-f --folder)'{-f,--folder}'[specify camera folder]:folder' \ '(-R --recurse --no-recurse)'{-R,--recurse}'[recursion (default for download)]' \ '(-R --recurse)--no-recurse[no recursion (default for deletion)]' \ '(-l --list-folders)'{-l,--list-folders}'[list folders in folder]' \ '(-L --list-files)'{-L,--list-files}'[list files in folder]' \ '(-m --mkdir)'{-m,--mkdir}'[create a directory]:directory' \ '(-r --rmdir)'{-r,--rmdir}'[remove a directory]:directory' \ '(-n --num-files)'{-n,--num-files}'[sisplay number of files]' \ '(-p --get-file)'{-p,--get-file}'[get files given in range]:range' \ '(-P --get-all-files)'{-P,--get-all-files}'[get all files from folder]' \ '(-t --get-thumbnail)'{-t,--get-thumbnail}'[get thumbnails given in range]:range' \ '(-T --get-all-thumbnails)'{-T,--get-all-thumbnails}'[get all thumbnails from folder]' \ '(-r --get-raw-data)'{-r,--get-raw-data}'[get raw data given in range]:range' \ '--get-all-raw-data[get all raw data from folder]' \ '--get-audio-data[get audio data given in range]:range' \ '--get-all-audio-data[get all audio data from folder]' \ '--delete-files[delete files given in range]:range' \ '--delete-all-files[delete all files in folder]' \ '(-u --upload-file)'{-u,--upload-file}'[upload a file to camera]:file:_files' \ '--capture-preview[capture a quick preview]' \ '--capture-image[capture an image]' \ '--capture-movie[capture a movie]' \ '--capture-sound[capture an audio clip]' \ '--show-info[show info about given range]:range' \ '--summary[summary of camera status]' \ '--manual[camera driver manual]' \ '--about[show information about the camera driver]' \ '--shell[start the gphoto2 shell]' PK[m˾]%%functions/_zmvnuW+A#compdef zmv zln zcp _arguments -s -S -A '-*' \ '(-C -L -s -p)-M[force mv]' \ '(-M -L -s -p)-C[force cp]' \ '(-M -C -p)-L[force ln]' \ '-f[force overwriting of destination files]' \ '-i[interactive: prompt for each operation]' \ '-n[no execution: just print what would happen]' \ '-Q[force bare glob qualifiers on]' \ '(-C -M)-s[symbolic, passed down to ln]' \ '-v[verbose: print line as it is executed]' \ '-o[specify options to pass to underlying command]: opt string' \ '(-M -C -L -s)-p+[specify program to run instead of cp, ln or mv]:program:_command_names -e' \ '(-W)-w[implicitly add parenthesis to wildcards in the pattern]' \ '(-w)-W[like -w, but turn wildcards in replacement patterns into references]' \ '1:source pattern:_files' \ '2:destination pattern:_files' PK[1Dxxfunctions/down-case-word-matchnuW+Aemulate -L zsh setopt extendedglob autoload -Uz match-words-by-style local curcontext=":zle:$WIDGET" word local -a matched_words integer count=${NUMERIC:-1} while (( count-- > 0 )); do match-words-by-style word=${(j..)matched_words[4,5]} if [[ -n word ]]; then LBUFFER+=${(L)word} RBUFFER=${(j..)matched_words[6,7]} else return 1 fi done return 0 PK[AIIfunctions/_todo.shnuW+A#compdef todo.sh # See http://todotxt.com for todo.sh. # # Featurettes: # - "replace" will complete the original text for editing # - completing priorities will cycle through A to Z (even without # menu completion) # - list and listall will complete + and @ from # values in existing entries # - will complete after + and @ if typed in message text setopt localoptions braceccl local expl curcontext="$curcontext" state line pri nextstate item local -a cmdlist itemlist match mbegin mend integer NORMARG _arguments -s -n : \ '-d[alternate config file]:config file:_files' \ '-f[force, no confirmation]' \ '-h[display help]' \ '-p[plain mode, no colours]' \ '-v[verbose mode, confirmation messages]' \ '-V[display version etc.]' \ '1:command:->commands' \ '*:arguments:->arguments' && return 0 local projmsg="context or project" local txtmsg="text with contexts or projects" # Skip "command" as command prefix if words after if [[ $words[NORMARG] == command && NORMARG -lt CURRENT ]]; then (( NORMARG++ )) fi case $state in (commands) cmdlist=( "add:add TODO ITEM to todo.txt." "addm:add TODO ITEMs, one per line, to todo.txt." "addto:add text to file (not item)" "append:adds to item on line NUMBER the text TEXT." "archive:moves done items from todo.txt to done.txt." "command:run internal commands only" "del:deletes the item on line NUMBER in todo.txt." "depri:remove prioritization from item" "do:marks item on line NUMBER as done in todo.txt." "help:display help" "list:displays all todo items containing TERM(s), sorted by priority." "listall:displays items including done ones containing TERM(s)" "listcon:list all contexts" "listfile:display all files in .todo directory" "listpri:displays all items prioritized at PRIORITY." "move:move item between files" "prepend:adds to the beginning of the item on line NUMBER text TEXT." "pri:adds or replace in NUMBER the priority PRIORITY (upper case letter)." "replace:replace in NUMBER the TEXT." "remdup:remove exact duplicates from todo.txt." "report:adds the number of open and done items to report.txt." ) _describe -t todo-commands 'todo.sh command' cmdlist ;; (arguments) case $words[NORMARG] in (append|command|del|move|mv|prepend|pri|replace|rm) if (( NORMARG == CURRENT - 1 )); then nextstate=item else case $words[NORMARG] in (pri) nextstate=pri ;; (append|prepend) nextstate=proj ;; (move|mv) nextstate=file ;; (replace) item=${words[CURRENT-1]##0##} compadd -Q -- "${(qq)$(todo.sh -p list "^[ 0]*$item " | sed '/^--/,$d')##<-> (\([A-Z]\) |)}" ;; esac fi ;; (depri|do|dp) nextstate=item ;; (a|add|addm|list|ls|listall|lsa) nextstate=proj ;; (addto) if (( NORMARG == CURRENT - 1 )); then nextstate=file else nexstate=proj fi ;; (listfile|lf) if (( NORMARG == CURRENT -1 )); then nextstate=file else _message "Term to search file for" fi ;; (listpri|lsp) nextstate=pri ;; (*) return 1 ;; esac ;; esac case $nextstate in (file) _path_files -W ~/.todo ;; (item) itemlist=(${${(M)${(f)"$(todo.sh -p list | sed '/^--/,$d')"}##<-> *}/(#b)(<->) (*)/${match[1]}:${match[2]}}) _describe -t todo-items 'todo item' itemlist ;; (pri) if [[ $words[CURRENT] = (|[A-Z]) ]]; then if [[ $words[CURRENT] = (|Z) ]]; then pri=A else # cycle priority pri=$words[CURRENT] pri=${(#)$(( #pri + 1 ))} fi _wanted priority expl 'priority' compadd -U -S '' -- $pri else _wanted priority expl 'priority' compadd {A-Z} fi ;; (proj) # This completes stuff beginning with + (projects) or @ (contexts); # these are todo.sh conventions. if [[ ! -prefix + && ! -prefix @ ]]; then projmsg=$txtmsg fi # In case there are quotes, ignore anything up to whitespace before # the + or @ (which may not even be there yet). compset -P '*[[:space:]]' _wanted search expl $projmsg \ compadd $(todo.sh lsprj) $(todo.sh lsc) ;; esac PK[ㄟfunctions/prompt_clint_setupnuW+A# clint prompt theme prompt_clint_help () { cat <<'EOF' prompt clint [ [ [ [ []]]]] defaults are red, cyan, green, yellow, and white, respectively. EOF } prompt_clint_setup () { local -a pcc local -A pc local p_date p_tty p_plat p_ver p_userpwd p_apm p_shlvlhist p_rc p_end p_win autoload -Uz vcs_info pcc[1]=${1:-${${SSH_CLIENT+'yellow'}:-'red'}} pcc[2]=${2:-'cyan'} pcc[3]=${3:-'green'} pcc[4]=${4:-'yellow'} pcc[5]=${5:-'white'} pc['\[']="%F{$pcc[1]}[" pc['\]']="%F{$pcc[1]}]" pc['<']="%F{$pcc[1]}<" pc['>']="%F{$pcc[1]}>" pc['\(']="%F{$pcc[1]}(" pc['\)']="%F{$pcc[1]})" p_date="$pc['\[']%F{$pcc[2]}%D{%a %y/%m/%d %R %Z}$pc['\]']" p_tty="$pc['\[']%F{$pcc[3]}%l$pc['\]']" p_plat="$pc['\[']%F{$pcc[2]}${MACHTYPE}/${OSTYPE}/$(uname -r)$pc['\]']" p_ver="$pc['\[']%F{$pcc[2]}${ZSH_VERSION}$pc['\]']" [[ -n "$WINDOW" ]] && p_win="$pc['\(']%F{$pcc[4]}$WINDOW$pc['\)']" p_userpwd="$pc['<']%F{$pcc[3]}%n@%m$p_win%F{$pcc[5]}:%F{$pcc[4]}%~$pc['>']" p_vcs="%(2v.%U%2v%u.)" p_shlvlhist="%fzsh%(2L./$SHLVL.) %B%h%b " p_rc="%(?..[%?%1v] )" p_end="%f%B%#%b " zle_highlight[(r)default:*]=default:$pcc[2] prompt="$p_date$p_tty$p_plat$p_ver $p_userpwd $p_shlvlhist$p_rc$p_vcs$p_end" PS2='%(4_.\.)%3_> %E' add-zsh-hook precmd prompt_clint_precmd } prompt_clint_precmd () { setopt noxtrace noksharrays localoptions local exitstatus=$? local git_dir git_ref psvar=() [[ $exitstatus -ge 128 ]] && psvar[1]=" $signals[$exitstatus-127]" || psvar[1]="" [[ -o interactive ]] && jobs -l vcs_info [[ -n $vcs_info_msg_0_ ]] && psvar[2]="$vcs_info_msg_0_" } prompt_clint_setup "$@" PK[V{CCfunctions/_vorbisnuW+A#compdef oggenc ogg123 ogginfo oggdec local expl ret=1 case $service in oggenc) _arguments -s \ '(- *)'{-h,--help}'[show help]' \ '(- *)'{-v,--version}'[display version information]' \ '(-r --raw)'{-r,--raw}'[assume input data is raw, little-endian with no header information]' \ '(-B --raw-bits)'{-B+,--raw-bits=}'[set raw mode input sample size in bits]:sample size:(8 16)' \ '(-C --raw-chan)'{-C+,--raw-chan=}'[set raw mode input number of channels]:number of channels' \ '(-R --raw-rate)'{-R+,--raw-rate=}'[set raw mode input sample rate]:sample rate:(44100 48000)' \ '--raw-endianness[set raw mode endianness]:endianness:((0\:big\ endian 1\:little\ endian))' \ '(-Q --quiet)'{-Q,--quiet}'[quiet mode]' \ '(-b --bitrate)'{-b+,--bitrate=}'[set encoding to the bitrate closest to that specified]:bitrate (kb/s)' \ '(-m --min-bitrate)'{-m+,--min-bitrate=}'[set minimum bitrate]:bitrate (kb/s)' \ '(-M --max-bitrate)'{-M+,--max-bitrate=}'[set maximum bitrate]:bitrate (kb/s)' \ '--managed[turn off the normal VBR encoding]' \ '(-q --quality)'{-q+,--quality=}'[set encoding quality]:quality:(0 1 2 3 4 5 6 7 8 9 10)' \ '--resample[resample input to the given sample rate before encoding]:sample rate (Hz)' \ '--downmix[down mix input from stereo to mono]' \ '--advanced-encode-option:option name:_values option "bitrate_average_window[set the managed bitrate window]\:number (seconds)" "lowpass_frequency[set the lowpass frequency]\:frequency (kHz)"' \ '(-s --serial)'{-s+,--serial=}'[force a specific serial number in the output stream]' \ "--discard-comments[don't copy comments from FLAC file to output Ogg Vorbis file]" \ '(-o --output)'{-o+,--output=}'[write the Ogg Vorbis stream to output_file]:files:->oggfiles' \ '(-n --names)'{-n+,--names=}'[specify pattern for producing filenames]:string' \ '(-X --name-remove)'{-X+,--name-remove=}'[remove specified characters from output filenames]:characters' \ '(-P --name-replace)'{-P+,--name-replace=}'[specify replacement characters for those removed]:characters' \ '(-c --comment)'{-c+,--comment}'[add the string comment as an extra comment]:comment' \ '(-a --artist)'{-a+,--artist}'[set the artist comment field in the comments to artist]:artist' \ '(-G --genre)'{-G+,--genre}'[set the genre comment field in the comments to genre]:genre' \ '(-d --date)'{-d+,--date}'[set the date comment field to the given value]:date' \ '(-N --tracknum)'{-N+,--tracknum}'[set the track number comment field to the given value]:track number' \ '(-t --title)'{-t+,--title}'[set the track title comment field to title]:title' \ '(-l --album)'{-l+,--album}'[set the album comment field to album]' \ '*:input file:_files -g "(#i)*.(flac|wav|aiff)(-.)"' && ret=0 ;; ogg123) _arguments -C -s \ '(- *)'{-h,--help}'[show help]' \ '(- *)'{-V,--version}'[display version information]' \ \*{-d+,--device}'[output device]:device:((null\:discard\ all\ data oss\:open\ sound\ system sun\:sun\ audio alsa\:advanced\ linux\ sound\ architecture irix\:IRIX\ audio arts\:aRts\ sound\ daemon esd\:enlightened\ sound\ daemon au\:sun\ audio\ file raw\:raw\ sample wav\:wav\ file))' \ \*{-f+,--files=}'[output filename for a previously specified file device]:output filename:_files -g "(#i)*.(wav|au|raw)(-.)"' \ '(-k --skip)'{-k+,--skip}"[skip the first 'n' seconds (or to hh:mm:ss)]:seconds" \ '(-K --end)'{-K+,--end}"[end at 'n' seconds (or hh:mm:ss)]:seconds" \ '(-b --buffer)'{-b+,--buffer}'[size of input buffer]:kilobytes' \ '(-p --prebuffer)'{-p+,--prebuffer}'[prebuffer percentage]:percent' \ '(-q --quiet)*'{-v,--verbose}'[increase verbosity]' \ '(-q --quiet -v --verbose)'{--quiet,-q}'[quiet mode]' \ '(-x --nth)'{-x+,--nth}'[block decode intervall]:number' \ '(-y --ntimes)'{-y+,--ntimes}'[block repeat count]:number' \ '(-z --shuffle)'{-z,--shuffle}'[shuffle play]' \ '(-l --delay)'{-l+,--delay=}'[set delay between two SIGINTs to quit]:delay (ms)' \ '(-@ --list)'{-@+,--list}'[play all of the files from a playlist]:playlist:_files' \ '--audio-buffer=[size of output audio buffer]:kilobytes' \ \*{-o,--device-option=}'[assign device option values]:device option:->devopts' \ '*:sound file or directory:_files -g "(#i)*.(ogg|flac|spx)"' && ret=0 ;; ogginfo) _arguments \ '(- *)-h[show a help and usage message]' \ '(-)*-q[quiet mode]' \ '(-)-v[verbose mode]' \ '*:ogg vorbis file:_files -g "(#i)*.ogg(-.)"' && ret=0 ;; oggdec) _arguments -s \ '(-Q --quiet)'{-Q,--quiet}'[quiet mode]' \ '(- *)'{-h,--help}'[print help information]' \ '(- *)'{-v,--version}'[display version information]' \ '(-b --bits)'{-b+,--bits=}'[bits per sample]:bits per sample:(8 16)' \ '(-e --endian)'{-e+,--endian=}'[set endianness for 16-bit output]:endianness:((0\:\(default\)\ little-endian\ \(Intel\ byte\ order\) 1\:big-endian\ \(sane\ byte\ order\)))' \ '(-R --raw)'{-R+,--raw=}'[output in raw format]' \ '(-o --output)'{-o+,--output=}'[write output to specified filename]:output filename:_files' \ '(-s --sign)'{-s+,--sign=}'[set signedness for output]:signedness:((0\:unsigned 1\:signed\ \(default\)))' \ '*:ogg vorbis file:_files -g "(#i)*.ogg(-.)"' && ret=0 ;; esac if [[ $state = devopts ]]; then if compset -p '*:'; then _message -e value value else _wanted devopts expl 'device option' \ compadd -S : - dsp dev card buf_size host byteorder && return fi fi return ret PK[ϸeOfunctions/_dpatch-edit-patchnuW+A#compdef dpatch-edit-patch _arguments \ '(-d --description)'{-d,--description=}'[description for the new patch, if applicable]' \ '(-o --outdir)'{-o,--outdir=}'[output directory for patches]:patch output directory:_files -/' \ '(-s --sourcedir)'{-s,--sourcedir=}'[source directory]:source directory:_files -/' \ '(-t --tmpdir)'{-t,--tmpdir=}'[temporary directory]:temporary directory:_files -/' \ '(-p --stampdir)'{-p,--stampdir=}'[stamp directory]:stamp directory:_files -/' \ '(-e --exclude)'{-e,--exclude}'[list of files and directories to be excluded]:excluded files and directories:_files' \ '(-b --debianonly)'{-b,--debianonly=}'[unpack .orig.tar.gz before invoking the shell]:path to .orig.tar.gz:_files' \ '(-k --keeptemp)'{-k,--keeptemp}'[keep working source tree after exit]' \ '(-c --clean)'{-c,--clean}'[clean the current directory]' \ '(-l --shell)'{-l,--shell=}'[shell to be invoked]:shell:' \ '(-P --origtargzpath)'{-P,--origtargzpath=}'[colon-separated list of paths containing upstream tarballs, use with -b]:path to upstream tarballs:_dir_list' \ '(-h --help)'{-h,--help}'[help text]' \ '1:patch name:_files -W $PWD/debian/patches -g \*.dpatch\(-.\:r\)' \ '2:base patch name:_files -W $PWD/debian/patches -g \*.dpatch\(-.\:r\)' PK[FMfunctions/_lsvgnuW+A#compdef lsvg _arguments -C -s \ '(-i -l -M -p)-o[lists only active volume groups]' \ '(-i -l -M -p)-n[specify physical volume to access variable descriptor from]:physical volume:_physical_volumes' \ '(-o -n)-i[reads volume group names from standard input]' \ '(-o -n -M -p)-l[list logical volumes in volume group]' \ '(-o -n -l -p)-M[list mapping of physical and logical partition numbers]' \ '(-o -n -l -M)-p[list physical volumes used by volume group]' \ '*:volume group:_volume_groups' PK[EGGfunctions/_mathnuW+A#compdef -math- let if [[ "$PREFIX" = *[^a-zA-Z0-9_]* ]]; then IPREFIX="$IPREFIX${PREFIX%%[a-zA-Z0-9_]#}" PREFIX="${PREFIX##*[^a-zA-Z0-9_]}" fi if [[ "$SUFFIX" = *[^a-zA-Z0-9_]* ]]; then ISUFFIX="${SUFFIX##[a-zA-Z0-9_]#}$ISUFFIX" SUFFIX="${SUFFIX%%[^a-zA-Z0-9_]*}" fi _parameters -g '(integer|float)*' || _parameters PK[_RRfunctions/tcp_renamenuW+A# Rename session OLD (defaults to current session) to session NEW. # Does not handle aliases; use tcp_alias for all alias redefinitions. local old new if (( $# == 1 )); then old=$TCP_SESS new=$1 elif (( $# == 2 )); then old=$1 new=$2 else print "Usage: $0 OLD NEW" >&2 return 1 fi local fd=$tcp_by_name[$old] if [[ -z $fd ]]; then print "No such session: $old" >&2 return 1 fi if [[ -n $tcp_by_name[$new] ]]; then print "Session $new already exists." >&2 return 1 fi # Can't rename an alias if [[ $tcp_by_fd[$fd] != $old ]]; then print "Use tcp_alias to redefine an alias." >&2 return 1 fi tcp_by_name[$new]=$fd unset "tcp_by_name[$old]" tcp_by_fd[$fd]=$new [[ $TCP_SESS = $old ]] && TCP_SESS=$new if zmodload -i zsh/parameter; then if (( ${+functions[tcp_on_rename]} )); then tcp_on_rename $new $fd $old fi fi PK[yVVfunctions/_arraysnuW+A#compdef shift local expl _wanted arrays expl array _parameters "$@" - -g '*array*' PK[aafunctions/_pkg_instancenuW+A#autoload local -A opts local whicharg zparseopts -E -D -- '-_opts:=opts' whicharg=${opts#*:} case ${opts%:*} in (installed) compadd "$@" - ${opt_args[$whicharg]}/var/sadm/pkg/*/pkginfo(:h:t) ;; (spooled) compadd "$@" - ${opt_args[$whicharg]}/*(:t) ;; (uninstalled) compadd "$@" - ${opt_args[$whicharg]:-/var/spool/pkg}/*/pkgmap(:h:t) ;; esac PK[DUFFfunctions/VCS_INFO_detect_bzrnuW+A## vim:ft=zsh ## bazaar support by: Frank Terbeck ## Distributed under the same BSD-ish license as zsh itself. setopt localoptions NO_shwordsplit [[ $1 == '--flavours' ]] && return 1 VCS_INFO_check_com bzr || return 1 vcs_comm[detect_need_file]=branch/format VCS_INFO_bydir_detect '.bzr' return $? PK[z0Piifunctions/url-quote-magicnuW+A# Functions to make it easier to type URLs as command line arguments. As # you type, the input character is analyzed and, if it may need quoting, # the current word is checked for a URI scheme. If one is found and the # current word is not already in quotes, a backslash is inserted before # the input character. # Setup: # autoload -Uz url-quote-magic # zle -N self-insert url-quote-magic # A number of zstyles may be set to control the quoting behavior. # # url-metas # This style is looked up in the context :url-quote-magic:SCHEME (where # SCHEME is that of the current URL, e.g. "ftp"). The value is a string # listing the characters to be treated as globbing metacharacters when # appearing in a URL using that scheme. The default is to quote all zsh # extended globbing characters, excluding '<' and '>' but including # braces (as in brace expansion). See also url-seps. # # url-seps # Like url-metas, but lists characters that should be considered command # separators, redirections, history references, etc. The default is to # quote the standard set of shell separators, excluding those that # overlap with the extended globbing characters, but including '<' and # '>' and the first character of $histchars. # # url-globbers # This style is looked up in the context :url-quote-magic. The values # form a list of command names that are expected to do their own globbing # on the URL string. This implies that they are aliased to use the # "noglob" modifier. When the first word on the line matches one of the # values AND the URL refers to a local file (see url-local-schema), only # the url-seps characters are quoted; the url-metas are left alone, # allowing them to affect command-line parsing, completion, etc. The # default values are a literal "noglob" plus (when the zsh/parameter # module is available) any commands aliased to the helper function # "urlglobber" or its alias "globurl". # # url-local-schema # This style is always looked up in the context :urlglobber, even though # it is used by both url-quote-magic and urlglobber. The values form # a list of URI schema that should be treated as referring to local files # by their real local path names, as opposed to files which are specified # relative to a web-server-defined document root. The defaults are "ftp" # and "file". # # url-other-schema # Like url-local-schema, but lists all other URI schema upon which # urlglobber and url-quote-magic should act. If the URI on the # command line does not have a scheme appearing either in this list or in # url-local-schema, it is not magically quoted. The default values are # "http", "https", and "ftp". When a scheme appears both here and in # url-local-schema, it is quoted differently depending on whether the # command name appears in url-globbers. # TODO: # Add a style for "document root" for globbing local URLs. # Turn this on at colon, and off again at space or accept. # Use compsys for nested quoting analysis and command parsing. # Establish default values for styles, but only if not already set zstyle -m ':url-quote-magic:\*' url-metas '*' || zstyle ':url-quote-magic:*' url-metas '*?[]^(|)~#{}=' zstyle -m ':url-quote-magic:\*' url-seps '*' || zstyle -e ':url-quote-magic:*' url-seps 'reply=(";&<>${histchars[1]}")' zstyle -m :url-quote-magic url-globbers '*' || zstyle -e :url-quote-magic url-globbers \ 'zmodload -i zsh/parameter; reply=( noglob ${(k)galiases[(R)(* |)(noglob|urlglobber|globurl) *]:-} ${(k)aliases[(R)(* |)(noglob|urlglobber|globurl) *]:-} )' zstyle -m ':urlglobber' url-local-schema '*' || zstyle ':urlglobber' url-local-schema ftp file zstyle -m ':urlglobber' url-other-schema '*' || zstyle ':urlglobber' url-other-schema http https ftp # Define the "urlglobber" helper function and shorthand "globurl" alias function urlglobber { local -a args globbed localschema otherschema local arg command="$1" shift zstyle -s :urlglobber url-local-schema localschema '|' zstyle -s :urlglobber url-other-schema otherschema '|' for arg do case "${arg}" in ((${~localschema}):/(|/localhost)/*) globbed=( ${~${arg##ftp://(localhost|)}} ) args[$#args+1]=( "${(M)arg##(${~localchema})://(localhost|)}${(@)^globbed}" ) ;; ((${~otherschema}):*) args[${#args}+1]="$arg";; (*) args[${#args}+1]=( ${~arg} );; esac done "$command" "${(@)args}" } alias globurl='noglob urlglobber ' # Finally, define (and execute if necessary) the function we really want function url-quote-magic { setopt localoptions noksharrays extendedglob local qkey="${(q)KEYS}" if [[ "$KEYS" != "$qkey" ]] then local lbuf="$LBUFFER$qkey" if [[ "${(Q)LBUFFER}$KEYS" == "${(Q)lbuf}" ]] then local -a words words=("${(@Q)${(z)lbuf}}") local urlseps urlmetas urlglobbers localschema otherschema if [[ "$words[-1]" == (#b)([^:]##):* ]] then zstyle -s ":url-quote-magic:$match[1]" url-seps urlseps '' zstyle -s ":url-quote-magic:$match[1]" url-metas urlmetas '' fi zstyle -s :url-quote-magic url-globbers urlglobbers '|' zstyle -s :urlglobber url-other-schema otherschema '|' if [[ "$words[1]" == ${~urlglobbers} ]] then zstyle -s :urlglobber url-local-schema localschema '|' else localschema=' ' fi case "$words[-1]" in (*[\'\"]*) ;; ((${~localschema}):/(|/localhost)/*) [[ "$urlseps" == *"$KEYS"* ]] && LBUFFER="$LBUFFER\\" ;; ((${~otherschema}):*) [[ "$urlseps$urlmetas" == *"$KEYS"* ]] && LBUFFER="$LBUFFER\\" ;; esac fi fi zle .self-insert } # Handle zsh autoloading conventions [[ -o kshautoload ]] || url-quote-magic "$@" PK[9functions/_iftopnuW+A#compdef iftop _interfaces () { _wanted interfaces expl 'network interface' \ _net_interfaces _values "Pseudo-device that captures on all interfaces" "any" } _arguments \ '(-h -n -N -p -b -B -P -i -f -F -c)'-h'[print a summary of usage]' \ -n"[don't do hostname lookups]" \ -N"[don't resolve port number to service names]" \ -p'[run in promiscuous mode]' \ -P'[turn on port display]' \ -b"[don't display bar graphs of traffic]" \ -B'[display bandwidth rates in bytes/sec rather than bits/sec]' \ -i'[interface]:network interface:_interfaces' \ -f'[filter]:BPF filter' \ -F'[net/mask]:network/mask' \ -c'[config file]:config file:_files' PK[Qeefunctions/_mysqldiffnuW+A#compdef mysqldiff local curcontext="$curcontext" state line expl typeset -A opt_args _mysqldiff () { _arguments -s \ {-h{,1,2},--host{,1,2}=}':server hostname:_mysql_hosts' \ {-p{,1,2},--password{,1,2}=}':server password: ' \ {-u{,1,2},--user{,1,2}=}':server username:_mysql_users' \ {-s{,1,2},--socket{,1,2}=}':server socket:_directories' \ {-d,--debug=}':debugging level (default 1):(1 2 3 4 5 6 7 8)' \ {-i,--tolerant}':ignore DEFAULT and formatting changes: ' \ {-k,--keep-old-tables}":don\'t output DROP TABLE commands: " \ {-n,--no-old-defs}"[don't output old defs as comments]" \ {-o,--only-both}'[only output changes for tables in both databases]' \ {-t,--table-re}':restrict comparisons to tables matching a regexp: ' \ {-A,--apply}':interactively patch database1 to match database2: ' \ {-\?,--help}'[display usage]' \ {1,2}':MySQL database:_mysql_db_or_file' } _mysql_db_or_file () { _alternative \ 'databases:MySQL databases:_mysql_databases' \ 'files:MySQL database definition files:_files -g "*.(my|)sql(-.)"' } _mysql_utils _mysqldiff "$@" PK[*+lfunctions/_axi-cachenuW+A#compdef axi-cache local expl _arguments \ '--version[version]' \ '(-h --help)'{-h,--help}'[help]' \ '(-s --sort)'{-s,--sort=}':sort value:('${(j: :)${${(M)${(f)"$(args' && return 0 if (( CURRENT == 2 )); then _wanted tag expl 'axi-cache commands' \ compadd help search more last show again else case "$words[2]" in (search|show|again) _wanted tag expl 'terms/query' \ compadd -- $($service $words[2] --tabcomplete=plain -- $words[CURRENT]) ;; (more|last) _wanted tag expl 'count' \ compadd -- 1 2 3 4 5 6 7 8 9 0 ;; (*) _files ;; esac fi PK[l}7%\ \ functions/_mplayernuW+A#compdef mplayer gmplayer local suf ret=1 curcontext="$curcontext" local -a vals state line expl _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' \ -xineramascreen: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 mfiles) _tags files urls while _tags; do _requested files expl 'video file' _files -g \ "*.(#i)(asf|asx|avi|flac|flv|m1v|m2p|m2v|mjpg|mka|mkv|mov|mp3|mp4|mpe|mpeg|mpg|ogg|ogm|qt|rm|vob|wav|wma|wmv)(-.)" && 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 done fi (( ret )) || return 0 done ;; audio-codecs) 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 ;; audio-drivers) vals=( help ${${${(f)"$(_call_program audio-drivers mplayer -ao help 2>/dev/null)"}[(r) *,-1]#?}/ /:} ) _describe -t audio-drivers 'audio drivers' vals && ret=0 ;; audio-codec-families) 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 ;; audio-plugins) _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 ;; video-codecs) 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 ;; video-drivers) vals=( help ${${${(f)"$(_call_program video-drivers mplayer -vo help 2>/dev/null)"}[(r) *,-1]#?}/ /:} ) _describe -t video-drivers 'video drivers' vals && ret=0 ;; video-output-plugins) 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 ;; esac return ret PK[functions/split-shell-argumentsnuW+A# Split a command line into shell arguments and whitespace in $reply. # Odd elements (starting from 1) are whitespace, even elements # are shell arguments (possibly quoted strings). Whitespace at # start and end is always included in the array but may be an empty string. # $REPLY holds NO_KSH_ARRAYS index of current word in $reply. # $REPLY2 holds NO_KSH_ARRAYS index of current character in current word. # Hence ${reply[$REPLY][$REPLY2]} is the character under the cursor. # # reply, REPLY, REPLY2 should therefore be local to the enclosing function. emulate -L zsh setopt extendedglob local -a bufwords lbufwords local word integer pos=1 cpos=$((CURSOR+1)) opos iword ichar bufwords=(${(z)BUFFER}) reply=() while [[ ${BUFFER[pos]} = [[:space:]] ]]; do (( pos++ )) done reply+=${BUFFER[1,pos-1]} (( cpos < pos )) && (( iword = 1, ichar = cpos )) for word in "${bufwords[@]}"; do (( opos = pos )) (( pos += ${#word} )) reply+=("$word") if (( iword == 0 && cpos < pos )); then (( iword = ${#reply} )) (( ichar = cpos - opos + 1 )) fi (( opos = pos )) while [[ ${BUFFER[pos]} = [[:space:]] ]]; do (( pos++ )) done reply+=("${BUFFER[opos,pos-1]}") if (( iword == 0 && cpos < pos )); then (( iword = ${#reply} )) (( ichar = cpos - opos + 1 )) fi done if (( iword == 0 )); then # At the end of the line, so off the indexable positions # (but still a valid cursor position). (( REPLY = ${#reply} )) (( REPLY2 = 1 )) else (( REPLY = iword )) (( REPLY2 = ichar )) fi PK[:{Efunctions/_conditionnuW+A#compdef -condition- local prev="$words[CURRENT-1]" ret=1 if [[ "$prev" = -o ]]; then _tags -C -o options && _options elif [[ "$prev" = -([a-hkprsuwxLOGSN]|[no]t|ef) ]]; then _tags -C "$prev" files && _files elif [[ "$prev" = -t ]]; then _file_descriptors else if [[ "$PREFIX" = -* ]] || ! zstyle -T ":completion:${curcontext}:options" prefix-needed; then if [[ "$prev" = (\[\[|\|\||\&\&|\!|\() ]]; then _describe -o 'condition code' \ '( -a:existing\ file -b:block\ special\ file -c:character\ special\ file -d:directory -e:existing\ file -f:regular\ file -g:setgid\ bit -h:symbolic\ link -k:sticky\ bit -n:non-empty\ string -o:option -p:named\ pipe -r:readable\ file -s:non-empty\ file -t:terminal\ file\ descriptor -u:setuid\ bit -w:writable\ file -x:executable\ file -z:empty\ string -L:symbolic\ link -O:own\ file -G:group-owned\ file -S:socket -N:unread\ file)' && ret=0 else _describe -o 'condition code' \ '( -nt:newer\ than -ot:older\ than -ef:same\ file -eq:numerically\ equal -ne:numerically\ not\ equal -lt:numerically\ less\ than -le:numerically\ less\ than\ or\ equal -gt:numerically\ greater\ than -ge:numerically\ greater\ than\ or\ equal)' && ret=0 fi fi _alternative 'files:: _files' 'parameters:: _parameters' && ret=0 return ret fi PK[rmmfunctions/_pfctlnuW+A#compdef pfctl local pfctl_flush_modifiers pfctl_optimizer_level pfctl_show_modifiers pfctl_tables_command pfctl_debug_level pfctl_flush_modifiers=( 'all:flush all' 'info:flush the filter information' 'nat:flush the NAT rules' 'osfp:flush the passive operating system fingerprints' 'queue:flush the queue rules' 'rules:flush the filter rules' 'state:flush the stable table' 'Sources:flush the source tracking table' 'Tables:flush the tables' ) pfctl_show_modifiers=( 'nat:show the currently loaded NAT rules' 'queue:show the currently loaded queue rules' 'rules:show the currently loaded filter rules' 'Anchors:show the currently loaded anchors directly attached to the main ruleset' 'state:show the contents of the state table' 'Sources:show the contents of the source tracking table' 'info:show filter information' 'labels:show per-rule statistics of filter rules with labels' 'timeouts:show the current global timeouts' 'memory:show the current pool memory hard limits' 'Tables:show the list of tables' 'osfp:show the list of operating system fingerprints' 'Interfaces:show the list of interfaces and interface drivers available to PF' 'all:show all except for the lists of interfaces and operating system fingerprints' ) pfctl_optimizer_level=( 'none:disable the ruleset optimizer' 'basic:enable basic ruleset optimizations' 'profile:enable basic ruleset optimizations with profiling' ) pfctl_tables_command=( 'kill:kill a table' 'flush:flush all addresses of a table' 'add:add one or more addresses in a table' 'delete:delete one or more addresses from a table' 'expire:delete addresses which had their statistics cleared more than number seconds ago' 'replace:replace the addresses of the table' 'show:show the content (addresses) of a table' 'test:test if the given addresses match a table' 'zero:clear all the statistics of a table' 'load:load only the table definitions from pf.conf(5)' ) pfctl_debug_level=( "none:don\'t generate debug messages" 'urgent:generate debug messages only for serious errors' 'misc:generate debug messages for various errors' 'loud:generate debug messages for common conditions' ) _iface() { local pfctl_iface pfctl_iface=($(pfctl -s Interfaces)) compadd $pfctl_iface } _tables() { local pfctl_tables pfctl_tables=($(pfctl -s Tables)) compadd $pfctl_tables } # TODO: # Missing -a # _arguments -s \ '-F[flush the filter parameters specified by modifier]:modifier:(($pfctl_flush_modifiers))' \ '-A[load only the queue rules present in the rule file]' \ '-D[define macro to be set to value]:macro:' \ '-d[disable the packet filter]' \ '-e[enable the packet filter]' \ '-f[load the rules contained in a file]:configuration file:_files' \ '-g[include output helpful for debugging]' \ '-h[help]' \ '-i[restrict the operation to the given interface]:interface:_iface' \ '-K[kill all of the source tracking entries originating from the specified host or network]:host or network:_hosts' \ '-k[kill all of the state entries originating from the specified host or network]:host or network:_hosts' \ '-m[merge in explicitly given options]' \ '-N[load only the NAT rules present in the rule file]' \ '-n[do not actually load rules, just parse them]' \ '-O[load only the options present in the rule file]' \ '-o[control the ruleset optimizer]:level:(($pfctl_optimizer_level))' \ '-p[use the device file device instead of the default /dev/pf]:device:_files' \ '-q[only print errors and warnings]' \ '-R[load only the filter rules present in the rule file]' \ '-r[perform reverse DNS lookups on states when displaying them]' \ '-s[show the filter parameters specified by modifier]:modifier:(($pfctl_show_modifiers ))' \ '-T[specify the command to apply to the table]:command:(($pfctl_tables_command))' \ '-t[specify the name of the table]:table:_tables' \ '-v[produce more verbose output]' \ '-x[set the debug level]:debug level:(($pfctl_debug_level))' \ '-z[clear per-rule statistics]' PK[65functions/_urxvtnuW+A#compdef urxvt _x_arguments \ -+{rv,ls,j,ptab,sb,sr,st,si,sk,sw,ip,ipf,ut,vb,tcw,insecure,uc,bc,pb,bl,ssc,ssr} \ '-tn:terminal type:' \ '-C[intercept console messages]' \ '-iconic[start iconic]' \ '-sbt[scroll bar thickness]:pixels:' \ '-tint[tint color]:color:_x_color' \ '-fade[make colors darker when losing focus]:percentage:' \ '-sh[shade background when tinting]:percentage:' \ '-bg:background color:_x_color' \ '-fg:foreground color:_x_color' \ '-cr:cursor color:_x_color' \ '-pr:pointer color:_x_color' \ '-pr2:pointer background color:_x_color' \ '-bd:border color:_x_color' \ '-pixmap:pixmap:_files' \ '-fn:normal font:_x_font' \ '-fb:bold font:_x_font' \ '-fi:italic font:_x_font' \ '-fbi:bold italic font:_x_font' \ '-im:input method:(SCIM)' \ '-pt:input style:(OverTheSpot OffTheSpot Root)' \ '-imlocale:locale input method:_locales' \ '-imfont:fontset for styles OverTheSpot and OffTheSpot:_x_font' \ '-name:client instance, icon, and title strings:' \ '-title:title name for window:' \ '-n:icon name for window:' \ '-sl:save lines:' \ '-embed:window id to embed terminal in:_x_window' \ '-pty-fd:file descriptor of pty to use:' \ '-w:external border in pixels:' \ '-b:internal border in pixels:' \ '-lsp:number of extra pixels between rows:' \ '-mod:meta modifier:_x_modifier' \ '-e:program: _command_names -e:*::program arguments: _normal' \ '-help[print help]' \ '--help[list long options]' PK[@ functions/_retrieve_mac_appsnuW+A#autoload # Find paths of applications and preserve them into _mac_apps. # Used by _mac_applications and _mac_files_for_application. _mac_apps_caching_policy () { # Rebuild if cache is more than a day old local -a oldp oldp=( "$1"(Nmw+1) ) (( $#oldp )) } # _mac_apps_*_retrieve # # Get search applications from directories specified in app_dir_root. # Paths to applications are stored in _mac_apps. _mac_apps_spotlight_retrieve () { typeset mdfind_query="kMDItemContentType == 'com.apple.application-*'" for i in ${app_dir_root}; do _mac_apps+=(${(f)"$(_call_program command \ mdfind -onlyin ${(q)i} ${(q)mdfind_query})"}) done } _mac_apps_old_retrieve () { # Get directories which may contain applications typeset -aU app_dir if [[ -z "$app_dir" ]] && \ ! zstyle -a ":completion:${curcontext}:commands" application-dir app_dir then typeset -a app_dir_stop_pattern app_dir_stop_pattern=( "*.app" "contents#" "*data" "*plugins#" "*plug?ins#" "fonts#" "document[[:alpha:]]#" "*help" "resources#" "images#" "*configurations#" ) typeset app_dir_pattern app_dir_pattern="(^(#i)(${(j/|/)app_dir_stop_pattern}))" app_dir=( ${^app_dir_root}/(${~app_dir_pattern}/)#(N) ) fi # Get application bundles local -a app_result if ! zstyle -t ":completion:${curcontext}:commands" ignore-bundle; then app_result=( ${^app_dir}*/Contents/(MacOS|MacOSClassic)(N) ) _mac_apps+=( ${app_result[@]%/Contents/MacOS*} ) fi # Get single file applications if ! zstyle -t ":completion:${curcontext}:commands" ignore-single; then autoload -Uz zargs local app_cand nargs envvars app_cand=( ${^app_dir}^*.[a-z]#/..namedfork/rsrc(.UrN,.RN^U) ) envvars="$(builtin typeset -x)" nargs=$(( $(command sysctl -n kern.argmax) - $#envvars - 2048 )) app_result="$(zargs --max-chars $nargs ${app_cand[@]} -- grep -l APPL)" _mac_apps+=( ${${(f)app_result}%/..namedfork/rsrc} ) fi } _retrieve_mac_apps() { local cache_policy zstyle -s ":completion:*:*:$service:*" cache-policy cache_policy if [[ -z "$cache_policy" ]]; then zstyle ":completion:*:*:$service:*" cache-policy _mac_apps_caching_policy fi if ( (( ${#_mac_apps} == 0 )) || _cache_invalid Mac_applications ) \ && ! _retrieve_cache Mac_applications; then # Get application search method typeset retrieve if ! zstyle -s ":completion:*:*:$service:commands" search-method retrieve then if [[ -d /.Spotlight-V100 ]]; then # / is indexed to use Spotlight retrieve=_mac_apps_spotlight_retrieve else # Fall back to the old way retrieve=_mac_apps_old_retrieve fi zstyle ":completion:*:*:$service:commands" search-method $retrieve fi # Get root directories to search applications typeset -a app_dir_root if ! zstyle -a ":completion:${curcontext}" application-path app_dir_root then if [[ $retrieve = _mac_apps_old_retrieve ]]; then app_dir_root=( {,/Developer,/Network,"$HOME"}/{Applications*(N),Desktop} ) else app_dir_root=( / ) fi zstyle ":completion:*" application-path $app_dir_root fi typeset -g -Ua _mac_apps $retrieve _store_cache Mac_applications _mac_apps fi } _retrieve_mac_apps "$@" PK[Ffunctions/VCS_INFO_bydir_detectnuW+A## vim:ft=zsh ## Written by Frank Terbeck ## Distributed under the same BSD-ish license as zsh itself. setopt localoptions NO_shwordsplit local dirname=$1 local basedir="." realbasedir realbasedir="$(VCS_INFO_realpath ${basedir})" while [[ ${realbasedir} != '/' ]]; do [[ -r ${realbasedir} ]] || return 1 if [[ -n ${vcs_comm[detect_need_file]} ]] ; then [[ -d ${basedir}/${dirname} ]] && \ [[ -e ${basedir}/${dirname}/${vcs_comm[detect_need_file]} ]] && \ break else [[ -d ${basedir}/${dirname} ]] && break fi basedir=${basedir}/.. realbasedir="$(VCS_INFO_realpath ${basedir})" done [[ ${realbasedir} == "/" ]] && return 1 vcs_comm[basedir]=${realbasedir} return 0 PK[Zƣ\\functions/_telnetnuW+A#compdef telnet # Parameter used: # # telnet_hosts_ports_users # The array that contains 3-tuples `host:port:user'. local curcontext="$curcontext" state line expl ret=1 typeset -A opt_args if (( ! $+_telnet_args )); then local help="$(_call_program options 'telnet -\?' < /dev/null 2>&1)" local -A optionmap optionmap=( '*\[-8\]*' '-8[allow 8-Bit data]' '*\[-E\]*' '-E[disable an escape character]' '*\[-K\]*' '-K[no automatic login]' '*\[-L\]*' '-L[allow 8-Bit data on output]' '*\[-N\]*' '-N[suppress reverse lookup]' '*\[-S tos\]*' '-S+:IP type-of-service:' '*\[-X atype\]*' '-X+:authentication type to disable:' '*\[-a\]*' '-a[attempt automatic login]' '*\[-c\]*' '-c[disable .telnetrc]' '*\[-d\]*' '-d[debug mode]' '*\[-e char\]*' '-e+[specify escape character]:escape character:' '*\[-f/*' '-f' '*/-F\]*' '-F' '*\[-k realm\]*' '-k+:realm:' '*\[-l user\]*' '-l+[specify user]:user:->users' '*\[-n tracefile\]*' '-n+[specify tracefile]:tracefile:_files' '*\[-r\]*' '-r[rlogin like user interface]' '*\[-s src_addr\]*' '-s+[set source IP address]:src_addr:' '*\[-x\]*' '-x' '*\[-t transcom\]*' '-t+:transcom:' '*\[-noasynch\]*' '-noasynch' '*\[-noasyncnet\]*' '-noasyncnet' '*\[-noasynctty\]*' '-noasynctty' ) _telnet_args=($optionmap[(K)"$help"]) (( $#_telnet_args )) || _telnet_args=( '-l+[specify user]:user:->users' ) fi _arguments -C -s \ "$_telnet_args[@]" \ ':host:->hosts' \ ':port:->ports' && ret=0 case "$state" in hosts) _wanted hosts expl host \ _combination -s '[@:]' '' users-hosts-ports \ ${opt_args[-l]:+users=${opt_args[-l]:q}} \ hosts - && ret=0 ;; ports) _wanted ports expl port \ _combination -s '[@:]' '' users-hosts-ports \ ${opt_args[-l]:+users=${opt_args[-l]:q}} \ hosts="${line[1]:q}" \ ports - && ret=0 ;; users) _wanted users expl user \ _combination -s '[@:]' '' users-hosts-ports \ ${line[2]:+hosts="${line[2]:q}"} \ ${line[3]:+ports="${line[3]:q}"} \ users - && ret=0 ;; esac return ret PK[P^{ { functions/_rloginnuW+A#compdef rlogin rsh remsh=rsh rcp _rcp_remote_files () { # There should be coloring based on all the different ls -F classifiers. local expl remfiles remdispf remdispd suf ret=1 if zstyle -T ":completion:${curcontext}:" remote-access; then remfiles=(${(M)${(f)"$(rsh ${IPREFIX%:} ls -d1F ${(Q)PREFIX%%[^./][^/]#}\* 2>/dev/null)"}%%[^/]#(|/)}) compset -P '*/' compset -S '/*' || suf='remote file' remdispf=(${remfiles:#*/}) remdispd=(${(M)remfiles:#*/}) _tags files while _tags; do while _next_label files expl ${suf:-remote directory}; do [[ -n $suf ]] && compadd "$@" "$expl[@]" -d remdispf \ ${(q)remdispf%[*=@|]} && ret=0 compadd ${suf:+-S/} "$@" "$expl[@]" -d remdispd \ ${(q)remdispd%/} && ret=0 done (( ret )) || return 0 done else _message -e remote-files 'remote file' fi } _rlogin () { case "$service" in rlogin) _arguments -s \ '-8[allow 8-Bit data]' \ '-e-[specify escape character]:escape character:' \ '-l[specify login user name]:login as:_rlogin_users' \ ':remote host name:_rlogin_hosts' ;; rsh|remsh) local context state line ret=1 typeset -A opt_args _arguments -s \ '-n[ignore stdin]' \ '-l[specify login user name]:login as:_rlogin_users' \ ':remote host name:_rlogin_hosts' \ '(-):command: _command_names -e' \ '*::command:->command' && ret=0 if [[ -n "$state" ]]; then shift 1 words (( CURRENT-- )) _normal && ret=0 fi return ret ;; rcp) local curcontext="$curcontext" state line ret=1 expl typeset -A opt_args _arguments -C -s \ '-p[preserve modification times]' \ '-r[recursively copy directories]' \ '*:files:->files' && ret=0 if [[ -n "$state" ]]; then if compset -P '*:'; then _rcp_remote_files && ret=0 elif compset -P '*@'; then _wanted hosts expl host _rlogin_hosts -S: && ret=0 else _alternative \ 'files:: _files' \ 'hosts:: _rlogin_all_hosts -S:' \ 'users:: _rlogin_users -qS@' && ret=0 fi fi return ret ;; esac } _rlogin_users () { _tags users && _combination -s '[:@]' my-accounts users-hosts users "$@" } _rlogin_hosts () { _tags hosts && if [[ "$IPREFIX" == *@ ]]; then _combination -s '[:@]' my-accounts users-hosts "users=${IPREFIX/@}" hosts "$@" else _combination -s '[:@]' my-accounts users-hosts \ ${opt_args[-l]:+"users=${opt_args[-l]:q}"} hosts "$@" fi } _rlogin_all_hosts () { _tags hosts && _combination -s '[:@]' my-accounts users-hosts hosts "$@" } _rlogin "$@" PK[}\jjfunctions/_gnutlsnuW+A#compdef gnutls-cli gnutls-cli-debug certtool srptool local _gnutls_supported _gnutls_supported_certtypes local _gnutls_supported_protocols _gnutls_supported_macs local _gnutls_supported_kx _gnutls_supported_comp local _gnutls_cli_common_args _gnutls_cli_common_args=( '(-d --debug)'{-d,--debug}':debug level' '(-p --port)'{-p,--port}':port' '(-h --help)'{-h,--help}'[help]' \ ) case "$service" in (gnutls-cli) _gnutls_supported="$(gnutls-cli --list)" _gnutls_supported_certtypes=(${(s:, :)${${(M)${(f)_gnutls_supported}:#Certificate types:*}#Certificate types: }}) _gnutls_supported_protocols=(${(s:, :)${${(M)${(f)_gnutls_supported}:#Protocols:*}#Protocols: }}) _gnutls_supported_ciphers=(${(s:, :)${${(M)${(f)_gnutls_supported}:#Ciphers:*}#Ciphers: }}) _gnutls_supported_macs=(${(s:, :)${${(M)${(f)_gnutls_supported}:#MACs:*}#MACs: }}) _gnutls_supported_kx=(${(s:, :)${${(M)${(f)_gnutls_supported}:#Key exchange algorithms:*}#Key exchange algorithms: }}) _gnutls_supported_comp=(${(s:, :)${${(M)${(f)_gnutls_supported}:#Compression methods:*}#Compression methods: }}) _arguments \ "$_gnutls_cli_common_args[@]" \ '(-r --resume)'{-r,--resume}'[resume session]' \ '(-s --starttls)'{-s,--starttls}'[start TLS on EOF or SIGALRM]' \ '--crlf[send CR LF instead of LF]' \ '--x509fmtder[use DER format for certificates to read from]' \ '(-f --fingerprint)'{-f,--fingerprint}'[send the openpgp fingerprint instead of the key]' \ '--disable-extensions[disable all the TLS extensions]' \ '--xml[print the certificate information in XML format]' \ '--print-cert[print the certificate in PEM format]' \ '--recordsize:maximum record size to advertise:' \ '(-V --verbose)'{-V,--verbose}'[more verbose output]' \ '--ciphers:ciphers to enable:('"$_gnutls_supported_ciphers"')' \ '--protocols:protocols to enable:('"$_gnutls_supported_protocols"')' \ '--comp:compression methods to enable:('"$_gnutls_supported_comp"')' \ '--macs:MACs to enable:('"$_gnutls_supported_macs"')' \ '--kx:key exchange methods to enable:('"$_gnutls_supported_kx"')' \ '--ctypes:certificate types to enable:('"$_gnutls_supported_certtypes"')' \ '--x509cafile:certificate file to use:_files' \ '--x509crlfile:CRL file to use:_files' \ '--pgpkeyfile:PGP key file to use:_files' \ '--pgpkeyring:PGP key ring file to use:_files' \ '--pgptrustdb:PGP trustdb file to use:_files' \ '--pgpcertfile:PGP public key (certificate) file to use:_files' \ '--x509keyfile:X.509 key file to use:_files' \ '--x509certfile:X.509 certificate file to use:_files' \ '--srpusername:SRP username to use' \ '--srppasswd:SRP password to use' \ '--insecure[do not require server cert validation]' \ '(-l --list)'{-l,--list}'[print list of the supported algorithms/modes]' \ '(-v --version)'{-v,--version}'[print version number]' \ '--copyright[print license]' \ ':hostname:_hosts' ;; (gnutls-cli-debug) _arguments \ "$_gnutls_cli_common_args[@]" \ '(-v --verbose)'{-v,--verbose}'[more verbose output]' \ ':hostname:_hosts' ;; (certtool) _arguments \ '(-s --generate-self-signed)'{-s,--generate-self-signed}'[generate a self-signed certificate]' \ '(-c --generate-certificate)'{-c,--generate-certificate}'[generate a signed certificate]' \ '--generate-crl[generate a CRL]' \ '(-u --update-certificate)'{-u,--update-certificate}'[update a signed certificate]' \ '(-p --generate-privkey)'{-p,--generate-privkey}'[generate a private key]' \ '(-q --generate-request)'{-q,--generate-request}'[generate a PKCS #10 certificate request]' \ '(-e --verify-chain)'{-e,--verify-chain}'[verify a PEM encoded certificate chain]' \ '--verify-crl[verify a CRL]' \ '--generate-dh-params[generate PKCS #3 encoded Diffie Hellman parameters]' \ '--get-dh-params[get the included PKCS #3 encoded Diffie Hellman parameters]' \ '--load-privkey:private key file:_files' \ '--load-request:certificate request file:_files' \ '--load-certificate:certificate file:_files' \ '--load-ca-privkey:certificate authority private key file:_files' \ '--load-ca-certificate:certificate authority certificate file:_files' \ '--password:password' \ '(-i --certificate-info)'{-i,--certificate-info}'[print information on a certificate]' \ '(-l --crl-info)'{-l,--crl-info}'[print information on a CRL]' \ '--p12-info[print information on a PKCS #12 structure]' \ '--p7-info[print information on a PKCS #7 structure]' \ '--smime-to-p7[convert S/MIME to PKCS #7 structure]' \ '(-k --key-info)'{-k,--key-info}'[print information on a private key]' \ '--fix-key[regenerate the parameters in a private key]' \ '--to-p12[generate a PKCS #12 structure]' \ '(-8 --pkcs8)'{-8,--pkcs8}'[use PKCS #8 format for private keys]' \ '--dsa[use DSA keys]' \ '--hash:hash algorithm for signing:(MD5 SHA1 RMD160)' \ '--export-ciphers[use weak encryption algorithms]' \ '--inder[use DER format for input certificates and private keys]' \ '--xml[use XML format for output certificates]' \ '--outder[use DER format for output certificates and private keys]' \ '--bits:number of bits for key generation' \ '--outfile:output file:_files ' \ '--infile:input file:_files ' \ '--template:template file to use for non-interactive operation:_files' \ '(-d --debug)'{-d,--debug}':debug level' \ '(-h --help)'{-h,--help}'[show help]' \ '(-v --version)'{-v,--version}'[show version]' \ '--copyright[shows license]' ;; (srptool) _arguments \ '(-u --username)'{-u,--username}':username:_users' \ '(-p --passwd)'{-p,--passwd}':password file:_files' \ '(-i --index)'{-i,--index}':index of params in tpasswd.conf' \ '(-s --salt)'{-s,--salt}':salt size for crypt algorithm' \ '--verify[just verify password]' \ '(-c --passwd-conf)'{-c,--passwd-conf}':password conf file:_files' \ '--create-conf:generate a tpasswd.conf file:_files' \ '(-v --version)'{-v,--version}'[show version]' \ '(-h --help)'{-h,--help}'[show help]' ;; esac PK[gY  functions/_requestednuW+A#autoload local __gopt __gopt=() zparseopts -D -a __gopt 1 2 V J x if comptags -R "$1"; then if [[ $# -gt 3 ]]; then _all_labels - "$__gopt[@]" "$@" || return 1 elif [[ $# -gt 1 ]]; then _description "$__gopt[@]" "$@" fi return 0 else return 1 fi PK[ʦttfunctions/_apachectlnuW+A#compdef apachectl apache2ctl _sub_commands start startssl stop restart fullstatus status graceful configtest help PK[W}functions/_apt-movenuW+A#compdef apt-move local curcontext="$curcontext" state line cmds ret=1 typeset -A opt_args _arguments -C \ '-a[process all packages]' \ '-c[specify an alternative configuration file]' \ '-d[override the DIST setting]' \ '-f[override the MAXDELETE setting]' \ '-q[be quiet; suppress normal output]' \ '-t[show what apt-move would do, but do not actually do anything]' \ '1: :->cmds' \ '*: :->args' && ret=0 case $state in cmds) cmds=( 'get:update your master files from local apt' 'getlocal:alias of get' 'fsck:fix broken repositories' 'move:move cache files into mirror tree' 'movefile:move files into the repository' 'delete:delete obsolete packages' 'packages:create new local Packages files' 'update:alias for: get move delete packages' 'local:alias for: move delete packages' 'localupdate:alias for: getlocal move delete packages' 'mirror:update your local mirror from remote rsync site' 'sync:same as mirror, but only gets packages that you currently have installed on your system' 'exclude:prints a list of all packages EXCLUDED from the mirror by the .exclude file' 'listbin:prints lists of packages which can serve as the input to mirrorbin(mirror,sync,repo)' 'listsrc:same as listbin, but lists source packages' 'mirrorbin:same as mirror, but gets the packages specified on stdin' 'mirrorsrc:same as mirrorbin, but gets source packages' ) _describe -t commands 'apt-move command' cmds && ret=0 ;; args) case $line[1] in get|getlocal) _directories && ret=0 ;; movefile) _files -g "*.d(sc|eb)(-.)" && ret=0 ;; listbin) _wanted lists expl list compadd mirror sync repo ;; esac ;; esac return ret PK[i}uufunctions/_directoriesnuW+A#compdef rmdir df dircmp -P -value-,*path,-default- local expl _wanted directories expl directory _files -/ "$@" - PK[V-functions/_java_classnuW+A#autoload # Should probably add some sort of cache. # Should we call _multi_parts instead of compadd? local classpath i expl local -a c local method type zparseopts -D -E -a classpath t:=type m:=method cp: classpath: : "$classpath[@]" classpath="${${classpath[2]:-${CLASSPATH:-.}}//\\:/:}" : "$classpath[@]" for i in "${(s.:.)classpath}"; do [[ -z $i ]] && i=. if [[ -f $i ]] && [[ "$i" == *.(jar|zip|war|ear) ]]; then c+=( ${${${(M)$(_call_program jar_classes jar -tf $i)##*.class}%%.class}:gs#/#.#} ) elif [[ -d $i ]]; then c+=( $i/**/*.class(.:r:s/.class//:s#$i/##:gs#/#.#) ) fi done _wanted classes expl 'java class' compadd "$@" -M 'r:|.=* r:|=*' -a - c PK[.a|_,_,functions/zsh-mime-setupnuW+Aemulate -L zsh setopt extendedglob cbases local opt o_verbose o_list autoload -Uz zsh-mime-handler while getopts "flv" opt; do case $opt in # List: show existing suffixes and their handlers then exit. (l) o_list=1 ;; # Verbose; print diagnostics to stdout. (v) o_verbose=1 ;; # Force; discard any existing settings before reading. (f) unset -m zsh_mime_\* ;; (*) [[ $opt = \? ]] || print -r "Option $opt not handled, complain" >&2 return 1 ;; esac done (( OPTIND > 1 )) && shift $(( OPTIND - 1 )) if [[ -n $o_list ]]; then # List and return. Remember that suffixes may be overridden by styles. # However, we require some sort of standard handler to be present, # so we don't need to search styles for suffixes that aren't # handled. Yet. local list_word local -a handlers if (( $# )); then handlers=(${(k)zsh_mime_handlers[(I)${(j.|.)*}]}) else handlers=(${(k)zsh_mime_handlers}) fi for suffix in ${(o)handlers}; do zstyle -s ":mime:.$suffix:" handler list_word || list_word=${zsh_mime_handlers[$suffix]} print ${(r.10.)suffix}$list_word zstyle -s ":mime:.$suffix:" flags list_word || list_word=${zsh_mime_flags[$suffix]} if [[ -n $list_word ]]; then print " flags: $list_word" fi done return 0 fi # Handler for each suffix. (( ${+zsh_mime_handlers} )) || typeset -gA zsh_mime_handlers # Corresponding flags, if any, for handler (( ${+zsh_mime_flags} )) || typeset -gA zsh_mime_flags # Internal maps read from MIME configuration files. # Note we don't remember the types, just the mappings from suffixes # to handlers and their flags. typeset -A suffix_type_map type_handler_map type_flags_map local -a default_type_files default_cap_files local -a type_files cap_files array match mbegin mend local file line type suffix exts elt flags line2 integer ind default_type_files=(~/.mime.types /etc/mime.types) default_cap_files=(~/.mailcap /etc/mailcap) # Customizable list of files to examine. if zstyle -a :mime: mime-types type_files; then while (( (ind = ${type_files[(I)+]}) > 0 )); do type_files[$ind]=($default_type_files) done else type_files=($default_type_files) fi if zstyle -a :mime: mailcap cap_files; then while (( (ind = ${cap_files[(I)+]}) > 0 )); do cap_files[$ind]=($default_cap_files) done else cap_files=($default_cap_files) fi { mime-setup-add-type() { local type suffix local -a array type=$1 shift while (( $# )); do # `.ps' instead of `ps' has been noted suffix=${1##.} shift if [[ -z $suffix_type_map[$suffix] ]]; then [[ -n $o_verbose ]] && print -r "Adding type $type for $suffix" >&2 suffix_type_map[$suffix]=$type else # Skip duplicates. array=(${=suffix_type_map[$suffix]}) if [[ ${array[(I)$type]} -eq 0 ]]; then [[ -n $o_verbose ]] && print -r "Appending type $type for already defined $suffix" >&2 suffix_type_map[$suffix]+=" $type" fi fi done } # Loop through files to find suffixes for MIME types. # Earlier entries take precedence, so the files need to be listed # with the user's own first. This also means pre-existing # values in suffix_type_map are respected. for file in $type_files; do [[ -r $file ]] || continue # For once we rely on the fact that read handles continuation # lines ending in backslashes, i.e. there's no -r. while read line; do # Skip blank or comment lines. [[ $line = [[:space:]]#(\#*|) ]] && continue # There are two types of line you find in MIME type files. # The original simple sort contains the type name then suffixes # separated by whitespace. However, Netscape insists # on adding lines with backslash continuation with # key="value" pairs. So we'd better handle both. if [[ $line = *=* ]]; then # Gory. # This relies on the fact that a typical entry: # type=video/x-mpeg2 desc="MPEG2 Video" exts="mpv2,mp2v" # looks like a parameter assignment. However, we really # don't want to be screwed up by future extensions, # so we split the elements to an array and pick out the # ones we're interested in. type= exts= # Syntactically split line to preserve quoted words. array=(${(z)line}) for elt in $array; do if [[ $elt = (type|exts)=* ]]; then eval $elt fi done # Get extensions by splitting on comma array=(${(s.,.)exts}) [[ -n $type ]] && mime-setup-add-type $type $array else # Simple. mime-setup-add-type ${=line} fi done <$file done } always { unfunction mime-setup-add-type >&/dev/null } local -a pats_prio o_prios local o_overwrite sentinel typeset -A type_prio_flags_map type_prio_src_map type_prio_mprio_map integer src_id prio mprio # A list of keywords indicating the methods used to break ties amongst multiple # entries. The following keywords are accepted: # files: The order of files read: Entries from files read earlier are preferred # (The default value of the variable is a list with this keyword alone) # priority: The priority flag is matched in the entry. Can be a value from 0 to # 9. The default priority is 5. Higher priorities are preferred. # flags: See the mailcap-prio-flags option # place: Always overrides. Useful for specifying that entries read later are # preferred. # # As the program reads mailcap entries, if it encounters a duplicate # entry, each of the keywords in the list are checked to see if the new # entry can override the existing entry. If none of the keywords are able # to decide whether the new entry should be preferred to the older one, the # new entry is discarded. zstyle -a :mime: mailcap-priorities o_prios || o_prios=(files) # This style is used as an argument for the flags test in mailcap-priorities. # This is a list of patterns, each of which is tested against the flags for the # mailcap entry. An match with a pattern ahead in the list is preferred as # opposed to a match later in the list. An unmatched item is least preferred. zstyle -a :mime: mailcap-prio-flags pats_prio # Loop through files to find handlers for types. ((src_id = 0)) for file in $cap_files; do [[ -r $file ]] || continue ((src_id = src_id + 1)) # Oh, great. We need to preserve backslashes inside the line, # but need to manage continuation lines. while read -r line; do # Skip blank or comment lines. [[ $line = [[:space:]]#(\#*|) ]] && continue while [[ $line = (#b)(*)\\ ]]; do line=$match[1] read -r line2 || break line+=$line2 done # Guess what, this file has a completely different format. # See mailcap(4). # The biggest unpleasantness here is that the fields are # delimited by semicolons, but the command field, which # is the one we want to extract, may itself contain backslashed # semicolons. if [[ $line = (#b)[[:space:]]#([^[:space:]\;]##)[[:space:]]#\;(*) ]] then # this is the only form we can handle, but there's no point # issuing a warning for other forms. type=$match[1] line=$match[2] # See if it has flags after the command. if [[ $line = (#b)(([^\;\\]|\\\;|\\[^\;])#)\;(*) ]]; then line=$match[1] flags=$match[3] else flags= fi # Remove quotes from semicolons line=${line//\\\;/\;} # and remove any surrounding white space --- this might # make the handler empty. line=${${line##[[:space:]]#}%%[[:space:]]} ((prio = 0)) for i in $pats_prio; do # print -r "Comparing $i with '$flags'" >&2 [[ $flags = ${~i} ]] && break # print -r "Comparison failed" >&2 ((prio = prio + 1)) done ((mprio=5)) [[ $flags = (#b)*priority=([0-9])* ]] && mprio=$match[1] sentinel=no if [[ -n $type_handler_map[$type] ]]; then for i in $o_prios; do case $i in (files) if [[ $src_id -lt $type_prio_src_map[$type] ]]; then sentinel=yes; break elif [[ $src_id -gt $type_prio_src_map[$type] ]]; then sentinel=no; break fi ;; (priority) if [[ $mprio -gt $type_prio_mprio_map[$type] ]]; then sentinel=yes; break elif [[ $mprio -lt $type_prio_mprio_map[$type] ]]; then sentinel=no; break fi ;; (flags) if [[ $prio -lt $type_prio_flags_map[$type] ]]; then sentinel=yes; break elif [[ $prio -gt $type_prio_flags_map[$type] ]]; then sentinel=no; break fi ;; (place) sentinel=yes break ;; esac done else sentinel=yes fi if [[ $sentinel = yes ]]; then if [[ -n $o_verbose ]]; then if [[ -n $type_handler_map[$type] ]]; then print -r "Overriding" >&2 else print -r "Adding" >&2 fi print -r " handler for type $type:" >&2 print -r " $line" >&2 fi type_handler_map[$type]=$line type_flags_map[$type]=$flags type_prio_src_map[$type]=$src_id type_prio_flags_map[$type]=$prio type_prio_mprio_map[$type]=$mprio if [[ -n $flags && -n $o_verbose ]]; then print -r " with flags $flags" >&2 fi elif [[ -n $o_verbose ]]; then print -r "Skipping handler for already defined type $type:" >&2 print -r " $line" >&2 if [[ -n $flags ]]; then print -r " with flags $flags" >&2 fi fi fi done <$file done # Check for styles which override whatever is in the file. # We need to make sure there is a handler set up; for some # uses we may need to defer checking styles until zsh-mime-handler. # How much we need to do here is a moot point. zstyle -L | while read line; do array=(${(Q)${(z)line}}) if [[ $array[3] = (handler|flags) && \ $array[2] = (#b):mime:.([^:]##):(*) ]]; then suffix=$match[1] # Make sure there is a suffix alias set up for this. alias -s $suffix >&/dev/null || alias -s $suffix=zsh-mime-handler # Also for upper case variant alias -s ${(U)suffix} >&/dev/null || alias -s ${(U)suffix}=zsh-mime-handler fi done # Now associate the suffixes directly with handlers. # We just look for the first one with a handler. # If there is no handler, we don't bother registering an alias # for the suffix. for suffix line in ${(kv)suffix_type_map}; do # Skip if we already have a handler. [[ -n $zsh_mime_handlers[$suffix] ]] && continue # Split the space-separated list of types. array=(${=line}) # Find the first type with a handler. line2= for type in $array; do line2=${type_handler_map[$type]} [[ -n $line2 ]] && break done # See if there is a generic type/* handler. # TODO: do we need to consider other forms of wildcard? if [[ -z $line2 ]]; then for type in $array; do type="${type%%/*}/*" line2=${type_handler_map[$type]} [[ -n $line2 ]] && break done fi if [[ -n $line2 ]]; then # Found a type with a handler. # Install the zsh handler as an alias, but never override # existing suffix handling. alias -s $suffix >&/dev/null || alias -s $suffix=zsh-mime-handler alias -s ${(U)suffix} >&/dev/null || alias -s ${(U)suffix}=zsh-mime-handler zsh_mime_handlers[$suffix]=$line2 zsh_mime_flags[$suffix]=$type_flags_map[$type] fi done true PK[W__functions/_vorbiscommentnuW+A#compdef vorbiscomment #Written by Jesse Weinstein , Wed Jul 19 15:31:11 2006 #Version 0.9 - could handle -t option slightly better #Released under the MIT license (or any compatible free-content license) #i.e. do whatever you like with it, but credit me. _arguments \ '-h[help]' \ '-q[quiet]' \ '(-a -w -q -c -t 2)-l[list comments]' \ '(-l)-a[append comments]' \ '(-l)-w[overwrite comments]' \ '(-l -c)-t[tag and value]:: ' \ '(-l -t)-c[tag file]::_files' \ '1:OGG file:_files -g \*.ogg' \ '(-l)2:output OGG file:_files -g \*.ogg' \ && return 0 PK[ȧMSSfunctions/_cplaynuW+A#compdef cplay _arguments -s \ '-n[enable restricted mode]' \ '-r[toggle playlist repeat mode]' \ '-R[toggle playlist random mode]' \ '-v[toggle PCM and MASTER volume control]' \ '*:playlist or directory or audio file:_files -g "*.(mp3|mp2|ogg|669|amf|ams|dsm|far|it|med|mod|mt2|mtm|okt|s3m|stm|ult|gdm|xm|m3u|pls|spx|wav|au)"' PK[!a,,functions/VCS_INFO_detect_svnnuW+A## vim:ft=zsh ## subversion support by: Frank Terbeck ## Distributed under the same BSD-ish license as zsh itself. setopt localoptions NO_shwordsplit [[ $1 == '--flavours' ]] && return 1 VCS_INFO_check_com ${vcs_comm[cmd]} || return 1 [[ -d ".svn" ]] && return 0 return 1 PK[functions/_commandnuW+A#compdef command local ret # indicate if this is a precommand modifier [[ $service = command ]] && precommands+=(command) if [[ CURRENT -ge 3 ]]; then compset -n 2 _normal && ret=0 else _path_commands "$@" && ret=0 fi return ret PK[7functions/_redirectnuW+A#compdef -redirect- local strs _comp_command1 _comp_command2 _comp_command _set_command strs=( -default- ) if [[ "$CURRENT" != "1" ]]; then strs=( "${_comp_command}" "$strs[@]" ) if [[ -n "$_comp_command1" ]]; then strs=( "${_comp_command1}" "$strs[@]" ) [[ -n "$_comp_command2" ]] && strs=( "${_comp_command2}" "$strs[@]" ) fi fi _dispatch -redirect-,{${compstate[redirect]},-default-},${^strs} PK[uF9 9 functions/_cdrdaonuW+A#compdef cdrdao # TODO: Options must come before parameters. # Command completion and main loop {{{1 _cdrdao_commands () { local -a commands commands=( 'show-toc:print out a summary of a TOC' 'read-toc:create a TOC file based on a CD' 'read-cd:create a TOC file and image file based on a CD' 'read-cddb:add CD-TEXT data from a CDDB server to a TOC' 'show-data:print out samples that would be written to CD' 'read-test:check if data described in a TOC can be read from a CD' 'disk-info:show information about a CD' 'msinfo:generate mkisofs command for creating multi-session CD' 'unlock:try to unlock a recorder after a failed run' 'blank:blank a CD-RW' 'simulate:simulate a write' 'write:write a CD based on a TOC' 'copy:copy a CD' ) _describe -t commands 'cdrdao command' commands && ret=0 } _cdrdao () { local curcontext=$curcontext ret=1 local context state line typeset -A opt_args _arguments \ ':command:->command' \ '*::options:->options' && ret=0 case $state in (command) _cdrdao_commands ;; (options) curcontext="${curcontext%:*:*}:cdrdao-$words[1]:" _call_function ret _cdrdao-$words[1] ;; esac } # Common arguments {{{1 declare -ga tmpfile_args tmpfile_args=( '--tmpdir[directory to store temporary data in]:directory:_directories' '--keep[do not remove temporary data when done]') declare -ga device_args device_args=( '--device[set SCSI address of the CD recorder]:device:__cdrdao-device' '--driver[use given driver for the CD recorder]:driver:__cdrdao-drivers') # TODO: Gah! Fix a cddb server spec matcher declare -ga cddb_args cddb_args=( '--cddb-servers[specify list of CDDB servers to use]:CDDB servers:' '--cddb-timeout[specify timeout in seconds for connections to CDDB servers]: :_guard "[[\:digit\:]]" timeout' '--cddb-directory[directory where fetched CDDB records will be stored]:directory:_directories') declare -g paranoiamode_arg= paranoiamode_arg='--paranoia-mode[set correction mode for digital audio extraction]:mode:(("0\:no checking" "1\:perform overlapped reading to avoid jitter" "2\:like 1 but with checks of read audio data" "3\:like 2 but with scratch detection/repair (default)"))' declare -g fasttoc_arg= fasttoc_arg='--fast-toc[skip pre-gap-length and index-mark extraction]' declare -g swap_arg= swap_arg='--swap[swap the byte order of samples]' declare -g reload_arg= reload_arg='--reload[reload the disk if necessary]' declare -g eject_arg= eject_arg='--eject[eject CD after completed operation]' declare -g speed_arg= speed_arg='-speed[set writing speed]: :_guard "[[\:digit\:]]##" speed' declare -ga common_args common_args=( '(*)'{-h,--help}'[display command/option summary]' '-v[set verbosity level]: :_guard "[[\:digit\:]]##" verbosity') declare -ga common_toc_args common_toc_args=( $common_args ':TOC file:_files -g "*.toc"') declare -ga common_device_args common_device_args=( $common_args $device_args) declare -ga common_toc_device_args common_toc_device_args=( $common_toc_args $common_device_args $force_arg) declare -ga common_read_args common_read_args=( '--rspeed[set reading speed]: :_guard "[[\:digit\:]]##" speed' '--session[specify what session to process on multi-session CDs]: :_guard "[[\:digit\:]]##" "session number"' '--read-subchan[set sub-channel reading-mode]:mode:(("rw\:de-interleaved and error corrected" "rw_raw\:not de-interleaved, not error-corrected, and L-EC data included"))' '--tao-source[indicate that source CD was written in TAO mode]' '--with-cddb[retrieve CD-TEXT data from a CDDB server]') # Sub-command completion {{{1 _cdrdao-show-toc () { __cdrdao-show-toc-or-toc-info-or-toc-size } _cdrdao-toc-info () { __cdrdao-show-toc-or-toc-info-or-toc-size } _cdrdao-toc-size () { __cdrdao-show-toc-or-toc-info-or-toc-size } __cdrdao-show-toc-or-toc-info-or-toc-size () { _arguments \ $common_toc_args \ $tmpfile_args && ret=0 } _cdrdao-read-toc () { __cdrdao-read-toc-or-read-cd \ $fasttoc_arg } _cdrdao-read-cd () { __cdrdao-read-toc-or-read-cd \ $paranoiamode_arg } __cdrdao-read-toc-or-read-cd () { local -a dependent_args __cdrdao-read-toc-or-read-cd-or-copy-dependent-args _arguments \ $common_toc_device_args \ $common_read_args \ $dependent_args '--datafile[set name of data file placed in TOC file]:file:_files' \ '--read-raw[read data in raw format from CD]' \ '--no-mode2-mixed[if MODE2_FORM1 or MODE2_FORM2, do not extract as MODE2_FORM_MIX]' \ $* && ret=0 } _cdrdao-read-cddb () { _arguments \ $common_toc_args \ $cddb_args && ret=0 } _cdrdao-show-data () { _arguments \ $common_toc_args \ $swap_arg && ret=0 } _cdrdao-read-test () { _arguments \ $common_toc_args && ret=0 } _cdrdao-disk-info () { __cdrdao-disk-info-or-drive-info } __cdrdao-disk-info-or-drive-info () { _arguments \ $common_device_args && ret=0 } _cdrdao-msinfo () { _arguments \ $common_device_args \ $reload_arg && ret=0 } _cdrdao-drive-info () { __cdrdao-disk-info-or-drive-info } _cdrdao-unlock () { _arguments \ $common_device_args \ $reload_arg \ $eject_arg && ret=0 } _cdrdao-blank () { _arguments \ $common_device_args \ $speed_arg \ '--blank-mode[set the blanking mode]:blanking mode:(("full\:completely erase data" "minimal\:only dereference data"))' \ $eject_arg && ret=0 } _cdrdao-scanbus () { _arguments \ $common_args && ret=0 } _cdrdao-simulate () { __cdrdao-simulate-or-write } __cdrdao-simulate-or-write () { local capacity_arg= if (( $words[(I)--full-burn] )); then capacity_arg='--capacity[set disk capacity for --full-burn]: :_guard "[[\:digit\:]]" minutes' fi _arguments \ $common_toc_device_args \ $speed_arg \ '--multi[do not close the session after successful write]' \ '--overburn[allow overburing of medium]' \ '--full-burn[force burning to the outer disk edge]' \ $capacity_arg \ $eject_arg \ $swap_arg \ '--buffers[set fifo buffer size]: :_guard "[[\:digit\:]]" size' \ $reload_arg \ $tmpfile_args \ '-n[do not pause before writing]' \ $* && ret=0 } _cdrdao-write () { __cdrdao-simulate-or-write \ '--simulate[only perform a write simulation]' \ '--buffer-under-run-protection[whether to use buffer under-run protection]:buffer under-run protection setting:(("0\:disable buffer under-run protection" "1\:enable buffer under-run protection"))' \ '--write-speed-control[whether to use writing-speed control]:writing-speed control setting:(("0\:disable writing-speed control" "1\:enable writing-speed control"))' \ $* } __cdrdao-read-toc-or-read-cd-or-copy-dependent-args () { if (( words[(I)--tao-source] )); then dependent_args+='--tao-source-adjust[specify number of link blocks for tracks written in TAO mode]: :_guard "[[\:digit\:]]##" "link blocks"' fi if (( words[(I)--with-cddb] )); then dependent_args+=$cddb_args fi } _cdrdao-copy () { local -ga dependent_args __cdrdao-read-toc-or-read-cd-or-copy-dependent-args _cdrdao-write \ $dependent_args $common_read_args '--source-device[set SCSI address of the CD reader]:device:__cdrdao-device' \ '--source-driver[use given driver for the CD reader]:driver:__cdrdao-drivers' \ '--on-the-fly[perform on-the-fly copy of CD (no image created)]' \ $fasttoc_arg \ '--keepimage[do not remove generated image when done]' \ $paranoiamode_arg && ret=0 } # Type completion {{{1 __cdrdao-device () { # Use cdrdao scanbus and also check what OS we’re running under and provide # additional stuff, like devices (/dev/sg0) local -a devices devices=(${(f)"$(_call_program devices cdrdao scanbus -v 0 2>/dev/null)"}) if (( ${#pipestatus:#0} > 0 )); then return 1 fi _wanted devices expl 'device' compadd - $devices } __cdrdao-drivers () { local -a drivers drivers=(${(f)"$(_call_program drivers cut -d'|' -f4 /usr/share/cdrdao/drivers -s 2>/dev/null | sort -u)"}) if (( ${#pipestatus:#0} > 0 )); then return 1 fi _wanted drivers expl 'driver' compadd -qS: - $drivers } # }}}1 _cdrdao PK[#kfunctions/_arg_compilenuW+A#autoload # A simple compiler for _arguments descriptions. The first argument of # _arg_compile is the name of an array parameter in which the parse is # returned. The remaining arguments form a series of `phrases'. Each # `phrase' begins with one of the keywords "argument", "option", or "help" # and consists of a series of keywords and/or values. The syntax is as # free-form as possible, but "argument" phrases generally must appear in # the same relative position as the corresponding argument on the command # line to be completed, and there are some restrictions on ordering of # keywords and values within each phrase. # # Anything appearing before the first phrase or after the last is passed # through verbatim. (See TODO.) If more detailed mixing of compiled and # uncompiled fragments is necessary, use two or more calls, either with # different array names or by passing the output of each previous call # through the next. # # In the documentation below, brackets [ ] indicate optional elements and # braces { } indicate elements that may be repeated zero or more times. # Except as noted, bracketed or braced elements may appear in any order # relative to each other, but tokens within each element are ordered. # # argument [POS] [means MSG] [action ACT] # # POS may be an integer N for the Nth argument or "*" for all, and # must appear first if it appears at all. # MSG is a string to be displayed above the matches in a listing. # ACT is (currently) as described in the compsys manual. # # option OPT [follow HOW] [explain STR] {unless XOR} \ # {[means MSG] [action ACT]} [through PAT [means MSG] [action ACT]] # # OPT is the option, prefixed with "*" if it may appear more than once. # HOW refers to a following argument, and may be one of: # "close" must appear in the same word (synonyms "join" or "-") # "next" the argument must appear in the next word (aka "split") # "loose" the argument may appear in the same or the next word ("+") # "assign" as loose, but must follow an "=" in the same word ("=") # HOW should be suffixed with a colon if the following argument is # _not_ required to appear. # STR is to be displayed based on style `description' # XOR is another option in combination with which OPT may not appear. # It may be ":" to disable non-option completions when OPT is present. # MSG is a string to be displayed above the matches in a listing. # ACT is (currently) as described in the compsys manual. # PAT is either "*" for "all remaining words on the line" or a pattern # that, if matched, marks the end of the arguments of this option. # The "through PAT ..." description must be the last. # PAT may be suffixed with one colon to narrow the $words array to # the remainder of the command line, or with two colons to narrow # to the words before (not including) the next that matches PAT. # # help PAT [means MSG] action ACT # # ACT is applied to any option output by --help that matches PAT. # Do not use "help" with commands that do not support --help. # PAT may be suffixed with a colon if the following argument is # _not_ required to appear (this is usually inferred from --help). # MSG is a string to be displayed above the matches in a listing. # EXAMPLE: # This is from _gprof in the standard distribution. Note that because of # the brace expansion trick used in the "function name" case, no attempt # is made to use `phrase' form; that part gets passed through unchanged. # It could simply be moved to the _arguments call ahead of "$args[@]". # # _arg_compile args -s -{a,b,c,D,h,i,l,L,s,T,v,w,x,y,z} \ # -{A,C,e,E,f,F,J,n,N,O,p,P,q,Q,Z}:'function name:->funcs' \ # option -I means directory action _dir_list \ # option -d follow close means "debug level" \ # option -k means "function names" action '->pair' \ # option -m means "minimum execution count" \ # argument means executable action '_files -g \*\(-\*\)' \ # argument means "profile file" action '_files -g gmon.\*' \ # help '*=name*' means "function name" action '->funcs' \ # help '*=dirs*' means "directory" action _dir_list # _arguments "$args[@]" # TODO: # Verbose forms of various actions, e.g. (but not exactly) # "state foo" becomes "->foo" # "completion X explain Y ..." becomes "((X\:Y ...))" # etc. # Represent leading "*" in OPT some other way. # Represent trailing colons in HOW and PAT some other way. # Stricter syntax checking on HOW, sanity checks on XOR. # Something less obscure than "unless :" would be nice. # Warning or other syntax check for stuff after the last phrase. emulate -L zsh local -h argspec dspec helpspec prelude xor local -h -A amap dmap safe [[ -n "$1" ]] || return 1 [[ ${(tP)${1}} = *-local ]] && { print -R NAME CONFLICT: $1 1>&2; return 1 } safe[reply]="$1"; shift # First consume and save anything before the argument phrases helpspec=() prelude=() while (($#)) do case $1 in (argument|help|option) break;; (*) prelude=("$prelude[@]" "$1"); shift;; esac done # Consume all the argument phrases and build the argspec array while (($#)) do amap=() dspec=() case $1 in # argument [POS] [means MSG] [action ACT] (argument) shift while (($#)) do case $1 in (<1->|\*) amap[position]="$1"; shift;; (means|action) amap[$1]="$2"; shift 2;; (argument|option|help) break;; (*) print -R SYNTAX ERROR at "$@" 1>&2; return 1;; esac done if (( $#amap )) then argspec=("$argspec[@]" "${amap[position]}:${amap[means]}:${amap[action]}") fi;; # option OPT [follow HOW] [explain STR] {unless XOR} \ # {[through PAT] [means MSG] [action ACT]} (option) amap[option]="$2"; shift 2 dmap=() xor=() while (( $# )) do (( ${+amap[$1]} || ${+dmap[through]} )) && break; case $1 in (follow) amap[follow]="${2:s/join/-/:s/close/-/:s/next//:s/split//:s/loose/+/:s/assign/=/:s/none//}" shift 2;; (explain) amap[explain]="[$2]" ; shift 2;; (unless) xor=("$xor[@]" "${(@)=2}"); shift 2;; (through|means|action) while (( $# )) do (( ${+dmap[$1]} )) && break 2 case $1 in (through|means|action) dmap[$1]=":${2}"; shift 2;; (argument|option|help|follow|explain|unless) break;; (*) print -R SYNTAX ERROR at "$@" 1>&2; return 1;; esac done;; (argument|option|help) break;; (*) print -R SYNTAX ERROR at "$@" 1>&2; return 1;; esac if (( $#dmap )) then dspec=("$dspec[@]" "${dmap[through]}${dmap[means]:-:}${dmap[action]:-:}") fi done if (( $#amap )) then argspec=("$argspec[@]" "${xor:+($xor)}${amap[option]}${amap[follow]}${amap[explain]}${dspec}") fi;; # help PAT [means MSG] action ACT (help) amap[pattern]="$2"; shift 2 while (($#)) do (( ${+amap[$1]} )) && break; case $1 in (means|action) amap[$1]="$2"; shift 2;; (argument|option|help) break;; (*) print -R SYNTAX ERROR at "$@" 1>&2; return 1;; esac done if (( $#amap )) then helpspec=("$helpspec[@]" "${amap[pattern]}:${amap[means]}:${amap[action]}") fi;; (*) break;; esac done eval $safe[reply]'=( "${prelude[@]}" "${argspec[@]}" ${helpspec:+"-- ${helpspec[@]}"} "$@" )' # print -R _arguments "${prelude[@]:q}" "${argspec[@]:q}" ${helpspec:+"-- ${helpspec[@]:q}"} "$@:q" return 0 PK[ W W functions/_qivnuW+A#compdef qiv _arguments -s \ '(- *)'{-h,--help}'[display help information]' \ '(- *)'{-v,--version}'[display version information]' \ '--display:display:_x_display' \ \*{-F,--file}'[read file names from file]:file:_files' \ '(-e --center)'{-e,--center}'[disable window centering]' \ '(-w --fixed_width -W --fixed_zoom)'{-w,--fixed_width}'[use window with specified width]:width' \ '(-w --fixed_width -W --fixed_zoom)'{-W,--fixed_zoom}'[use window with specified zoom factor]:zoom (percentage)' \ '(-x -y -z --root --root_t --root_s -f --file *)'{-x,--root}'[use image as the current desktop background, centered]:image file:_files' \ '(-x -y -z --root --root_t --root_s -f --file *)'{-y,--root_t}'[use image on the current desktop background, tiled]:image file:_files' \ '(-x -y -z --root --root_t --root_s -f --file *)'{-z,--root_s}'[use image as the current desktop background, stretched]:image file:_files' \ '(-m --maxpect)'{-m,--maxpect}'[expand image to fit screen size]' \ '(-t --scale_down)'{-t,--scale_down}'[shrink images to fit screen size]' \ '(-b --brightness)'{-b,--brightness}'[set brightness]:brightness (-32..32)' \ '(-c --contrast)'{-c,--contrast}'[set contrast]:contrast (-32..32)' \ '(-g --gamma)'{-g,--gamma}'[set gamma]:gamma (-32..32)' \ '(-n --no_filter)'{-n,--no_filter}'[disable filtering of images by extension]' \ '(-i --no_statusbar -I --statusbar)'{-i,--no_statusbar}'[disable statusbar]' \ '(-i --no_statusbar -I --statusbar)'{-I,--statusbar}'[enable statusbar]' \ '(-p --transparency)'{-p,--transparency}'[enable transparency]' \ '(-a --do_grab)'{-a,--do_grab}'[grab the pointer in windowed mode]' \ '(-G --disable_grab)'{-G,--disable_grab}'[disable pointer grabbing]' \ '(-o --bg_color)'{-o,--bg_color}'[set root background color]:color:_x_color' \ '(-s --slide)'{-s,--slide}'[start slideshow immediately]' \ '(-r --random)'{-r,--random}'[shuffle images for slideshow]' \ '(-R --readonly)'{-R,--readonly}'[disable delete feature]' \ '(-S --shuffle)'{-S,--shuffle}'[shuffle images for next/prev feature]' \ '(-d --delay)'{-d,--delay}'[set slideshow delay]:delay (seconds)' \ '(-f --fullscreen)'{-f,--fullscreen}'[use fullscreen window on startup]' \ '(-P --ignore_path_sort)'{-P,--ignore_path_sort}'[sort images by just the filename]' \ '(-M --merged_case_sort)'{-M,--merged_case_sort}'[sort images case-insensitively]' \ '(-N --numeric_sort)'{-N,--numeric_sort}'[numeric image sort]' \ '(-T --watch)'{-T,--watch}'[reload the image if it changes]' \ '*:image file:_files -g "*.(#i)(bmp|eim|gif|jp([eg]|eg)|pcx|png|p[pngb]m|tif(|f)|tga|x[pb]m)(-.)"' PK[H  functions/VCS_INFO_get_data_hgnuW+A## vim:ft=zsh ## mercurial support by: Frank Terbeck ## with large contributions by Seth House ## Distributed under the same BSD-ish license as zsh itself. setopt localoptions extendedglob NO_shwordsplit local hgbase bmfile branchfile rebasefile dirstatefile mqseriesfile \ mqstatusfile mqguardsfile patchdir mergedir \ r_csetid r_lrev r_branch i_bmhash i_bmname \ revformat branchformat hgactionstring hgchanges \ hgbmstring hgmqstring applied_string unapplied_string guards_string local -a hgid_args defrevformat defbranchformat \ hgbmarks mqpatches mqseries mqguards mqunapplied hgmisc \ i_patchguards i_negguards i_posguards local -xA hook_com hgbase=${vcs_comm[basedir]} rrn=${hgbase:t} r_csetid='' # changeset id (long hash) r_lrev='' # local revision patchdir="${hgbase}/.hg/patches" mergedir="${hgbase}/.hg/merge/" bmfile="${hgbase}/.hg/bookmarks" branchfile="${hgbase}/.hg/branch" rebasefile="${hgbase}/.hg/rebasestate" dirstatefile="${hgbase}/.hg/dirstate" mqstatusfile="${patchdir}/status" # currently applied patches mqseriesfile="${patchdir}/series" # all patches mqguardsfile="${patchdir}/guards" # Look for any --flavours VCS_INFO_adjust # Calling the 'hg' program is quite a bit too slow for prompts. # Disabled by default anyway, so no harm done. if zstyle -t ":vcs_info:${vcs}:${usercontext}:${rrn}" get-revision ; then # Calling hexdump is (much) faster than hg but doesn't get the local rev if zstyle -t ":vcs_info:${vcs}:${usercontext}:${rrn}" use-simple \ && ( VCS_INFO_check_com hexdump ) && [[ -r ${dirstatefile} ]] ; then r_csetid=$(hexdump -n 20 -e '1/1 "%02x"' ${dirstatefile}) else hgid_args=( --debug id -i -n -b ) # Looking for changes is a tad bit slower since the dirstate cache must # first be refreshed before being read zstyle -t ":vcs_info:${vcs}:${usercontext}:${rrn}" \ "check-for-changes" || hgid_args+=( -r. ) local HGRCPATH HGRCPATH="/dev/null" ${vcs_comm[cmd]} ${(z)hgid_args} \ | read -r r_csetid r_lrev r_branch fi fi # If the user doesn't opt to invoke hg we can still get the current branch if [[ -z ${r_branch} && -r ${branchfile} ]] ; then r_branch=$(< ${branchfile}) fi # If we still don't know the branch it's safe to assume default [[ -n ${r_branch} ]] || r_branch="default" # The working dir has uncommitted-changes if the revision ends with a + if [[ $r_lrev[-1] == + ]] ; then hgchanges=1 r_lrev=${r_lrev%+} r_csetid=${r_csetid%+} fi # This directory only exists during a merge [[ -d $mergedir ]] && hgactionstring="merging" # This file only exists during a rebase [[ -e $rebasefile ]] && hgactionstring="rebasing" ### Build the current revision display [[ -n ${r_csetid} ]] && defrevformat+=( "%h" ) [[ -n ${r_lrev} ]] && defrevformat+=( "%r" ) zstyle -s ":vcs_info:${vcs}:${usercontext}:${rrn}" \ "hgrevformat" revformat || revformat=${(j/:/)defrevformat} hook_com=( localrev "${r_lrev}" "hash" "${r_csetid}" ) if VCS_INFO_hook 'set-hgrev-format' "${revformat}"; then zformat -f r_lrev "${revformat}" \ "r:${hook_com[localrev]}" "h:${hook_com[hash]}" else r_lrev=${hook_com[rev-replace]} fi hook_com=() ### Build the branch display [[ -n ${r_branch} ]] && defbranchformat+=( "%b" ) [[ -n ${r_lrev} ]] && defbranchformat+=( "%r" ) zstyle -s ":vcs_info:${vcs}:${usercontext}:${rrn}" \ branchformat branchformat || branchformat=${(j/:/)defbranchformat} hook_com=( branch "${r_branch}" revision "${r_lrev}" ) if VCS_INFO_hook 'set-branch-format' "${branchformat}"; then zformat -f branchformat "${branchformat}" \ "b:${hook_com[branch]}" "r:${hook_com[revision]}" else branchformat=${hook_com[branch-replace]} fi hook_com=() ### Look for current Bookmarks (this requires knowing the changeset id) if zstyle -t ":vcs_info:${vcs}:${usercontext}:${rrn}" get-bookmarks \ && [[ -r "${bmfile}" ]] && [[ -n "$r_csetid" ]] ; then while read -r i_bmhash i_bmname ; do # Compare hash in bookmarks file with changeset id [[ $r_csetid == $i_bmhash ]] && hgbmarks+=( $i_bmname ) done < ${bmfile} if VCS_INFO_hook 'gen-hg-bookmark-string' "${hgbmarks[@]}"; then hgbmstring=${(j:, :)hgbmarks} else hgbmstring=${hook_com[hg-bookmark-string]} fi hook_com=() fi ### Look for any applied Mercurial Queue patches if zstyle -T ":vcs_info:${vcs}:${usercontext}:${rrn}" get-mq \ && [[ -d $patchdir ]] ; then if [[ -e $mqstatusfile ]]; then mqpatches=( ${${(f)"$(< "${patchdir}/status")"}/(#s)[a-f0-9]##:/} ) mqpatches=( ${(Oa)mqpatches} ) fi if zstyle -t ":vcs_info:${vcs}:${usercontext}:${rrn}" get-unapplied \ && [[ -r ${mqseriesfile} ]]; then # Okay, here's a little something that assembles a list of unapplied # patches that takes into account if mq-guards are active or not. # Collect active guards if [[ -r ${mqguardsfile} ]]; then mqguards=( ${(f)"$(< "${mqguardsfile}")"} ) mqguards=( ${(oa)mqguards} ) fi while read -r i_patch i_patchguards ; do # Skip commented lines [[ ${i_patch} == [[:space:]]#"#"* ]] && continue # Keep list of all patches mqseries+=( $i_patch ) # Separate negative and positive guards to more easily find the # intersection of active guards with patch guards i_patchguards=( ${(s: :)i_patchguards} ) i_negguards=( ${${(M)i_patchguards:#*"#-"*}/(#s)\#-/} ) i_posguards=( ${${(M)i_patchguards:#*"#+"*}/(#s)\#+/} ) # Patch with any negative guards is never pushed if guard is active if [[ ${#i_negguards} -gt 0 && ${#${(@M)mqguards:#${(~j,|,)i_negguards}}} -gt 0 ]] ; then continue fi # Patch with positive guards is only pushed if guard is active if [[ ${#i_posguards} -gt 0 ]] ; then if [[ ${#${(@M)mqguards:#${(~j,|,)i_posguards}}} -gt 0 ]] ; then mqunapplied+=( $i_patch ) fi continue fi # If we made it this far the patch isn't guarded and should be pushed mqunapplied+=( $i_patch ) done < ${mqseriesfile} fi if VCS_INFO_hook 'gen-applied-string' "${mqpatches[@]}"; then (( ${#mqpatches} )) && applied_string=${mqpatches[1]} else applied_string=${hook_com[applied-string]} fi hook_com=() if VCS_INFO_hook 'gen-unapplied-string' "${mqunapplied[@]}"; then unapplied_string=${#mqunapplied} else unapplied_string=${hook_com[unapplied-string]} fi hook_com=() if VCS_INFO_hook 'gen-mqguards-string' "${mqguards[@]}"; then guards_string=${(j:,:)mqguards} else guards_string=${hook_com[guards-string]} fi if (( ${#mqpatches} )); then zstyle -s ":vcs_info:${vcs}:${usercontext}:${rrn}" patch-format \ hgmqstring || hgmqstring="%p (%n applied)" else zstyle -s ":vcs_info:${vcs}:${usercontext}:${rrn}" nopatch-format \ hgmqstring || hgmqstring="no patch applied" fi hook_com=( applied "${applied_string}" unapplied "${unapplied_string}" applied-n ${#mqpatches} unapplied-n ${#mqunapplied} guards "${guards_string}" guards-n ${#mqguards} ) if VCS_INFO_hook 'set-patch-format' ${qstring}; then zformat -f hgmqstring "${hgmqstring}" \ "p:${hook_com[applied]}" "u:${hook_com[unapplied]}" \ "n:${#mqpatches}" "c:${#mqunapplied}" \ "g:${hook_com[guards]}" "G:${#mqguards}" else hgmqstring=${hook_com[patch-replace]} fi hook_com=() fi ### Build the misc string hgmisc+=( ${hgmqstring} ) hgmisc+=( ${hgbmstring} ) backend_misc[patches]="${hgmqstring}" backend_misc[bookmarks]="${hgbmstring}" VCS_INFO_formats "${hgactionstring}" "${branchformat}" "${hgbase}" '' "${hgchanges}" "${r_lrev}" "${(j:;:)hgmisc}" return 0 PK[v*Sfunctions/_uniqnuW+A#compdef uniq local args args=( '(-c --count)'{-c,--count}'[prefix lines by the number of occurrences]' '(-d --repeated)'{-d,--repeated}'[only print duplicate lines]' '(-D --all-repeated)'{-D,--all-repeated=}'[print all duplicate lines]:delimit method:(none prepend separate)' '(-f --skip-fields)'{-f,--skip-fields=}'[avoid comparing initial fields]:number of fields' '(-i --ignore-case)'{-i,--ignore-case}'[ignore differences in case when comparing]' '(-s --skip-chars)'{-s,--skip-chars=}'[avoid comparing initial characters]:number of characters' '(-t --separator)'{-t,--separator=}'[specify field delimiter]:separator' '(-u --unique)'{-u,--unique}'[only print unique lines]' '(-w --check-chars)'{-w,--check-chars=}'[specify maximum number of characters to compare]:characters' '(-W --check-fields)'{-W,--check-fields=}'[specify maximum number of fields to compare]:fields' '(- *)--help[display help information]' '(- *)--version[display version information]' ) if ! _pick_variant gnu=Free\ Soft unix --version; then args=( ${(M)args:#(|\*)(|\(*\))-[cdufs]*} ) fi _arguments "$args[@]" \ '1::input file:_files' \ '2::output file:_files' PK[LQQ"functions/backward-kill-word-matchnuW+Aemulate -L zsh setopt extendedglob autoload match-words-by-style local curcontext=":zle:$WIDGET" word done local -a matched_words integer count=${NUMERIC:-1} if (( count < 0 )); then (( NUMERIC = -count )) zle ${WIDGET##backward-} return fi while (( count-- )); do match-words-by-style word="$matched_words[2]$matched_words[3]" if [[ -n $word ]]; then if [[ -n $done || $LASTWIDGET = *kill* ]]; then CUTBUFFER="$word$CUTBUFFER" else zle copy-region-as-kill -- "$word" fi LBUFFER=$matched_words[1] else return 1 fi done=1 done return 0 PK[2 2 functions/_ifconfignuW+A#compdef ifconfig local curcontext="$curcontext" state line ret=1 local -a opts args alias debug updownlist alias=( '(-alias alias)'{,-}'alias[remove or establish alternate address for if]' ) debug=( '(-debug debug)'{,-}'debug[disable or enable debugging code]' ) updownlist=( '(-a -d -C)-u[restrict to interfaces which are up]' '(-a -u -C)-d[restrict to interfaces which are down]' '(-a -C -m -L 1 *)-l[list interfaces]' ) case $OSTYPE in darwin*) args=( -s $updownlist ) opts=( $alias $debug delete dest_address ipdst nsellength {,-}trailers {,-}link{0,1,2} ) ;; freebsd*|dragonfly*) args=( -s $updown '(-a -l -u -d -m -L 1 *)-C[list interface cloners]' '(-l -C)-m[list supported media]' '(-l -C)-L[show address lifetime as time offset]' ) opts=( $alias $debug anycast lladdr media {,-}mediaopt {,delete}tunnel create destroy {,un}plumb vlan {,-}vlandev metric prefixlen range phase ssid muid stationname channel authmode {,-}powersave powersavesleep wepmode {,-}wep {,-}nwkey add delete ether {,-}link{0,1,2} ) ;; irix5*) opts=( $debug ) ;; irix6*) opts=( $debug {-,}highbw {,-}link{0,1,2} primary rspace sspace ) args=( '-w[display additional information]' ) ;; linux*) opts=( '(-promisc promisc)'{,-}'promisc[disable or enable promiscuous mode]' '(-allmulti allmulti)'{,-}'allmulti[disable or enable all-multicast]' 'media[set physical port type]:medium type:(auto 10base2 10baseT AUI)' 'hw[set hardware class]:hardware class:(ether ax25 ARCnet netrom)' add del dstaddr io_addr irq mem_start multicast pointopoint tunnel txqueuelen ) ;; solaris*) args=( '-ad[apply to all down interfaces]' '-adD[apply to all down interfaces not controlled by DHCP]' '-au[apply to all up interfaces]' '-auD[apply to all up interfaces not controlled by DHCP]' ) opts=( 'auto-revarp[use RARP to acquire address]' {,-}trailers {,-}private {,un}plumb '(dhcp auto-dhcp)'{,auto-}'dhcp[use dhcp]' primary wait drop extend ping release start status ) ;; esac _arguments -C "$args[@]" \ '-a[apply to all interfaces]' \ '1:network interface:_net_interfaces' \ '::address family:(atalk ether inet inet6 ax25 ddp ipx netrom)' \ '*:option:->options' && ret=0 [[ -n "$state" ]] && _values -S ' ' -w 'option' "$opts[@]" \ '(down)up[activate interface]' \ '(up)down[shut down interface]' \ '(-arp arp)'{,-}'arp[disable or enable address resolution protocol]' \ 'metric[set routing metric for interface]:routing metric' \ 'mtu[set maximum transfer unit]:mtu' \ 'netmask[specify network mask]:netmask' \ 'broadcast[specify broadcast address]:broadcast address' \ 'address[specify IP address of interface]:IP address' && ret=0 return ret PK[!functions/_portsnuW+A#autoload local expl ports if ! zstyle -a ":completion:${curcontext}:" ports ports; then (( $+_cache_ports )) || : ${(A)_cache_ports:=${${(M)${${(f)"$( ## Distributed under the same BSD-ish license as zsh itself. emulate -L zsh local -i i local -ix maxexports VCS_INFO_maxexports for i in {0..$((maxexports - 1))} ; do printf -- '$vcs_info_msg_%d_: "' $i if zstyle -T ':vcs_info:formats:command:-all-' use-prompt-escapes ; then print -nP -- ${(P)${:-vcs_info_msg_${i}_}} else print -n -- ${(P)${:-vcs_info_msg_${i}_}} fi printf '"\n' done PK[㝱functions/_x_extensionnuW+A#autoload local expl _tags extensions || return 1 (( $+_xe_cache )) || _xe_cache=( "${(@)${(@f)$(xdpyinfo)}[(r)number of extensions:*,-1][2,(r)default screen number:*][1,-2]//[ ]}" ) if [[ "$1" = -a ]]; then shift _wanted extensions expl 'X extension' \ compadd "$@" -M 'm:{a-z}={A-Z} r:|-=* r:|=*' - all "$_xe_cache[@]" else [[ "$1" = - ]] && shift _wanted extensions expl 'X extension' \ compadd "$@" -M 'm:{a-z}={A-Z} r:|-=* r:|=*' -a - _xe_cache fi PK[$:jfunctions/_tarnuW+A#compdef tar gtar star # Tar completion. Features: # - Tries to collect tar commands from second position, single letter # option, and long options. # - `tar' can be called anything, will use the correct name # - Uses the function `_tar_archive' to complete archive files. # - Tries to find out if compressed archives should be used. # - Completes files inside archive. This is supposed to look pretty # much as if the files are in an ordinary directory hierarchy. # Handles extraction from compressed archives (GNU tar). # - Anywhere -- appears, gets a list of long options to complete from # tar itself (GNU tar) # - Things like --directory=... are also completed correctly. local _tar_cmd tf tmp tmpb del index # First we collect in `_tar_cmd' single letter options describing what # should be done with the archive and if it is compressed. This # collected from options arguments that start with only one hyphen, # from some of the possible long options, and from the second word if # that does not start with a hyphen. if _pick_variant gnu=GNU unix --version; then case "$($service --version)" in (tar \(GNU tar\) (#b)([0-9.-]##)*) autoload -z is-at-least is-at-least 1.14.91 "$match[1]" || _cmd_variant[$service]="gnu-old" ;; esac fi tmp=("${(@M)words:#-[^-]*}") _tar_cmd="${(j::)tmp#-}" (( $words[(I)--(un|)gzip] )) && _tar_cmd="z$_tar_cmd" (( $words[(I)--(un|)compress] )) && _tar_cmd="Z$_tar_cmd" (( $words[(I)--bzip2] )) && _tar_cmd="j$_tar_cmd" (( $words[(I)--xz] )) && _tar_cmd="J$_tar_cmd" (( $words[(I)--list] )) && _tar_cmd="t$_tar_cmd" (( $words[(I)--(extract|get)] )) && _tar_cmd="x$_tar_cmd" (( $words[(I)--create] )) && _tar_cmd="c$_tar_cmd" # Other ways of finding out what we're doing: first # look in the first argument if it's not an option if [[ "$words[2]" = *[txcdruA]*~-* ]]; then _tar_cmd="$words[2]$_tar_cmd" elif [[ $_tar_cmd != *[txcdruA]* && CURRENT -gt 2 ]]; then # look for more obscure long options: these aren't all handled. (( $words[(I)--(diff|compare)] )) && _tar_cmd="d$_tar_cmd" (( $words[(I)--append] )) && _tar_cmd="r$_tar_cmd" (( $words[(I)--update] )) && _tar_cmd="u$_tar_cmd" (( $words[(I)--(con|)catenate] )) && _tar_cmd="A$_tar_cmd" (( $words[(I)--delete] )) && del=1 fi # Next, we try to find the archive name and store it in `tf'. The name # is searched after a `--file=' long option, in the third word if the # second one didn't start with a hyphen but contained a `f', and after # an option argument starting with only one hyphen and containing a `f'. # unless that option argument also contains a `C'. tmp="$words[(I)--file=*]" tmpb="$words[(I)-*Cf*~--*]" if (( tmp )); then tf=${~words[tmp][8,-1]} _tar_cmd="f$_tar_cmd" elif [[ "$words[2]" != -* && "$words[2]" = *f* ]]; then tf=${~words[3]} _tar_cmd="f$_tar_cmd" elif (( tmpb )); then tf=${~words[tmpb+2]} wdir=${~words[tmpb+1]} _tar_cmd="Cf$_tar_cmd" else tmp="${words[(I)-*f*~--*]}" if (( tmp )); then tf=${~words[tmp+1]} _tar_cmd="f$_tar_cmd" fi fi # See if we should use a path prefix. We have to use eval as the dir can # be any unevaluated thing which appears on the command line, including a # parameter. # This isn't used right now. tmp=${words[(r)--dir[a-z]#=*]} if [[ -n $tmp ]]; then eval "wdir=(${tmp#*=})" fi # Now we complete... if [[ "$PREFIX" = --* ]]; then # ...long options after `--'. _arguments -- '--owner*:user:_users' \ '*=(PROG|COMMAND)*:program:_command_names -e' \ '*=ARCHIVE*:archive: _tar_archive' \ '*=NAME*:file:_files' \ '*=DIR*:directory:_files -/' \ '*=CONTROL*::version control:(t numbered nil existing never simple)' elif [[ ( CURRENT -gt 2 && "$words[CURRENT-1]" = -[^C]#f* && "$words[CURRENT-1]" != --* ) || ( CURRENT -eq 3 && "$words[2]" = [^C]#f* && "$words[2]" != -* ) || ( CURRENT -gt 2 && "$words[CURRENT-2]" = -*C*f* && "$words[CURRENT-2]" != --* && "$words[CURRENT-1]" != --* ) || ( CURRENT -eq 4 && "$words[2]" = *C*f* && "$words[2]" != -* ) ]]; then # ...archive files if we think they are wanted here. _tar_archive elif [[ ( CURRENT -gt 2 && "$words[CURRENT-1]" = -[^f]#C*) || ( CURRENT -eq 3 && "$words[2]" = [^f]#C* ) ]]; then # a directory for -C _directories elif [[ ( "$_tar_cmd" = *[xt]* || -n $del ) && -n "$tf" ]]; then # ...and files from the archive if we found an archive name and tar # commands. We run `tar t...' on the file, keeping the list of # filenames cached, plus the name of the tarfile so we know if it # changes. We skip this test if the alleged archive is not a file. local largs=-tf expl if [[ $_tar_cmd = *z* ]]; then largs=-tzf elif [[ $_tar_cmd = *j* ]]; then largs=-tjf elif [[ $_tar_cmd = *y* ]]; then largs=-tyf elif [[ $_tar_cmd = *Z* ]]; then largs=-tZf elif [[ $_tar_cmd = *I* ]]; then largs=-tIf elif [[ $_tar_cmd = *J* ]]; then largs=-tJf else # Some random compression program tmp="${words[(r)--use-comp*]}" [[ -n $tmp ]] && largs=($tmp -tf) fi if [[ $tf != $_tar_cache_name && -f $tf ]]; then _tar_cache_list=("${(@f)$($words[1] $largs $tf)}") _tar_cache_name=$tf fi _wanted files expl 'file from archive' _multi_parts / _tar_cache_list elif (( CURRENT == 2 )); then # ignore leading - since we complete option letters anyway compset -P - _values -s '' 'tar function' \ '(c t u x)A[append to an archive]' \ '(A t u x)c[create a new archive]' \ '(A c u x)t[list archive contents]' \ '(A c t x)u[update archive]' \ '(A c t u)x[extract files from an archive]' \ 'v[verbose output]' \ 'f[specify archive file or device]' else if ! (( index=$words[(I)-*C*] )); then if [[ $words[2] = [^f]#C* ]]; then index=1 elif [[ $words[2] = *f*C* ]]; then index=2 fi fi if (( index )); then index="$~words[index+1]" [[ $index = (.|..|)/* ]] || index=~+/$index _files -W $index else _files fi fi PK[f44%functions/up-line-or-beginning-searchnuW+A# Like up-line-or-search, but uses the whole line prefix up to the # cursor position for searching backwards. emulate -L zsh if [[ $LBUFFER == *$'\n'* ]]; then zle .up-line-or-history __searching='' elif [[ -n $PREBUFFER ]] && zstyle -t ':zle:up-line-or-beginning-search' edit-buffer then zle .push-line-or-edit else [[ $LASTWIDGET = $__searching ]] && CURSOR=$__savecursor __savecursor=$CURSOR __searching=$WIDGET zle .history-beginning-search-backward zstyle -T ':zle:up-line-or-beginning-search' leave-cursor && zle .end-of-line fi PK[;Cfunctions/_logical_volumesnuW+A#autoload local expl list names disp sep list=( $(lsvg -l $(lsvg)|sed -e '2d'|awk '/[^:]* / {if ( $7 != "N/A" ) print $1 ":" $7; else print $1}' ) ) names=(${list%%:*}) if zstyle -T ":completion:${curcontext}:" verbose; then zstyle -s ":completion:${curcontext}:" list-separator sep || sep=-- zformat -a list " $sep " $list disp=(-d list) else disp=() fi _wanted logicalvolumes expl 'logical volume' \ compadd "$disp[@]" "$@" - "$names[@]" PK[[T functions/_unitsnuW+A#compdef units local curcontext="$curcontext" state line integer ret=1 typeset -A opt_args # Command line completion for Solaris units isn't very useful; this # may be standard old-fashioned behaviour. However, it does let you # find out the units that are available before running units # interactively. # GNU options, but these aren't very intrusive for other versions. _arguments -C -s -S \ '(-c --check --check-verbose)'{-c,--check}'[check units are reducible]' \ '(-c --check)--check-verbose[verbosely check units are reducible]' \ '(-o --output-format)'{-o,--output-format}'[specify output format]:printf formt: ' \ '(-f --file)'{-f,--file}'[specify file with units]:units file:_files' \ '(-m --minus)'{-m,--minus}'[- is subtraction]' \ '(-p --product)'{-p,--product}'[binary - is product]' \ '(-q --quiet --silent)'{-q,--quiet,--silent}'[suppress prompts and statistics]' \ '(-s --strict)'{-s,--strict}'[suppress conversion to reciprocals units]' \ '(-t --terse)'{-t,--terse}'[make conversion output briefer]' \ '(-v --verbose)'{-v,--verbose}'[make output more verbose]' \ '(- *)'{-h,--help}'[show help information and exit]' \ '(- *)'{-V,--version}'[show version information and exit]' \ '*:unit expression:->expr' && return 0 [[ $state = expr ]] || return 1 # It's very likely there's a quoted expression, since things like '2 seconds' # need to be a single argument. Units themselves don't have special # characters, so it's safe to take just the characters around the # cursor. compset -P '*[^[:alnum:]]' compset -S '[^[:alnum:]]*' # Find the units data. local datfile local -a testfiles testfiles=( /usr/share/units.dat # GNU on Fedora /usr/share/units/units.dat # on gentoo /usr/share/misc/units.dat # on Debian /usr/local/share/units.dat # GNU DIY install /usr/share/lib/unittab # Solaris /usr/share/misc/units.lib # BSD ) datfile=${opt_args[-f]:-${opt_args[--file]}} if [[ -z $datfile ]]; then for datfile in $testfiles; do [[ -f $datfile ]] && break done fi if [[ ! -f $datfile ]]; then _message "Data file for units not found." return fi local -a all units pfxs # Solaris uses / to start a comment, else #. # could cache this, but it's not that big a deal... all=($(awk '$1 !~ /^[\/#]/ { print $1 }' $datfile)) # prefixes end in a - pfxs=(${${all:#^[[:alnum:]]##-}%%-}) # units may include regular or piecewise linear functions units=(${${all:#^[[:alnum:]]##([\(\]]*|)}%%\(*}) if (( ${#units} )); then _alternative 'unitprefixes:unit prefix:compadd -S "" -a pfxs' \ 'units:unit:compadd -a units' && ret=0 # attempt to skip a prefix if (( ${#pfxs} )) && compset -P "(${(j.|.)pfxs})"; then _wanted units expl unit compadd -a units && ret=0 fi return ret else _message "No unit definitions found." fi PK[PPfunctions/VCS_INFO_detect_mtnnuW+A## vim:ft=zsh ## monotone support by: Frank Terbeck ## Distributed under the same BSD-ish license as zsh itself. setopt localoptions NO_shwordsplit [[ $1 == '--flavours' ]] && return 1 VCS_INFO_check_com ${vcs_comm[cmd]} || return 1 vcs_comm[detect_need_file]=revision VCS_INFO_bydir_detect '_MTN' return $? PK[+@Zfunctions/_servicenuW+A#compdef service # *:: for last argument looks more like a hack but it is # the simplest way known to me to reset $words and keep # _sub_command happy # we are interested in init service only local ctx="${curcontext}argument-1:" zstyle -T ":completion:${ctx}" tag-order && \ zstyle ":completion:${ctx}" tag-order init if [[ $OSTYPE = freebsd* ]]; then _arguments -s \ '(-)-e[show services that are enabled]' \ '(-)-l[list all scripts in /etc/rc.d and the local startup directory]' \ '(-)-r[show the results of boot time rcorder]' \ '(-)-v[verbose]' \ ':service name:_services' \ '*::service argument:_init_d' else _arguments -s \ '(-d --debug)'{-d,--debug}'[turn debugging on]' \ '(- :)'{-h,--help}'[print usage]' \ '(- :)'{-v,--version}'[print version]' \ '(-)'{-f,--full-restart}'[restart service]' \ '(- :)'{-R,--full-restart-all}'[restart all services]' \ '(- :)'{-s,--status-all}'[print status of all services]' \ ':service name:_services' \ '*::service argument: _init_d' fi PK[A[ͧfunctions/_metaflacnuW+A#compdef metaflac local _metaflac_opts _metaflac_shorts _metaflac_opers typeset -A opt_args function _metaflac_tags () { echo "\n\nBEEP - $line - BEEP\n\n" } _metaflac_opts=( '--preserve-modtime' '--with-filename[prefix output with filename]' '--no-filename' '--no-utf8-convert' '--dont-use-padding[always rewrite the file]' ) _metaflac_shorts=( '--show-md5sum' '--show-min-blocksize' '--show-max-blocksize' '--show-min-framesize' '--show-max-framesize' '--show-sample-rate' '--show-channels' '--show-bps' '--show-total-samples' '--show-vendor-tag' '--show-tag=:FLAC tags:_metaflac_tags' '--remove-tag=:FLAC tags: ' '--remove-first-tag=:FLAC tags: ' '--remove-all-tags' '--set-tag=:FLAC tag and value: ' '--import-tags-from=:flat file:_files' '--export-tags-to=:new file: ' '--import-cuesheet-from=:file:_files' '--export-cuesheet-to=:new file: ' '--add-replay-gain' '--add-seekpoint=:: ' '--add-padding=length' ) _metaflac_opers=( '--block-number=:: ' '--block-type=:: ' '--except-block-type=:: ' '--application-data-format=:: ' '--list' '--remove' '--remove-all' '--merge-padding' '--sort-padding' ) _arguments "$_metaflac_opts[@]" \ "*:FLAC file:_files -g \*.flac" \ - "shortcuts" \ "$_metaflac_shorts[@]" \ - "(operations)" \ "$_metaflac_opers[@]" \ && return 0 PK[-<<functions/tcp_expectnuW+A# Expect one of a series of regular expressions from $TCP_SESS. # Can make backreferences to be handled by $match. Returns 0 for # successful match, 1 for error, 2 for timeout. # # This function has no facility for conditionally calling code based # the regular expression found. This should be done in the calling code # by testing $TCP_LINE, which contains the line which matched the # regular expression. The complete set of lines read while waiting for # this line is available in the array $tcp_expect_lines (including $TCP_LINE # itself which will be the final element). Alternatively, use -p pind # which sets $pind to the index of the pattern which matched. It # will be set to 0 otherwise. # # Many of the options are passed straight down to tcp_read. # # Options: # -a Run tcp_expect across all sessions; the first pattern matched # from any session is used. The TCP output prompt can be # used to decide which session matched. # -l list # Comma-separated list of sessions as for tcp_read. # -p pv If the Nth of a series of patterns matches, set the parameter # whose name is given by $pv to N; in the case of a timeout, # set it to -1; otherwise (unless the function exited prematurely), # set it to 0. # To avoid namespace clashes, the parameter's name must # not begin with `_expect'. # -q Quiet, passed down to tcp_read. Bad option and argument # usage is always reported. # -s sess # Expect from session sess. May be repeated for multiple sessions. # -t to Timeout in seconds (may be floating point) per read operation. # tcp_expect will only time out if every read operation takes longer # than to # -T TO Overall timeout; tcp_expect will time out if the overall operation # takes longer than this many seconds. emulate -L zsh setopt extendedglob if [[ ${(t)SECONDS} != float* ]]; then # If called from another function, use that typeset -F TCP_SECONDS_START=$SECONDS # Get extra accuracy by making SECONDS floating point locally typeset -F SECONDS fi # Variables are all named _expect_* to avoid problems with the -p param. local _expect_opt _expect_pvar local -a _expect_read_args float _expect_to1 _expect_to_all _expect_to _expect_new_to integer _expect_i _expect_stat while getopts "al:p:qs:t:T:" _expect_opt; do case $_expect_opt in (a) _expect_read_args+=(-a) ;; (l) _expect_read_args+=(-l $OPTARG) ;; (p) _expect_pvar=$OPTARG if [[ $_expect_pvar != [a-zA-Z_][a-zA-Z_0-9]# ]]; then print "invalid parameter name: $_expect_pvar" >&2 return 1 fi if [[ $_expect_pvar = _expect* ]]; then print "$0: parameter names staring \`_expect' are reserved." return 1 fi eval "$_expect_pvar=0" ;; (q) _expect_read_args+=(-q) ;; (s) _expect_read_args+=(-s $OPTARG) ;; (t) _expect_to1=$OPTARG ;; (T) _expect_to_all=$(( SECONDS + $OPTARG )) ;; (\?) return 1 ;; (*) print Unhandled option $_expect_opt, complain >&2 return 1 ;; esac done (( OPTIND > 1 )) && shift $(( OPTIND - 1 )) typeset -ga tcp_expect_lines tcp_expect_lines=() while true; do if (( _expect_to_all || _expect_to1 )); then _expect_to=0 (( _expect_to1 )) && (( _expect_to = _expect_to1 )) if (( _expect_to_all )); then # overall timeout, see if it has already triggered if (( (_expect_new_to = (_expect_to_all - SECONDS)) <= 0 )); then [[ -n $_expect_pvar ]] && eval "$_expect_pvar=-1" return 2 fi if (( _expect_to <= 0 || _expect_new_to < _expect_to )); then _expect_to=$_expect_new_to fi fi tcp_read $_expect_read_args -t $_expect_to _expect_stat=$? else tcp_read $_expect_read_args -b _expect_stat=$? fi if (( _expect_stat )); then [[ -n $_expect_pvar ]] && eval "$_expect_pvar=-1" return $_expect_stat fi tcp_expect_lines+=($TCP_LINE) for (( _expect_i = 1; _expect_i <= $#; _expect_i++ )); do if [[ "$TCP_LINE" = ${~argv[_expect_i]} ]]; then [[ -n $_expect_pvar ]] && eval "$_expect_pvar=\$_expect_i" return 0 fi done done PK[&Yfunctions/_usersnuW+A#compdef passwd groups userdel chage chfn chsh local expl users if zstyle -a ":completion:${curcontext}:users" users users; then _wanted users expl user compadd "$@" -a - users return 0 fi _wanted users expl user compadd "$@" -k - userdirs PK[VuVufunctions/zsh-newuser-installnuW+A# Function to install startup files for a new user. # Currently it only creates or edits .zshrc. # # It can be run again by giving it the option "-f". # Sanitize environment. emulate -L zsh setopt extendedglob nonomatch warncreateglobal # How the function will be referred to. local myname=zsh-newuser-install # Quick test not requiring any setting up. # Don't run if we're root. (These variables are provided by the shell.) if (( EUID == 0 || UID == 0 )); then if [[ $1 = -f ]]; then print -r "$myname: won't run as root. Read the manual." >&2 fi return 1 fi # clear is missing in some Cygwin configurations (lacking ncurses) if ! ( clear >/dev/null 2>/dev/null ); then if zmodload zsh/termcap 2>/dev/null; then clear() { echotc cl; } else clear() { print -n "\e[H\e[J"; } fi fi # The directory in which to look for and save .zshrc. local zd=${ZDOTDIR:-$HOME} # The same directory in a user friendly form, i.e. with ~ replacement. # (We don't want to use glob_subst since that has other side effects.) local zdmsg # The message used if an other blank .zshrc is created. local msg="# Created by newuser for $ZSH_VERSION" # The lines marking the start and end of the section edited. local startline="# Lines configured by $myname" local endline="# End of lines configured by $myname" # Prompts used for reading a key. The initial "?" is required. local shortprompt="?--- Type a key --- " local longprompt="?--- Type one of the keys in parentheses --- " # Prefix for all temporary files. Any files starting with this # will be removed at the end of the script. local tmpfile=${TMPPREFIX:-/tmp/zsh}-zni-$$ # Report of the state of settings for the top-level menu. local -A install_state # Values of all parameters etc. to be saved (including # those read in from the existing file.) local -A parsed_parameters parsed_options parsed_bindings parsed_keymaps # Corresponding state in a user-readable form. local -A state_parameters state_options state_bindings state_keymaps # Indicate whether an option defaults on or off. local -A default_options # Lines read in from between $startline and $endline which were # not understood. These are retained but moved out of that section # with a message. local -a unparsed # Lines used in submenus: the setting to output in a form # that can be exeucuted (an assignment, setopt or unsetopt), a brief message # about the setting, and the state copied from and to state_parameters or # state_options. Elements of all three arrays must correspond. local -a output_lines display_lines state_lines # Variable indicating some of the lines in the above variables # have been read in, i.e. the user has already configured the # particular set of settings. integer lines_read # Lines to set up completion. This is special as it is only # edited by compinstall, not this function. local -a completion_lines # Utility variables local -a reply match mbegin mend # Key read from user, used all over the place. local key # For default replies from read local REPLY integer save lines_found install_state[history]=Recommended install_state[completion]=Recommended install_state[bindkey]=Recommended # Don't save anything if interrupted. trap 'save=0' HUP INT QUIT # Substitute an initial ~ for human consumption. if [[ $zd = $HOME(#b)(|/*) ]]; then zdmsg="~$match[1]" else zdmsg=$zd fi # Don't run if we can't write to $zd. # Assume this is a temporary condition and exit silently--- # if this really is a new user this probably isn't the right # time for screeds of explanation. if [[ ! -w $zd ]]; then if [[ $1 = -f ]]; then print -r "$myname: can't write to $zdmsg." >&2 fi return 1 fi # Don't run unless we can talk to the user. if [[ ! -t 0 || ! -t 1 ]]; then if [[ $1 = -f ]]; then print -r "$myname: can only be used interactively." >&2 fi return 1 fi # Don't run unless terminal is sane. if (( ${LINES:-0} < 15 || ${COLUMNS:-0} < 72 )); then return 1 fi if [[ $1 != -f ]]; then # The zsh/newuser module already tests for the following, so this test only # triggers if zsh-newuser-install is run by hand. if [[ -e $zd/.zshenv || -e $zd/.zprofile || \ -e $zd/.zshrc || -e $zd/.zlogin ]]; then print -r "$myname: startup files exist, aborting. Use the argument -f if you want to force the function to be run again." >&2 return 1 fi fi # start of try block for tidy-up in always block { ######################################################################## # Utility functions ######################################################################## # All internal functions start with __zni_. These will be removed # when the main function exits. # Read existing lines from .zshrc, if any. __zni_retrieve_lines() { local line reply=() lines_found=0 [[ -f $zd/.zshrc ]] || return 1 grep "$startline" $zd/.zshrc 1>/dev/null 2>&1 || return 1 lines_found=1 sed -n "/^[ ]*$startline/,/^[ ]*$endline/p" $zd/.zshrc | while read -r line; do reply+=($line) done return 0 } # First argument is a state; other arguments are lines # to parse. They should either contain single assignments or # setopt or unsetopt statements. The state for each parameter # or option so parsed is set to the value given by the first argument. __zni_parse_lines() { local line opt warned first local -a args local state=$1 shift for line in "$@"; do case $line in ((#b)[[:blank:]]#([[:IDENT:]]##)=(*)) parsed_parameters[$match[1]]=$match[2] state_parameters[$match[1]]=$state ;; ((#b)[[:blank:]]#(un|)setopt[[:blank:]]##(*)) # TBD: handle setopt noX / unsetopt X for opt in ${=match[2]}; do opt=${${opt//(#m)[[:upper:]]/${(L)MATCH}}//_} if [[ $match[1] = un ]]; then parsed_options[$opt]=off else parsed_options[$opt]=on fi state_options[$opt]=$state done ;; ((#b)[[:blank:]]#bindkey[[:blank:]]##(*)) args=(${(z)match[1]}) # store keys unquoted: will need quoting for output. first=${(Q)args[1]} shift args if [[ $first = -[ev] && ${#args} -eq 0 ]]; then case $first in (-e) parsed_keymaps[main]=emacs ;; (-v) parsed_keymaps[main]=vi ;; esac state_keymaps[main]=$state else # TODO: handling keymap options parsed_bindings[first]=${args[2,-1]} state_bindings[first]=$state fi ;; ([[:blank:]]#($startline|$endline|)) ;; (*) unparsed+=($line) print -r "WARNING: failed to understand line: $line which will be retained but not edited." warned=1 ;; esac done if [[ -n $warned ]]; then read -k key$shortprompt fi } # Apply defaults. Arguments in the form # -p parameter_name default_value description # ... # -o option_name default=on|off description # ... # Options on by default should begin !, e.g. !nomatch. They # will still appear under the base option but with an indication that # the default is on. The default applies to the base option. Hack, sorry. # -b bindkey_string default_value description # ... # -B default_keymap=emacs|vi|none description # # They're not really defaults (they're not the same as the # builtin defaults), so the description output is "not yet saved". # # All variables to be edited in this section must be mentioned, # though defaults can be blank in which case nothing will be # saved unless the variable is set by the user. The description # is then "no value set". # # -B is a bit strange: it's simply designed to allow the user to # select "bindkey -e" for Emacs or "bindkey -v" for vi. It only # takes a single argument. Real key bindings use -b. # # This operation transfers some subset of settings from the parsed_* # and state_* variables to the *_lines variables for editing. __zni_apply_defaults() { local un suf # Reset the lines to be edited. state_lines=() display_lines=() output_lines=() lines_read=0 case $1 in (-p) shift while [[ $# -gt 0 && $1 != -* ]]; do # skip default if it was read in if [[ -z $state_parameters[$1] ]]; then parsed_parameters[$1]=$2 if [[ -n $2 ]]; then state_parameters[$1]="not yet saved" else state_parameters[$1]="no value set" fi elif [[ $state_parameters[$1] = saved ]]; then (( lines_read++ )) fi state_lines+=($state_parameters[$1]) display_lines+=("$3") output_lines+=("$1=$parsed_parameters[$1]") shift 3 done ;; (-o) shift while [[ $# -gt 0 && $1 != -* ]]; do # skip default if there was a setting if [[ $1 != ${1##!} ]]; then argv[1]=${1##!} default_options[$1]=on else default_options[$1]=off fi if [[ -z $state_options[$1] ]]; then parsed_options[$1]=$2 if [[ -n $2 ]]; then state_options[$1]="not yet saved" else state_options[$1]="no value set" fi elif [[ $state_options[$1] = saved ]]; then (( lines_read++ )) fi if [[ $parsed_options[$1] = on ]]; then un= suf= elif [[ -z $parsed_options[$1] && $default_options[$1] = on ]] then un= suf=", default on" else # display as unsetopt even if no value to save yet un=un suf= fi state_lines+=("$state_options[$1]$suf") display_lines+=("$3") output_lines+=("${un}setopt $1") shift 3 done ;; (-b) shift # this will barf on bindings beginning -; there's no good # reason to rebind that, even in vi command mode, so perhaps # we just add it to the sanity checks when we get around to them. while [[ $# -gt 0 && $1 != -* ]]; do if [[ -z $state_bindings[$1] ]]; then parsed_bindings[$1]=$2 if [[ -n $2 ]]; then state_bindings[$1]="not yet saved" else state_bindings[$1]="no value set" fi elif [[ $state_bindings[$1] = saved ]]; then (( lines_read++ )) fi state_lines+=($state_bindings[$1]) display_lines+=("$3") output_lines+=("bindkey ${(qq)1}${2:+ $2}") shift 3 done ;; (-B) shift if [[ -z $state_keymaps[main] ]]; then parsed_keymaps[main]=$1 if [[ $1 = none ]]; then state_keymaps[main]="no value set" else state_keymaps[main]="not yet saved" fi elif [[ $state_keymaps[main] = saved ]]; then (( lines_read++ )) fi state_lines+=($state_keymaps[main]) display_lines+=("$2") # display as -e even if no value to save yet if [[ $parsed_keymaps[main] = vi ]]; then output_lines+=("bindkey -v") else output_lines+=("bindkey -e") fi shift 2 ;; esac } # Display and edit the settings given by the set of *_lines arrays. # If requested by the user, apply the settings, updating the # parsed_* and state_* variables. __zni_display_and_edit() { integer i changes local default edval ldisp rdisp local -a states displays outputs tstval states=("${state_lines[@]}") displays=("${display_lines[@]}") outputs=("${output_lines[@]}") if [[ -n ${states[(r)not yet saved]} ]]; then # default should be installed, unless user says otherwise (( changes++ )) fi while true; do clear print -r $1 # snicker... print -r ${(l.${#1}..=.):-} print if (( $# > 1 )); then print -rl $argv[2,-1] print fi # Output each setting with a description and state. for (( i = 1; i <= ${#output_lines}; i++ )); do default=${states[$i]%%,*} if [[ $default = ("no value set"|"not to be saved"*) ]]; then ldisp="# $outputs[$i]" else ldisp=$outputs[$i] fi rdisp=${default:+($default)} print -r "# ($i) $displays[$i] $ldisp${(l.$COLUMNS-${#ldisp}-${#rdisp}-1.):-}$rdisp" done if (( changes )); then print -r " # (0) Remember edits and return to main menu (does not save file yet) # (q) Abandon edits and return to main menu " else print -r " # (0) or (q) Return to main menu (no changes made yet) " fi read -k key$longprompt print if [[ $key = <-> && $key -ge 1 && $key -le ${#outputs} ]]; then (( i = key )) case $outputs[$i] in ((#b)(|un)setopt' '(*)) # Try to locate the appropriate section in the manual. # I personally have no wish whatsoever to make this # use sed or awk. Suggestions welcome. if [[ -s $tmpfile-man-options ]]; then perl -ne 's/^(\s*)([A-Z]+)_?([A-Z]*)_?([A-Z]*)(\s*\(.+\)|\s*\<.+\>)*\s*$/\L$1$2$3$4\n/ and "'$match[2]'" =~ /^(|no)\L$2$3$4$/ and $print = 1 and next; next unless $print; exit if /^\s*$/; print; ' <$tmpfile-man-options >$tmpfile-man 2>/dev/null else rm -f $tmpfile-man fi while true; do clear if [[ -s $tmpfile-man ]]; then read <$tmpfile-man print "Option $match[2]:" cat $tmpfile-man print else print "Option $match[2]: $displays[$i]" fi print "The option $match[2] is currently ${match[1]:+un}set. Type: (s) to set it (turn it on) (u) to unset it (turn it off) (n) neither to set or unset it (use shell default: \ $default_options[$match[2]]) (k) or (q) to keep the current setting:" read -k key$shortprompt print case $key in (s) (( changes++ )) outputs[$i]="setopt $match[2]" states[$i]="set but not saved" ;; (u) (( changes++ )) outputs[$i]="unsetopt $match[2]" states[$i]="set but not saved" ;; (n) (( changes++ )) outputs[$i]="unsetopt $match[2]" states[$i]="no value set" ;; ([kq]) ;; (*) continue ;; esac break; done ;; ((#b)([^=]##)=(*)) if [[ -s $tmpfile-man-param ]]; then perl -ne 's/^(\s*)([A-Z]+)(\s*\<.+\>)*\s*$/$1$2\n/ and "$2" eq "'$match[1]'" and $print = 1; next unless $print; exit if /^\s*$/; print;' <$tmpfile-man-param >$tmpfile-man 2>/dev/null else rm -f $tmpfile-man fi if [[ -s $tmpfile-man ]]; then print -n Variable cat $tmpfile-man print else print -r "Variable ${match[1]}: $displays[$i]" fi print -r "Edit a value. If it is left blank, nothing will be saved:" edval=$match[2] if vared -p "$match[1]> " -h edval; then # check this assignment doesn't produce multiple words # e.g. "HISTFILE=never rm -f ~" does produce multiple words... # this isn't perfect, e.g. "(this would get split on assignment)", # but that's fairly benign. tstval=(${=edval}) if (( ${#tstval} > 1 )); then print "Error: value isn't a single word. Use quotes or backslashes if your value contains spaces. Note that you shouldn't quote an initial ~ in file names." >&2 read -k key$shortprompt # now check the assignment works... # don't suppress any errors, they may be useful. # this means we need to suppress warncreateglobal. elif ! ( typeset -g $match[1]; eval "$match[1]=$edval" ); then print "Error: bad shell syntax in value. The value will be assigned to the variable exactly as you enter it. Make sure all quotes are paired." >&2 read -k key$shortprompt else outputs[$i]="$match[1]=$edval" if [[ -n $edval ]]; then states[$i]="set but not saved" else states[$i]="no value set" fi (( changes++ )) fi else read -k key'?--- Edit abandoned, type a key --- ' fi ;; (bindkey' '-[ev]) while true; do print -nr "Pick a keymap (set of keys) to use when editing. Type: (e) for Emacs keymap (recommended unless you are vi user) (v) for Vi keymap (n) not to set a keymap (allow shell to choose) (k) to keep the current setting, " if [[ ${state_lines[$i]%%,*} = ("no value set"|"not to be saved") ]] then print -r "(n):" elif [[ $output_lines[$i] = *-v ]]; then print -r "(v):" else print -r "(e):" fi read -k key$longprompt case $key in (e) (( changes++ )) outputs[$i]="bindkey -e" states[$i]="set but not saved" ;; (v) (( changes++ )) outputs[$i]="bindkey -v" states[$i]="set but not saved" ;; (n) (( changes++ )) outputs[$i]="bindkey -e" states[$i]="not to be saved" ;; (k) ;; (*) continue ;; esac break done ;; (bindkey' '*) # TODO: this needs writing. We need to be able to read # keys and translate them, sanity check them, and ideally # handle keymaps, at least vi command and insert. ;; (*) print "*** Internal error: bad setting '$outputs[$i]' ***" >&2 read -k key'?--- Type a key in forlorn hope --- ' ;; esac elif [[ $key = 0 ]]; then # Update the *_lines variables state_lines=("${states[@]}") display_lines=("${displays[@]}") output_lines=("${outputs[@]}") # Also save any lines suitably marked to parsed_* and state_* # by rerunning __zni_parse_lines on each such line. for (( i = 1; i <= ${#output_lines}; i++ )); do if [[ ${state_lines[$i]%%,*} = \ ("set but not saved"|"not to be saved"|"not yet saved") ]] then __zni_parse_lines ${state_lines[$i]%%,*} $output_lines[$i] fi done return $(( changes == 0 )) elif [[ $key = [qQ] ]]; then return 1 fi done } # Print and despatch a submenu. # The first argument is the title. The remaining arguments # are pairs of descriptions and functions to execute. # There shouldn't be more than 9 entries. # The usual entries 0 and q are added automatically. __zni_submenu() { local title=$1 local desc func local -a descs funcs integer i shift clear print -r $title print -r ${(l.${#title}..=.):-} for desc func; do if [[ -z $func ]]; then print "*** Internal error: bad argument set for __zni_submenu ***" >&2 read -k key'?--- Type a key in forlorn hope --- ' return 1 fi descs+=($desc) funcs+=($func) done while true; do for (( i = 1; i <= ${#descs}; i++ )); do print -r " ($i) $descs[$i]" done print -r " (0) or (q) Return to previous menu" read -k key$longprompt if [[ $key = [0qQ] ]]; then return 1 elif (( key >= 1 && key <= ${#funcs} )); then $funcs[$key] fi done } # Save all values that have been edited to .zshrc. __zni_save() { local key optline newline local -a on_opts off_opts lines lines2 integer i # Record lines containing parameter settings, sorted. for key in ${(ok)parsed_parameters}; do if [[ $state_parameters[$key] != ("no value set"|"not to be saved") ]] then lines+=("$key=$parsed_parameters[$key]") fi done # Search through sorted options, make list of those to # be turned on and off. Those marked "no value set" aren't # to be output. for key in ${(ok)parsed_options}; do if [[ $state_options[$key] != ("no value set"|"not to be saved") ]]; then if [[ $parsed_options[$key] = on ]]; then on_opts+=($key) else off_opts+=($key) fi fi done # Construct lines of options to turn on, keeping them short. optline="setopt" for (( i = 1; i <= ${#on_opts}; i++ )); do newline="$optline $on_opts[$i]" if [[ ${#newline} -ge 72 ]]; then lines+=($optline) optline="setopt $on_opts[$i]" else optline=$newline fi if (( i == ${#on_opts} )); then lines+=($optline) fi done # Construct lines of options to turn off, keeping them short. optline="unsetopt" for (( i = 1; i <= ${#off_opts}; i++ )); do newline="$optline $off_opts[$i]" if [[ ${#newline} -ge 72 ]]; then lines+=($optline) optline="unsetopt $off_opts[$i]" else optline=$newline fi if (( i == ${#off_opts} )); then lines+=($optline) fi done # Construct lines of bindkey commands. First the keymap. if [[ $state_keymaps[main] != (|"no value set"|"not to be saved") ]]; then case $parsed_keymaps[main] in (emacs) lines+=("bindkey -e") ;; (vi) lines+=("bindkey -v") ;; (none) ;; (*) print -r "\ *** Internal error: bad type $parsed_keymaps[main] for keymap ***" >&2 read -k key'?--- Type a key in forlorn hope --- ' ;; esac fi # Now bindings. for key in ${(ok)parsed_bindings}; do if [[ $state_bindings[$key] != ("no value set"|"not to be saved") ]]; then lines+=("bindkey ${(qq)key} ${parsed_bindings[$key]}") fi done # Save the lines with a start and end marker to a temporary file. print -rl $startline $lines $endline >$tmpfile if (( ${#unparsed} )); then print "# The following lines were read by $myname. # They were moved here as they could not be understood. # $(date) ${(F)unparsed} # End of lines moved by $myname." >>$tmpfile fi if grep "$startline" $zd/.zshrc 1>/dev/null 2>&1; then # Found the start line; replace the section. # We could this by reading the lines in zsh, but in case # the .zshrc is huge it's perhaps better to use sed. sed -e "/^[ ]*$endline/r $tmpfile /^[ ]*$startline/,/^[ ]*$endline/d" $zd/.zshrc >${tmpfile}.repl && cp ${tmpfile}.repl $zd/.zshrc else # No current start marker; just append. cat $tmpfile >>$zd/.zshrc fi } ######################################################################## # Specific configurations ######################################################################## __zni_history_config() { __zni_apply_defaults -p \ HISTSIZE 1000 "Number of lines of history kept within the shell." \ HISTFILE $zdmsg/.histfile "File where history is saved." \ SAVEHIST 1000 "Number of lines of history to save to \$HISTFILE." if __zni_display_and_edit "History configuration"; then install_state[history]="Unsaved changes" save=1 fi } __zni_completion_config() { autoload -Uz compinstall if compinstall -d; then print "The completion system has already been activated. You can run the configuration tool (compinstall) at any time by typing autoload -Uz compinstall compinstall Do you wish to run it now [y/n]?" read -k key$shortprompt if [[ $key = [yY] ]]; then compinstall fi print else while true; do clear print "The new completion system (compsys) allows you to complete commands, arguments and special shell syntax such as variables. It provides completions for a wide range of commonly used commands in most cases simply by typing the TAB key. Documentation is in the zshcompsys manual page. If it is not turned on, only a few simple completions such as filenames are available but the time to start the shell is slightly shorter. You can: (1) Turn on completion with the default options. (2) Run the configuration tool (compinstall). You can also run this from the command line with the following commands: autoload -Uz compinstall compinstall if you don't want to configure completion now. (0) Don't turn on completion. " read -k key$longprompt case $key in (1) completion_lines=${(f)"$(compinstall -o)"} install_state[completion]="Unsaved changes" save=1 ;; (2) if compinstall; then install_state[completion]="Configured" # compinstall has done it's thing, so we don't need # to write anything. completion_lines=() fi ;; (0) completion_lines=() install_state[completion]="Recommended" ;; (*) continue ;; esac break done fi } __zni_bindkey_config() { __zni_apply_defaults -B emacs "Change default editing configuration" if __zni_display_and_edit "Default editing configuration" \ "The keys in the shell's line editor can be made to behave either" \ "like Emacs or like Vi, two common Unix editors. If you have no" \ "experience of either, Emacs is recommended. If you don't pick one," \ "the shell will try to guess based on the EDITOR environment variable." \ "Usually it's better to pick one explicitly."; then install_state[bindkey]="Unsaved changes" save=1 fi } __zni_completion_save() { if (( ${#completion_lines} )); then # We don't try to replace existing lines of completion configuration --- # that's up to compinstall. We should already have tested that # there was no existing completion set up. print -rl $completion_lines >>$zd/.zshrc fi } __zni_options_config() { # when we have enough, should use: # __zni_submenu "Common shell options" # This is deliberately just a tiny selection. # Feel free to extend it, but if you do, consider using __zni_submenu. # The "no" prefix is used to indicate options on by default. __zni_apply_defaults -o autocd '' "Change directory given just path." \ extendedglob '' "Use additional pattern matching features." \ appendhistory '' "Append new history lines instead of overwriting." \ '!nomatch' '' "Unmatched patterns cause an error." \ '!beep' '' "Beep on errors." \ notify '' "Immediately report changes in background job status." if __zni_display_and_edit "Common shell options" \ "The following are some of the shell options that are most often used." \ "The descriptions are very brief; if you would like more information," \ "read the zshoptions manual page (type \"man zshoptions\")."; then install_state[options]="Unsaved changes" save=1 fi } ######################################################################## # Main function ######################################################################## # Read and parse any existing lines, in case the function # was called again. __zni_retrieve_lines && __zni_parse_lines saved "$reply[@]" if [[ $state_parameters[HISTORY] = saved ]]; then install_state[history]="Saved" fi autoload -Uz compinstall zstyle :compinstall filename $zd/.zshrc if compinstall -d; then install_state[completion]="Saved" fi # skip initial screen if the function was deliberately run by the user. if [[ $1 != -f ]]; then clear print -r "This is the Z Shell configuration function for new users, $myname. You are seeing this message because you have no zsh startup files (the files .zshenv, .zprofile, .zshrc, .zlogin in the directory $zdmsg). This function can help you with a few settings that should make your use of the shell easier. You can: (q) Quit and do nothing. The function will be run again next time." if [[ ! -f $zd/.zshrc ]]; then print -r " (0) Exit, creating the file $zdmsg/.zshrc containing just a comment. That will prevent this function being run again." fi print -r " (1) Continue to the main menu. " if [[ -f /etc/zsh/newuser.zshrc.recommended ]]; then print -r "(2) Populate your $zdmsg/.zshrc with the configuration recommended by the system administrator and exit (you will need to edit the file by hand, if so desired). " fi read -k key$longprompt print case $key in ([qQ]) return 0 ;; (0) print -r $msg >$zd/.zshrc return 0 ;; (1) ;; (2) cp /etc/zsh/newuser.zshrc.recommended $zd/.zshrc source $zd/.zshrc return 0 ;; (*) print -r "Aborting." if [[ $1 != -f ]]; then print "\ The function will be run again next time. To prevent this, execute: touch $zdmsg/.zshrc" fi return 1 ;; esac fi print -r "Attempting to extract information from manual pages..." (man zshoptions | col -b > $tmpfile-man-options; man zshparam | col -b > $tmpfile-man-param) 2>/dev/null while true; do clear print -nr "Please pick one of the following options: (1) Configure settings for history, i.e. command lines remembered and saved by the shell.\ ${install_state[history]:+ ($install_state[history].)} (2) " if [[ $install_state[completion] = Recommended ]]; then print -nr "Configure" else print -nr "Use" fi print -r " the new completion system.\ ${install_state[completion]:+ ($install_state[completion].)} (3) Configure how keys behave when editing command lines.\ ${install_state[bindkey]:+ ($install_state[bindkey].)} (4) Pick some of the more common shell options. These are simple \"on\" or \"off\" switches controlling the shell's features. \ ${install_state[options]:+ ($install_state[options].)} " print -nr "(0) Exit, " if (( save )); then print -r "saving the new settings. They will take effect immediately." elif [[ -f $zd/.zshrc ]]; then print -r "leaving the existing $zdmsg/.zshrc alone." else print -r "creating a blank $zdmsg/.zshrc file." fi print -r " (a) Abort all settings and start from scratch. Note this will overwrite any settings from $myname already in the startup file. It will not alter any of your other settings, however." if [[ $1 = -f ]]; then print -r " (q) Quit and do nothing else." else print -r " (q) Quit and do nothing else. The function will be run again next time." fi read -k key$longprompt print case $key in ([qQ]) break ;; ([aA]) parsed_parameters=() state_parameters=() parsed_options=() state_options=() parsed_keymaps=() state_keymaps=() parsed_bindings=() state_bindings=() unparsed=() ;; (0) clear if (( save )); then if [[ -f $zd/.zshrc ]]; then cp $zd/.zshrc $zd/.zshrc.zni && print -r "Copied old '$zdmsg/.zshrc' to '$zdmsg/.zshrc.zni'. " fi __zni_save __zni_completion_save elif [[ ! -f $zd/.zshrc ]]; then print -r $msg >$zd/.zshrc fi if [[ $1 != -f ]]; then print -r "The function will not be run in future, but you can run it yourself as follows: autoload -Uz $myname $myname -f The code added to $zdmsg/.zshrc is marked by the lines $startline $endline You should not edit anything between these lines if you intend to run $myname again. You may, however, edit any other part of the file." fi break ;; (1) __zni_history_config ;; (2) __zni_completion_config ;; (3) __zni_bindkey_config ;; (4) __zni_options_config ;; esac done } always { # Tidy up: always executed unless the shell is stopped dead # in its tracks. unfunction -m $myname __zni_\* rm -f $tmpfile* } PK[(``functions/_sisunuW+A#compdef sisu local curcontext="$curcontext" state line ret=1 typeset -A opt_args _arguments -s -C -M 'r:|[_-]=* r:|=*' \ '(--convert --to -C)-U[prints to screen url output map of available output possibilities]' \ '(--convert --to -C)-u[url mapping of output files for requested processing flags]' \ '(--convert --to -C)-V[more verbose than -v]' \ '(--convert --to -C)-v[verbose]' \ '--no-ocn[-\[hHp\]switches off object citation numbering]' \ '--no-annotate[-\[mhHpoxXabN\] strips output text of additional editors endnotes]' \ '(--convert --to -C)-A[plaintext with dos line-feeds, footnotes follow paragraphs in which they occur]' \ '(--convert --to -C)-a[plaintext with Unix line-feeds, footnotes follow paragraphs in which they occur]' \ '(--convert --to -C)-b[XHTML output]' \ '(- *)-C[initialise site]' \ '(--convert --to -C)-c[toggle screen color on or off depending on set default]' \ '(--convert --to -C)-E[plaintext with dos line-feeds, endnotes following main text]' \ '(--convert --to -C)-e[plaintext with Unix line-feeds, endnotes following main text]' \ '(--convert --to -C)-F[generate sample cgi web search form \[--webserv=webrick for sisu webrick url\]]' \ '(--convert --to -C -h)-H[HTML output, without link suffixes]' \ '(--convert --to -C -H)-h[HTML output]' \ '(--convert --to -C)-I[texinfo output, not maintained]' \ '(--convert --to -C)-L[print license info]' \ '(--convert --to -C)-M[maintenance mode, retain intermediate processing files]' \ '(--convert --to -C)-m[create intermediate markup file, metaverse, assumed for most output instuctions]' \ '(--convert --to -C)-N[document content certificate, output document digests]' \ '(--convert --to -C)-n[skip intermediate markup, skip -m]' \ '(--convert --to -C)-o[Open Document text format output]' \ '(--convert --to -C)-p[LaTeX pdf output]' \ '(--convert --to -C)-q[quiet mode]' \ '(--convert --to -C)-R[post output to remote host using rsync, requires pre-configuration]' \ '(--convert --to -C)-r[post output to remote host using scp, requires pre-configuration]' \ '(--convert --to -C)-S[produces and shares tarred gzipped markup source document with associated images etc.]' \ '(--convert --to -C)-s[shares markup source]' \ '(--convert --to -C)-t[termsheet, preprocessing]' \ '(- *)-W[starts ruby webrick server]' \ '(--convert --to -C)-w[concordance file]' \ '(--convert --to -C)-X[XML dom style]' \ '(--convert --to -C)-x[XML sax style]' \ '(--convert --to -C)-y[output summary page, manifest of existing generated output]' \ '(--convert --to -C)-Z[zap delete/destroy output]' \ '--import[-\[Dd\] imports document to database]' \ '--update[-\[Dd\] updates document in database]' \ '--remove[-\[Dd\] removes document from database]' \ '--dropall[-\[Dd\] drops database, tables, indexes, all!]' \ '--create[-\[Dd\] creates new database - tables, indexes, etc.]' \ '--recreate[-\[Dd\] drops database, killing data and creates new empty database - tables, indexes, etc.]' \ '(--convert --to -C)-D[postgresql database instruction]' \ '(--convert --to -C)-d[sqlite database instruction]' \ '(- *)--help[display help information]' \ '(--convert --to -C -2 -3 -4 -5)-1[shortcut, initial default -mNHwpy]' \ '(--convert --to -C -1 -3 -4 -5)-2[shortcut, initial default -mNHwpaoy]' \ '(--convert --to -C -1 -2 -4 -5)-3[shortcut, initial default -mNHwpaobxXy]' \ '(--convert --to -C -1 -2 -3 -5)-4[shortcut, initial default -mNHwpaobxXDy --import]' \ '(--convert --to -C -1 -2 -3 -4)-5[shortcut, initial default -mNHwpaobxXDy --update]' \ '--to=node[XML node based input representation, experimental]' \ '--to=sax[XML sax based input representation, experimental]' \ '--to=dom[XML dom based input representation, experimental]' \ '--convert=footnotes[embedded footnotes]' \ '--to=current[current markup]' \ '*:SiSU files:_files -g "*.(sst|ssm)(.)"' PK[, yxxfunctions/_x_localenuW+A#autoload local x="$argv[(I)-X]" if (( x )); then _message -r "$argv[x + 1]" else _message -e locales 'locale' fi PK[yfunctions/_file_systemsnuW+A#autoload local expl fss case $OSTYPE in aix*) fss=( jfs nfs cdrfs ) ;; irix*) fss=( efs proc fd nfs iso9660 dos hfs cachefs xfs ) ;; linux*) typeset -aU fss fss=( adfs bfs cramfs ext2 ext3 hfs hpfs iso9660 minix ntfs qnx4 reiserfs romfs swap udf ufs vxfs xfs xiafs ) [[ -r /proc/filesystems ]] && fss+=( ${$(/dev/null)"}[2,-1]%% *} && ret=0 elif (( CURRENT == 3 )); then case $subcmd in addif|delif) _net_interfaces && ret=0 ;; setageing|setgcint|setfd|sethello|setmaxage) _message -e time 'time (seconds)' ;; setbridgeprio) _message -e priority 'priority' ;; setpathcost|setportprio) _message -e ports 'port' ;; stp) _wanted states expl 'state' compadd on off && ret=0 ;; *) _message 'unknown subcommand: $subcmd' ;; esac elif (( CURRENT == 4 )); then if [[ $subcmd == setpathcost ]]; then _message -e cost 'cost' elif [[ $subcmd == setportprio ]]; then _message -e priority 'priority' fi fi fi return ret PK[N,,functions/history-search-endnuW+A# function history-search-end { # # This implements functions like history-beginning-search-{back,for}ward, # but takes the cursor to the end of the line after moving in the # history, like history-search-{back,for}ward. To use them: # zle -N history-beginning-search-backward-end history-search-end # zle -N history-beginning-search-forward-end history-search-end # bindkey '...' history-beginning-search-backward-end # bindkey '...' history-beginning-search-forward-end integer cursor=$CURSOR mark=$MARK if [[ $LASTWIDGET = history-beginning-search-*-end ]]; then # Last widget called set $MARK. CURSOR=$MARK else MARK=$CURSOR fi if zle .${WIDGET%-end}; then # success, go to end of line zle .end-of-line else # failure, restore position CURSOR=$cursor MARK=$mark return 1 fi # } PK[Z99functions/tetrisnuW+A# Someone once accused zsh of not being as complete as Emacs, because it # lacks Tetris and an adventure game. # # autoload -Uz tetris # zle -N tetris # bindkey '...' tetris emulate -L zsh tetris_hsz=11 tetris_vsz=20 typeset -ga tetris_shapes tetris_shapes=( 0x0f00 0x4444 0x0f00 0x4444 0x4e00 0x4c40 0x0e40 0x4640 0x6600 0x6600 0x6600 0x6600 0x4620 0x6c00 0x4620 0x6c00 0x2640 0x6300 0x2640 0x6300 0x6440 0x8e00 0x44c0 0x0e20 0xc440 0x0e80 0x4460 0x2e00 ) typeset -gA tetris_rotations tetris_rotations=( 0x0f00 0x4444 0x4444 0x0f00 0x4e00 0x4c40 0x4c40 0x0e40 0x0e40 0x4640 0x4640 0x4e00 0x6600 0x6600 0x4620 0x6c00 0x6c00 0x4620 0x2640 0x6300 0x6300 0x2640 0x6440 0x8e00 0x8e00 0x44c0 0x44c0 0x0e20 0x0e20 0x6440 0xc440 0x0e80 0x0e80 0x4460 0x4460 0x2e00 0x2e00 0xc440 ) tetris_blankline= for ((tetris_i=tetris_hsz; tetris_i--; )); do tetris_blankline="$tetris_blankline " done tetris_blankboard= for ((tetris_i=tetris_vsz; tetris_i--; )); do tetris_blankboard="$tetris_blankboard$tetris_blankline" done bindkey -N tetris bindkey -R -M tetris '\000-\377' tetris-timeout for ((tetris_i=256; tetris_i--; )); do bindkey -M tetris 'T\'$(([##8]tetris_i)) tetris-timeout done bindkey -M tetris Ta tetris-left bindkey -M tetris Tj tetris-left bindkey -M tetris Ts tetris-rotate bindkey -M tetris Tk tetris-rotate bindkey -M tetris Td tetris-right bindkey -M tetris Tl tetris-right bindkey -M tetris 'T ' tetris-drop bindkey -M tetris Tq tetris-quit unset tetris_board tetris_score zle -N tetris function tetris { emulate -L zsh if ! zle; then print -u2 "Use M-x tetris RET to play tetris." return 2 fi tetris_saved_state="BUFFER=${BUFFER:q};CURSOR=${CURSOR:q};MARK=${MARK:q};zle -K ${KEYMAP:q}" tetris_speed=$((100.0/KEYTIMEOUT)) zle -K tetris if [[ ${tetris_board+set} == set ]]; then tetris-timeout else tetris_board=$tetris_blankboard tetris_score=0 tetris-new-block fi } function tetris-new-block { emulate -L zsh tetris_block=$tetris_shapes[1+RANDOM%$#tetris_shapes] tetris_block_y=0 tetris_block_x=4 if ! tetris-block-fits; then tetris-place-block "#" tetris-render-screen unset tetris_board tetris_score tetris-quit return fi tetris-place-block "*" tetris-timed-move } zle -N tetris-left function tetris-left { emulate -L zsh tetris-place-block " " (( tetris_block_x-- )) tetris-block-fits || (( tetris_block_x++ )) tetris-place-block "*" tetris-timeout } zle -N tetris-right function tetris-right { emulate -L zsh tetris-place-block " " (( tetris_block_x++ )) tetris-block-fits || (( tetris_block_x-- )) tetris-place-block "*" tetris-timeout } zle -N tetris-rotate function tetris-rotate { emulate -L zsh tetris-place-block " " local save_block=$tetris_block tetris_block=$tetris_rotations[$tetris_block] tetris-block-fits || tetris_block=$save_block tetris-place-block "*" tetris-timeout } zle -N tetris-drop function tetris-drop { emulate -L zsh tetris-place-block " " ((tetris_block_y++)) while tetris-block-fits; do ((tetris_block_y++)) done ((tetris_block_y--)) tetris-block-dropped } zle -N tetris-timeout function tetris-timeout { emulate -L zsh tetris-place-block " " ((tetris_block_y++)) if tetris-block-fits; then tetris-place-block "*" tetris-timed-move return fi ((tetris_block_y--)) tetris-block-dropped } function tetris-block-dropped { emulate -L zsh tetris-place-block "O" local fl=${tetris_blankline// /O} i=$((tetris_block_y*tetris_hsz)) y for ((y=0; y!=4; y++)); do if [[ $tetris_board[i+1,i+tetris_hsz] == $fl ]]; then tetris_board[i+1,i+tetris_hsz]= tetris_board=$tetris_blankline$tetris_board ((tetris_score++)) fi ((i += tetris_hsz)) done tetris-new-block } function tetris-block-fits { emulate -L zsh local y x i=$((1+tetris_block_y*tetris_hsz+tetris_block_x)) b=0x8000 for ((y=0; y!=4; y++)); do for ((x=0; x!=4; x++)); do if ((tetris_block&b)); then ((x+tetris_block_x >= 0)) || return 1 ((x+tetris_block_x < tetris_hsz)) || return 1 ((y+tetris_block_y >= 0)) || return 1 ((y+tetris_block_y < tetris_vsz)) || return 1 [[ $tetris_board[i] == " " ]] || return 1 fi ((b >>= 1)) ((i++)) done ((i+=tetris_hsz-4)) done return 0 } function tetris-place-block { emulate -L zsh local y x i=$((1+tetris_block_y*tetris_hsz+tetris_block_x)) b=0x8000 for ((y=0; y!=4; y++)); do for ((x=0; x!=4; x++)); do ((tetris_block&b)) && tetris_board[i]=$1 ((b >>= 1)) ((i++)) done ((i+=tetris_hsz-4)) done } function tetris-timed-move { emulate -L zsh tetris-render-screen LBUFFER= RBUFFER=$'\n'$tetris_screen zle -R zle -U T } function tetris-render-screen { emulate -L zsh setopt extendedglob local s i extras extras=( "Score: $tetris_score" "" "Game parameters: ${tetris_hsz}x$tetris_vsz, ${tetris_speed}Hz" "" "Keys: left: a j" " rotate: s k" " right: d l" " drop: space" " quit: q" ) for ((i=0; i!=tetris_vsz; i++)); do s="$s|${${${${${tetris_board[1+i*tetris_hsz,(i+1)*tetris_hsz]}//O/()}//\*/**}// / }//\#/##}|"${extras[1]+ $extras[1]}$'\n' extras[1]=() done s="$s+${tetris_blankline// /--}+" tetris_screen=$s } zle -N tetris-quit function tetris-quit { emulate -L zsh if [[ ! -o always_last_prompt ]]; then BUFFER= zle -M $tetris_screen fi eval $tetris_saved_state if [[ -o always_last_prompt ]]; then zle -M $tetris_screen fi } tetris "$@" PK[Vۮfunctions/which-commandnuW+Azmodload -i zsh/parameter zsh/zutil zle -I local -a whencecmd wds # Set the whence style to your favourite function # (but NOT which-command!) zstyle -a :zle:$WIDGET whence whencecmd || whencecmd=(whence -c --) wds=(${(z)LBUFFER}) local wd barewd local -A seen while true; do wd=${wds[1]} barewd=${(Q)wd} if [[ $barewd != $wd || -n $seen[$barewd] ]]; then # quoted or already expanded, see if original word is an alias... if [[ -z $seen[$barewd] && -n $aliases[$wd] ]]; then # yes, so we need to decode that, with no extra expansion... $whencecmd $wd seen[$wd]=1 wds=(${(z)aliases[$wd]}) continue else # use unquoted word, don't expand alias (unalias -- $barewd 2>/dev/null; $whencecmd $barewd) fi else # turn on globsubst for =ls etc. $whencecmd ${~barewd} if [[ -n $aliases[$barewd] && -z $seen[$barewd] ]]; then # Recursively expand aliases seen[$barewd]=1 wds=(${(z)aliases[$barewd]}) continue fi fi break done PK[yak functions/_idnuW+A#compdef id _arguments \ '-a[no-op]' \ '(-Z --context)'{-Z,--context}'[print only context]' \ '(-g --group)'{-g,--group}'[print only EGID]' \ '(-G --groups)'{-G,--groups}'[print all GIDs]' \ '(-n --name)'{-n,--name}'[print name instead of number]' \ '(-r --real)'{-r,--real}'[print real ID instead of effective]' \ '(-u --user)'{-u,--user}'[print only EUID]' \ '--help[display help]' \ '--version[display version]' \ ':user:_users' PK[ZAfunctions/_schrootnuW+A#compdef schroot local expl context state line typeset -A opt_args _arguments -S \ '(-h --help)'{-h,--help}'[help]' \ '(-a --all)'{-a,--all}'[select all chroots and active sessions]' \ '--all-chroots[select all chroots]' \ '--all-sessions[select all active sessions]' \ '*'{-c,--chroot=}'[use specified chroot]:chroot:->chroot' \ '(-d --directory)'{-d,--directory=}'[directory to use]:dir:_files -W / -P /' \ '(-u --user)'{-u,--user=}'[username (default current user)]:user:_users' \ '(-l --list)'{-l,--list}'[list available chroots]' \ '(-i --info)'{-i,--info}'[show information about selected chroots]' \ '--location[print location of selected chroots]' \ '--config[dump configuration of selected chroots]' \ '(-p --preserve-environment)'{-p,--preserve-environment}'[preserve user environment]' \ '(-q --quiet)'{-q,--quiet}'[quiet]' \ '(-v --verbose)'{-v,--verbose}'[verbose]' \ '(-V --version)'{-V,--version}'[version]' \ '(-b --begin-session)'{-b,--begin-session}'[begin a session; returns a session ID]' \ '--recover-session[recover an existing session]' \ '(-e --end-session)'{-e,--end-session}'[end an existing session]' \ '(-f --force)'{-f,--force}'[force operation]' \ '(-):command name: _command_names -e' \ '*::arguments: _normal' && return 0 case "$state" in (chroot) _wanted tag expl 'chroot' \ compadd $(schroot -l -a) ;; esac PK[;functions/_mozillanuW+A#compdef mozilla mozilla-firefox mozilla-xremote-client firefox iceweasel=firefox local curcontext="$curcontext" state line expl ret=1 suf typeset -A opt_args local popts="-installer -CreateProfile -P -ProfileWizard -ProfileManager -SelectProfile" local -a mozopts if [[ $service = *remote* ]]; then state=remote else if [[ $service = *firefox* ]]; then mozopts=( '-browser[open browser window]' \ '-console[start with debugging console]' \ '-h[output help message]' \ '-help[output help message]' \ '-inspector[start with DOM Inspector]:URL to inspect:->location' \ '-install-global-extension[install an extension]:extension to install:_files' \ '-new-window[load URL in new window]:URL to load:->location' \ '-new-tab[load URL in new tab]:URL to load:->location' \ '-no-remote[run with multiple profiles]' \ '-profile[specify profile file]:profile file:_files' \ '-v[show version]' \ '-version[show version]' \ '-safe-mode[disable extensions and themes for this session]' ) else mozopts=( "($popts)-installer[start with 4.x migration window]" "($popts)-ProfileWizard[start with profile wizard]" "($popts)-SelectProfile[start with profile selection dialog]" '-splash[enable splash screen]' '-chat[start with IRC client]' '-news[start with news]' '-venkman[start with JavaScript debugger]' '-terminal[start with command line terminal]' '-mail[start with mail]' '-compose[start with messenger compose]:URL:_urls' ) fi _x_arguments -C $mozopts \ '-height[height of startup window]:height' \ '(-)'{-h,-help}'[show usage message]' \ "($popts)-CreateProfile:profile" \ '-width[width of startup window]:width' \ '(-)'{-v,-version}'[show the version number and build date]' \ "($popts)-P[start with profile]:profile:->profile" \ "($popts)-ProfileManager[start with profile manager]" \ '-UILocale:locale' \ '-contentLocale:locale' \ '-remote[execute a command in an existing Mozilla]:remote command:->remote' \ '-jsconsole[start with JavaScript Console]' \ '-edit[start with editor]:URL:_urls' \ '-chrome[load the specified chrome]:URL:_urls' \ '*:location:->urls' && ret=0 fi [[ "$state" = "urls" ]] && _files "$@" && return 0 # Handle mozilla remote commands if [[ "$state" = "remote" ]]; then local -a remote_commands remote_commands=(openURL openFile saveAs mailto addBookmark ping) compset -P '*\(' if compset -S '(|\\)\)*'; then set - -S "" "$@" else set - -S"${${QIPREFIX:+)}:-\)}$compstate[quote] " "$@" fi case $IPREFIX in openURL*) if compset -P "*,"; then _wanted option expl 'option' compadd "$@" new-tab new-window && ret=0 else compset -S ',*' state=urls fi ;; addBookmark*) state=urls;; openFile*) _files "$@" -W ~;; saveAs*) if compset -P "*,"; then _wanted types expl 'data type' \ compadd "$@" -M 'm:{a-zA-Z}={A-Za-z}' HTML Text PostScript && ret=0 else compset -S ",*" || suf="," _files -qS "$suf" -W ~ && ret=0 fi ;; mailto*) _email_addresses -s, -c && ret=0 ;; *) compset -S '(|\\)\(*' || suf="${${QIPREFIX:+(}:-\(}" _wanted commands expl 'remote commands' \ compadd -qS "$suf" -M 'm:{a-zA-Z}={A-Za-z}' -a \ remote_commands && ret=0 ;; esac fi if [[ "$state" = "urls" ]]; then # Complete mozilla urls if compset -P about: ; then _wanted values expl 'about what' \ compadd "$@" authors blank cache document fonts global hype image-cache \ license logo memory-cache mozilla plugins && ret=0 elif compset -P news: ; then _newsgroups "$@" && ret=0 elif compset -P mailto: ; then _email_addresses -c && ret=0 else _tags prefixes while _tags; do while _next_label prefixes expl 'URL prefix' "$@"; do _urls "$expl[@]" && ret=0 compset -S '[^:]*' compadd -S '' "$expl[@]" about: news: mailto: mocha: javascript: && ret=0 done (( ret )) || return 0 done fi fi if [[ $state == "profile" ]]; then if [[ $service == *firefox* ]]; then local -a profiles text profiledir case "$OSTYPE" in darwin*) profiledir=~/"Library/Application Support/Firefox" ;; *) profiledir=~/.mozilla/firefox/ ;; esac profiles=(${(f)"$(< ${profiledir}/profiles.ini)"}) profiles=(${(M)${profiles}:#(\[Profile|(Path|Name)=)*}) text=${(F)profiles} profiles=(${(f)text//(#b)\[Profile([0-9]##)\] Name=([^ ]##|) Path=([^ ]##|)/$match[2]}) profiles=(${profiles%:}) compadd $profiles else compadd ~/.mozilla/*/*.slt(\:h\:t) fi fi return ret PK[m-® functions/_pinenuW+A#compdef pine pinef local optfile getopts='pine -conf' sortorder lusortorder opts send idx if (( $#_cache_pine_options )); then for optfile in ~/.pinerc /etc/pine.conf; do if [[ -f $optfile ]]; then getopts="cat $optfile" break fi done _cache_pine_options=( $($=getopts | sed -n 's/^\([-a-z]*=\).*/-\1/p') ) fi sortorder=( {subject,arrival,date,from,size}{,/reverse} ) lusortorder=( dont-sort {nickname,fullname}{,-with-lists-last} ) opts=( -h -v -F -conf -create_lu -pinerc -copy_abook -copy_pinerc) # exclusive options idx=( -f -c -i -I -n -o -sort ) # options used when viewing messages send=( -attach -attachlist -attach_and_delete -url ) # options when sending _arguments -s \ "($opts $idx $send -bail -d -k -z -r -p -P *)-h[display help]" \ "($opts $idx $send -bail -d -k -z -r -p -P *)-v[display version information]" \ "($opts $idx $send -r *)-F+[specify file to open and page through]:file:_files" \ "($opts $idx $send *)-conf[print out fresh global configuration]" \ "($opts $idx $send *)-pinerc[put fresh pinerc configuration in file]:file:_files" \ "($opts $idx $send *)-create_lu[create .lu from script]:addressbook file:_files:sort order:(${(j: :)lusortorder})" \ "($opts $idx $send *)-copy_pinerc:pinerc file:_files:remote folder" \ "($opts $idx $send *)-copy_abook:addressbook file:_files:remote folder" \ "($opts $idx -url)-attach[go directly into composer with given file]:file:_files" \ "($opts $idx -url)-attachlist[go to composer with given files]:file:_files" \ "($opts $idx -url)-attach_and_delete[go to composer, attach file, delete when finished]:file:_files" \ "($opts $idx $send)-url[open the given URL]:URL:_email_addresses -c -P mailto\:" \ "($opts $send)-f+[specify mailbox to load]:mailbox: _mailboxes" \ "($opts $send)-c+[specify context to apply to -f arg]: :_guard '[0-9]#' number" \ "($opts $send)-sort[specify sort order of folder]:sort order:(${(j: :)sortorder})" \ "($opts $send)-i[go directly to index, bypassing main menu]" \ "($opts $send)-I+[specify initial keystrokes to be executed]:keystrokes" \ "($opts $send)-n+[entry in index to begin on]: :_guard '[0-9]#' number" \ "($opts $send)-o[open first folder read-only]" \ "(-F -h -v)-r[restricted - can only send mail to oneself]" \ "(-h -v)-d[set debug level]:debug:(0 1 2 3 4 5 6 7 8 9 flush timestamp imap= numfiles= verbose=)" \ \(${(j. .)opts:#-F}')-k[force use of function keys]' \ \(${(j. .)opts:#-F}')-z[allow use of ^Z suspension]' \ \(${(j. .)opts:#-F}')-p+[use alternate .pinerc file]:alternate pinerc:_files' \ \(${(j. .)opts:#-F}')-P+[use alternate pine.conf file]:alternate pine.conf:_files' \ \(${(j. .)opts:#-F}')-x[use configuration exceptions file]:configuration exceptions file:_files' \ \(${(j. .)opts:#-F}")-bail[exit if pinerc file doesn't already exist]" \ '*::recipient:_email_addresses -n pine' \ ${^_cache_pine_options}':option value' PK[Jfunctions/_regex_wordsnuW+A#autoload local opt OPTARG local term=$'\0' while getopts "t:" opt; do case $opt in (t) term=$OPTARG ;; (*) return 1 ;; esac done shift $(( OPTIND - 1 )) local tag=$1 local desc=$2 shift 2 reply=(\() integer i local -a wds for (( i = 1; i <= $#; i++ )); do wds=(${(s.:.)argv[i]}) reply+=(/${wds[1]//\**/"[^$term]#"}"$term"/) if [[ $term = $'\0' ]]; then reply+=(":${tag}:${desc}:(( ${wds[1]//\*}:${wds[2]//(#m)[: \(\)]/\\$MATCH} ))") else reply+=(":${tag}:${desc}:_values -s ${(q)term} ${(q)desc} \ ${(q)${${wds[1]//\*}//(#m)[:\[\]]/\\$MATCH}}\\[${(q)${wds[2]//(#m)[:\[\]]/\\$MATCH}}\\]") fi eval "reply+=($wds[3])" if (( $i == $# )); then reply+=(\)) else reply+=(\|) fi done PK[5]functions/_time_zonenuW+A#compdef -value-,TZ,-default- local expl if (( ! $+_zoneinfo_dirs )); then _zoneinfo_dirs=( /usr/{share,lib,share/lib}/{zoneinfo*,locale/TZ}(/) ) fi _wanted time-zones expl 'time zone' _files -W _zoneinfo_dirs "$@" - PK[5Pfunctions/_xtermnuW+A#compdef xterm _xt_arguments \ -+{ah,ai,aw,bc,bdc,cb,cm,cn,cu,dc,hf,ie,im,j,ls,mb,nul,pc,rw,s,sb,sf,si,sk,sp,t,u8,ulc,ut,vb,wc,wf,samename} \ -{version,help,132,leftbar,rightbar,C} \ '-b:inner border size:' \ '-bcf:time text cursor is off when blinking (milliseconds):' \ '-bcn:time text cursor is on when blinking (milliseconds):' \ '-cc:character class:' \ '-cr:text cursor color:_x_color' \ '-e:program: _command_names -e:*::program arguments: _normal' \ '-fb:bold font:_x_font' \ '-fi:icon font:_x_font' \ '-hc:background color for highlighted text:_x_color' \ '-mc:multi-click threshold (milliseconds):' \ '-ms:pointer cursor color:_x_color' \ '-nb:margin bell number:' \ '-sl:save lines:' \ '-ti:terminal ID:_terminals' \ '-tm:terminal setting:' \ '-tn:terminal type:' \ '-ziconbeep:iconbeep (percent):' \ '-C' \ '-S-:pseudo-terminal and file descriptor:' PK[Jfunctions/_xmms2nuW+A#compdef xmms2 _xmms2_command() { local xmms2_cmds xmms2_cmds=( add:"adds a URL to the playlist" addarg:"adds one URL with arguments to the playlist" addid:"adds a Medialib id to the playlist" insert:"inserts one URL at a specific position" insertid:"inserts one Medialib id at a specific position" radd:"adds a directory recursively to the playlist" clear:"clears the playlist" shuffle:"shuffles the playlist" sort:"sort the playlist; use a space delimiter for multiple properties" remove:"removes something from the playlist" list:"lists the playlist" addpls:"Adds the contents of a playlist file to the playlist" play:"starts playback" stop:"stops playback" toggleplay:"toggles playback status between play/pause" pause:"pause playback" next:"play next song" prev:"play previous song" seek:"seek to a specific place in current song" jump:"take a leap in the playlist" move:"move a entry in the playlist" volume:"set volume for a channel" volume_list:"list volume levels for each channel" mlib:"medialib manipulation - type 'xmms2 mlib' for more extensive help" playlist:"playlist manipulation - type 'xmms2 playlist' for more extensive help" coll:"collection manipulation - type 'xmms2 coll' for more extensive help" browse:"browse server file lists" status:"go into status mode" info:"information about current entry" current:"formatted information about the current entry" config:"set a config value" config_list:"list all config values" plugin_list:"list all plugins loaded in the server" stats:"get statistics from server" quit:"make the server quit" help:"print help about a command" ) if (( CURRENT == 1 )); then _describe -t command "xmms2 commands" xmms2_cmds else local curcontext="$curcontext" fi local cmd=$words[1] local curcontext="${curcontext%:*}:xmms2-${cmd}" _call_function ret _xmms2_$cmd } _xmms2_jump() { songlist=(${"$(xmms2 list)"}) playlistitems=() for song ($songlist); do if [[ $song = (#b)' '\[(<->)/(<->)\]' '(*)' '\((*)\) ]]; then playlistitems+=("$match[1][$match[3]]") fi done _values -s ' ' 'playlist items' ${(On)playlistitems} } _xmms2_mlib() { local mlib_cmds mlib_cmds=( add:"Add 'url' to medialib" loadall:"Load everything from the mlib to the playlist" searchadd:"Search for, and add songs to playlist" search:"Search for songs matching criteria" addpath:"Import metadata from all media files under 'path'" rehash:"Force the medialib to check whether its data is up to date" remove:"Remove an entry from medialib" setstr:"Set a string property together with a medialib entry." setint:"Set a int property together with a medialib entry." rmprop:"Remove a property from a medialib entry" addcover:"Add a cover image on id(s)." ) if (( CURRENT == 2 )); then _describe -t command "xmms2 mlib commands" mlib_cmds else local curcontext="$curcontext" fi local cmd=$words[2] local curcontext="${curcontext%:*}:xmms2-${cmd}" _call_function ret _xmms2_$cmd } _xmms2_playlist() { local playlist_cmds playlist_cmds=( list:"List all available playlists" create:"Create a playlist" type:"Set the type of the playlist (list, queue, pshuffle)" load:"Load 'playlistname' stored in medialib" remove:"Remove a playlist" ) if (( CURRENT == 2 )); then _describe -t command "xmms2 playlist commands" playlist_cmds else local curcontext="$curcontext" fi local cmd=$words[2] local curcontext="${curcontext%:*}:xmms2-${cmd}" _call_function ret _xmms2_playlist_$cmd } _xmms2_playlist_load() { local list list=($(xmms2 playlist list)) _describe -t command "xmms2 playlists" list } _xmms2_playlist_remove() { local list list=($(xmms2 playlist list)) _describe -t command "xmms2 playlists" list } _xmms2_coll() { local coll_cmds coll_cmds=( save:"Save a pattern as a collection" rename:"Rename a collection" list:"List all collections in a given namespace" query:"Display all the media in a collection" queryadd:"Add all media in a collection to active playlist" find:"Find all collections that contain the given media" get:"Display the structure of a collection" remove:"Remove a saved collection" attr:"Get/set an attribute for a saved collection" ) if (( CURRENT == 2 )); then _describe -t command "xmms2 collection commands" coll_cmds else local curcontext="$curcontext" fi local cmd=$words[2] local curcontext="${curcontext%:*}:xmms2-${cmd}" _call_function ret _xmms2_coll_$cmd } _xmms2_coll_helper() { local list list=($(xmms2 coll list)) _describe -t command "xmms2 playlists" list } _xmms2_coll_rename() { _xmms2_coll_helper } _xmms2_coll_remove() { _xmms2_coll_helper } _xmms2_coll_get() { _xmms2_coll_helper } _xmms2_coll_query() { _xmms2_coll_helper } _xmms2_coll_queryadd() { _xmms2_coll_helper } _xmms2_coll_attr() { _xmms2_coll_helper } _xmms2_add() { _files } _xmms2_radd() { _dirs } _xmms2_addpls() { local expl _description files expl 'playlist' _files "$expl[@]" -g '*.([mM]3[uU]|[pP][lL][sS])' } _xmms2() { _arguments \ '--format[specify the format of song display]:format string' \ '--no-status[prevent printing song status on completion]' \ '*::xmms2 command:_xmms2_command' } _xmms2 "$@" PK[;p;;functions/run-help-opensslnuW+A if [ $# -eq 0 ]; then man openssl else man $1 fi PK[ oofunctions/_ignorednuW+A#autoload # Use ignored matches. [[ _matcher_num -gt 1 || $compstate[ignored] -eq 0 ]] && return 1 local comp integer ind if ! zstyle -a ":completion:${curcontext}:" completer comp; then comp=( "${(@)_completers[1,_completer_num-1]}" ) ind=${comp[(I)_ignored(|:*)]} (( ind )) && comp=("${(@)comp[ind,-1]}") fi local _comp_no_ignore=yes tmp expl \ _completer _completer_num \ _matcher _c_matcher _matchers _matcher_num _completer_num=1 for tmp in "$comp[@]"; do if [[ "$tmp" = *:-* ]]; then _completer="${${tmp%:*}[2,-1]//_/-}${tmp#*:}" tmp="${tmp%:*}" elif [[ $tmp = *:* ]]; then _completer="${tmp#*:}" tmp="${tmp%:*}" else _completer="${tmp[2,-1]//_/-}" fi curcontext="${curcontext/:[^:]#:/:${_completer}:}" zstyle -a ":completion:${curcontext}:" matcher-list _matchers || _matchers=( '' ) _matcher_num=1 _matcher='' for _c_matcher in "$_matchers[@]"; do if [[ "$_c_matcher" == +* ]]; then _matcher="$_matcher $_c_matcher[2,-1]" else _matcher="$_c_matcher" fi if [[ "$tmp" != _ignored ]] && "$tmp"; then if zstyle -s ":completion:${curcontext}:" single-ignored tmp && [[ $compstate[old_list] != shown && $compstate[nmatches] -eq 1 ]]; then case "$tmp" in show) compstate[insert]='' compstate[list]='list force' tmp='' ;; menu) compstate[insert]=menu _description original expl original compadd "$expl[@]" -S '' - "$PREFIX$SUFFIX" ;; esac fi return 0 fi (( _matcher_num++ )) done (( _completer_num++ )) done return 1 PK[oHfunctions/prompt_zefram_setupnuW+Afunction prompt_zefram_precmd { local exitstatus=$? setopt localoptions noxtrace noksharrays psvar=(SIG) [[ $exitstatus -gt 128 ]] && psvar[1]=SIG$signals[$exitstatus-127] [[ $psvar[1] = SIG ]] && psvar[1]=$exitstatus jobs % >/dev/null 2>&1 && psvar[2]= } function prompt_zefram_setup { PS1='[%(2L.%L/.)'$ZSH_VERSION']%(?..%B{%v}%b)%n%(2v.%B@%b.@)%m:%B%~%b%(!.#.>) ' PS2='%(4_:... :)%3_> ' prompt_opts=( cr subst percent ) add-zsh-hook precmd prompt_zefram_precmd } prompt_zefram_setup "$@" PK[L” functions/_unamenuW+A#compdef uname typeset -A _uname_args if _pick_variant gnu="Free Soft" unix --version; then case $LANG in (de_DE.UTF-8) _uname_args=( all "alle Informationen ausgeben" kernel-name "Namen des Kernels ausgeben" nodename "Netzwerknamen der Maschine ausgeben" kernel-release "Release-Nummer des Kernels ausgeben" kernel-version "Version des Kernels ausgeben" machine "Maschinentyp (Hardware) ausgeben" processor "Typ des Prozessors ausgeben (oder das Wort unknown)" hardware-platform "Hardwareplattform ausgeben (oder das Wort unknown)" operating-system "Namen des Betriebssystems ausgeben" help "diese Hilfe anzeigen und beenden" version "Versionsinformation anzeigen und beenden" ) ;; (*) _uname_args=( all "print all information" kernel-name "print the kernel name" nodename "print the network node hostname" kernel-release "print the kernel release" kernel-version "print the kernel version" machine "print the machine hardware name" processor "print the processor type or \"unknown\"" hardware-platform "print the hardware platform or \"unknown\"" operating-system "print the operating system" help "display this help and exit" version "output version information and exit" ) ;; esac _arguments \ '(--all -a)'{--all,-a}'['$_uname_args[all]']' \ '(--kernel-name -s)'{--kernel-name,-s}'['$_uname_args[kernel-name]']' \ '(--nodename -n)'{--nodename,-n}'['$_uname_args[nodename]']' \ '(--kernel-release -r)'{--kernel-release,-r}'['$_uname_args[kernel-release]']' \ '(--kernel-version -v)'{--kernel-version,-v}'['$_uname_args[kernel-version]']' \ '(--machine -m)'{--machine,-m}'['$_uname_args[machine]']' \ '(--processor -p)'{--processor,-p}'['$_uname_args[processor]']' \ '(--hardware-platform -i)'{--hardware-platform,-i}'['$_uname_args[hardware-platform]']' \ '(--operating-system -o)'{--operating-system,-o}'['$_uname_args[operating-system]']' \ '--help['$_uname_args[help]']' \ '--version['$_uname_args[version]']' else # TODO add options of a NON GNU implementation fi PK[3functions/_setoptnuW+A#compdef setopt # If you first want to complete only unset options, un-comment the lines # setting the _options_unset array and then use: # # _options_unset || _options # # here. _options PK[h255functions/_urpminuW+A#compdef urpme urpmi urpmi.addmedia urpmi.removemedia urpmi.update urpmq urpmf parsehdlist _urpmi_media() { local ret=1 single=0 local -a all_sources opts if [[ $1 = -s ]]; then single=1 shift fi # TODO should we probe for active media only? all_sources=( ${(f)"$(urpmq --list-media 2> /dev/null)"} ) if (( single )); then compadd "$expl[@]" -a all_sources && ret=0 else _values -s , 'urpmi media' "$all_sources[@]" && ret=0 fi return $ret } _urpmi_rpms() { local ret=1 expl _tags rpms files while _tags; do if _requested rpms expl 'urpmi RPM'; then local -a pkgs pkgs=( $(urpmq --list 2> /dev/null \ ${(k)opt_args[--media]:-${opt_args[--searchmedia]:+--media}} \ ${(v)opt_args[--media]}${opt_args[--searchmedia]:+${opt_args[--media]:+,}${opt_args[--searchmedia]}} \ ${(k)opt_args[--excludemedia]} ${(v)opt_args[--excludemedia]} ) ) compadd "$expl[@]" -a pkgs && ret=0 fi _requested files expl '(S)RPM file' \ _files -g '*.(#i)rpm(-.)' && ret=0 (( ret )) || break done return ret } # TODO add completion of remote directory for SSH, rsync, ftp _urpmi_media_url() { local expl ret=1 if compset -P file:// || compset -P removable://; then _files "$@" -W / -/ && ret=0 elif [[ -prefix '(ftp|http)://' ]]; then _urls "$@" && ret=0 else if (( ${+opt_args[--virtual]} )); then _wanted mediatype expl 'type of media' \ compadd -S "" "$@" -- file:// && ret=0 else _wanted mediatype expl 'type of media' \ compadd -S "" "$@" -- ssh:// rsync:// file:// http:// ftp:// removable:// && ret=0 fi fi return $ret } _urpme_package() { local -a _rpms _rpms=( $(_call_program packages rpm -qa 2>/dev/null) ) compadd "$@" -a _rpms } _urpmi_parallel_alias() { # placeholder as I do not actually have parallel system to test return 1 } _urpmi() { local state context line ret=1 help="--help -h" local -a opts_help opts_net opts_verbose opts_inst_rem opts_search opts_media opts_help=( "($help : -)"{--help,-h}"[print usage information]" ) opts_net=( "($help --wget)--curl[use curl to retrieve distant files]" "($help)--limit-rate[limit the download speed (b/s)]:download speed in b/s: " "($help)--proxy:proxy host:_hosts" "($help)--proxy-user:proxy user:_users" "($help --curl)--wget[use wget to retrieve distant files]" ) opts_verbose=( "(--help -h -v)-q[quiet mode]" "(--help -h -q)-v[verbose mode]" ) opts_inst_rem=( "($help)--auto[automatically select a package in choices]" "($help)--force[force invocation even if some packages do not exist]" "($help)--parallel[distributed urpmi across machines of alias]:urpmi alias name:_urpmi_parallel_alias" "($help)--root[use another root for rpm installation]:root diretory:_files -/" "($help)--test[test only, do not modify system]" "($help)-a[select all matches on command line]" ) opts_search=( "($help --fuzzy -z)"{--fuzzy,-y}"[return all matches even if exact match exists]" "($help -p -P)-p[allow search in provides to find package]" "($help -p -P)-P[do not search in provides to find package]" ) opts_media=( "($help)--excludemedia[do not use the given media]:urpmi media: _urpmi_media" "($help --update --use-distrib)--media[use only the media listed by comma]:urpmi media: _urpmi_media" "($help)--searchmedia[use only the given media to search requested (or updated) packages]:urpmi media: _urpmi_media -s" "($help)--sortmedia[sort media according to substrings separated by comma]:urpmi media: _urpmi_media" "($help)--synthesis[use the given synthesis instead of urpmi db]:synthesis file:_url" "($help --media --use-distrib)--update[use only update media]" "($help --media --update)--use-distrib[configure urpmi on the fly from a distrib tree]:installation media:_urpmi_media_url" ) case "$service" in urpme ) _arguments -A '-*' \ $opts_help \ $opts_inst_rem \ "--auto[do not ask any question]" \ "-v[verbose]" \ ": :_urpme_package" ;; urpmi.addmedia ) _arguments -A '-*' \ $opts_help \ $opts_net \ $opts_verbose \ "($help)--arch[use specified architecture]:Mandrake architecture: " \ "($help :)--distrib[automatically create all media from an installation medium]:media URL:_urpmi_media_url" \ "($help)--from[use specified url for list of mirrors]:mirror URL:_url" \ "($help)--no-md5sum[disable MD5SUM file checking]" \ "($help --probe-hdlist --probe-synthesis)--no-probe[do not try to find any synthesis or hdlist file]" \ "($help --no-probe --probe-synthesis)--probe-hdlist[try to find and use hdlist file]" \ "($help --no-probe --probe-hdlist)--probe-synthesis[try to find and use synthesis file]" \ "($help)--update[mark as update media]" \ "($help)--version[use specified distribution version]:Mandrake version: " \ "($help)--virtual[create virtual media wich are always up-to-date]" \ "($help)-c[clean headers cache directory]" \ "($help)-f[force generation of hdlist files]" \ "($help --distrib):name of media: " \ "($help --distrib):media URL:_urpmi_media_url" \ "($help --distrib): :(with)" \ "($help --distrib):relative path to hdlist file" \ && ret=0 ;; urpmi.removemedia ) _arguments -A '-*' \ $opts_help \ $opts_verbose \ "($help : -)"{--help,-h}"[print usage information]" \ "($help :)-a[select all media]" \ "($help)-c[clean headers cache directory]" \ "($help)-y[fuzzy mathing on media names]" \ "(-a)"{,\*}": : _urpmi_media" \ && ret=0 ;; urpmi.update ) _arguments -A '-*' \ $opts_help \ $opts_net \ $opts_verbose \ "($help : -)"{--help,-h}"[print usage information]" \ "($help)--force-key[force update of gpg key]" \ "($help : -a)--update[update only update media]" \ "($help --update :)-a[select all non-removable media]" \ "($help)-c[clean /var/cache/urpmi/headers on exit]" \ "($help)*-f[force generation of hdlist files]" \ "($help -a)"{,\*}": : _urpmi_media" \ && ret=0 ;; urpmi ) _arguments -A '-*' \ $opts_help \ $opts_net \ $opts_verbose \ $opts_inst_rem \ $opts_search \ $opts_media \ "($help : -)"{--help,-h}"[print usage information]" \ "($help)--allow-force[allow asking user to install packages without dependencies checking and integrity]" \ "($help)--allow-nodeps[allow asking user to install packages without dependencies checking]" \ "($help)--auto-select[utomatically select packages to upgrade the system]" \ "($help --env)--bug[output a bug report in given directory]:directory for bug report:_files -/" \ "($help -X)--best-output[automatically select text or X interface]" \ "($help --noclean)--clean[remove rpm from cache before anything else]" \ "($help --clean)--noclean[keep rpm not used in cache]" \ "($help --bug)--env[use specific environment (typically result of --bug)]:directory for bug report:_files -/" \ "($help)--excludedocs[exclude docs files]: " \ "($help)--excludepath[exclude path separated by comma]:path: " \ "($help)--install-src[install only source package (no binaries)]" \ "($help)--keep[keep existing packages if possible]" \ "($help)--more-choices[propose more choices than the default]" \ "($help --no-resume)--resume[resume transfer of partially-downloaded files]" \ "($help --resume)--no-resume[do not resume transfer of partially-downloaded files]" \ "($help)--root[use another root for rpm installation]:root diretory:_files -/" \ "($help)--skip[packages which installation should be skipped]:packages: " \ "($help)--split-length[small transaction length]:transaction length: " \ "($help)--split-level[split in small transaction]:transaction size: " \ "($help --src -s)"{--src,-s}"[next package is source package]" \ "($help)--strict-arch[upgrade only packages with the same architecture]" \ "($help)--no-uninstall[never ask to uninstall a package, abort the installation]" \ "($help --verify-rpm)--no-verify-rpm[do not verify rpm signature before installation]" \ "($help --no-verify-rpm)--verify-rpm[verify rpm signature before installation]" \ "($help)-a[select all packages matching command line]" \ "($help -m -M)-m[choose minimum closure of requires (default)]" \ "($help -m -M)-M[choose maximum closure of requires]" \ "($help --best-output)-X[use X interface]" \ "($help)"{,\*}": :_urpmi_rpms" \ && ret=0 ;; urpmq ) _arguments -A '-*' \ $opts_help \ $opts_media \ $opts_search \ "($help)--auto-select[automatically select packages for upgrading the system]" \ "($help)--force[ignore non-existent packages]" \ "($help)--headers[extract headers for package listed from urpmi db to stdout]" \ "($help : -list --list-media --list-url --list-nodes --list-aliases)--list[list available packages]" \ "($help : -list --list-media --list-url --list-nodes --list-aliases)--list-media[list available media]" \ "($help : -list --list-media --list-url --list-nodes --list-aliases)--list-url[list available url]" \ "($help : -list --list-media --list-url --list-nodes --list-aliases)--list-nodes[list available nodes]" \ "($help : -list --list-media --list-url --list-nodes --list-aliases)--list-aliases[list available aliases]" \ "($help)--sources[show full path to package file]" \ "($help --src -s)"{--src,-s}"[next package is source package]" \ "($help)--summary[print RPM summary]" \ "($help)-c[complete output with package to be removed]" \ "($help)-d[extend query to package dependencies]" \ "($help)-f[print version, release and arch with name]" \ "($help)-g[print groups too with name]" \ "($help)-i[print useful information in human readable form]" \ "($help)-l[list files in package]" \ "($help)-r[print version and release too with name]" \ "($help)-R[reverse search to what requires package]" \ "($help)-u[remove package if a better version is already installed]" \ "($help -list --list-media --list-url --list-nodes --list-aliases)*:urpmi package name":_urpmi_rpms \ && ret=0 ;; urpmf ) # TODO this is not complete, some operators are missing _arguments -A '-*' \ $opts_help \ $opts_media \ "($help --name --group --size --epoch --summary --description --sourcerpm --packager --buildhost --url --provides --requires --files --conflicts --obsoletes)--all[print all tags]" \ "($help --all --name)--buildhost[print tag buildhost: build host]" \ "($help --all --name)--conflicts[print tag conflicts: all conflicts]" \ "($help --all --name)--description[print tag description: description]" \ "($help --all --name)--epoch[print tag epoch: epoch]" \ "($help --all --name)--files[print tag files: all files]" \ "($help --all --name)--group[print tag group: group]" \ "($help --all --group --size --epoch --summary --description --sourcerpm --packager --buildhost --url --provides --requires --files --conflicts --obsoletes)--name[print only package names]" \ "($help --all --name)--obsoletes[print tag obsoletes: all obsoletes]" \ "($help --verbose)--quiet[do not print tag name]" \ "($help --all --name)--packager[print tag packager: packager]" \ "($help --all --name)--provides[print tag provides: all provides]" \ "($help --all --name)--requires[print tag requires: all requires]" \ "($help --all --name)--size[print tag size: size]" \ "($help --all --name)--sourcerpm[print tag sourcerpm: source rpm]" \ "($help --all --name)--summary[print tag summary: summary]" \ "($help)--uniq[do not print identical lines]" \ "($help --all --name)--url[print tag url: url]" \ "($help --quiet)--verbose[verbose mode]" \ "($help)*-a[binary AND operator]" \ "($help)-i[ignore case distinctions in every pattern]" \ "($help)-f[print version, release and arch with name]" \ "($help)-e[include perl code directly as perl -e]:perl code: " \ "($help)*-o[binary OR operator]" \ && ret=0 ;; parsehdlist ) # TODO this is not complete, some operators are missing _arguments -A '-*' \ $opts_help \ "($help --interactive --quiet --name --group --size --epoch --summary --description --sourcerpm --packager --buildhost --url --provides --requires --files --conflicts --obsoletes)--all[print all tags]" \ "($help --all --interactive --name)--buildhost[print tag buildhost: build host]" \ "($help --all --interactive --name)--conflicts[print tag conflicts: all conflicts]" \ "($help --all --interactive --name)--description[print tag description: description]" \ "($help --all --interactive --name)--epoch[print tag epoch: epoch]" \ "($help --all --interactive --name)--files[print tag files: all files]" \ "($help --all --interactive --name)--group[print tag group: group]" \ "($help --all --interactive --group --size --epoch --summary --description --sourcerpm --packager --buildhost --url --provides --requires --files --conflicts --obsoletes)--name[print only package names]" \ "($help --all --interactive --name)--obsoletes[print tag obsoletes: all obsoletes]" \ "($help --interactive)--quiet[do not print tag name]" \ "($help --all --interactive --name)--packager[print tag packager: packager]" \ "($help --all --interactive --name)--provides[print tag provides: all provides]" \ "($help --all --interactive --name)--requires[print tag requires: all requires]" \ "($help --all --interactive --name)--size[print tag size: size]" \ "($help --all --interactive --name)--sourcerpm[print tag sourcerpm: source rpm]" \ "($help --all --interactive --name)--summary[print tag summary: summary]" \ "($help)--uniq[do not print identical lines]" \ "($help --all --interactive --name)--url[print tag url: url]" \ "*:hdlist files:_files -g '*.cz'" \ && ret=0 ;; esac return $ret } _urpmi "$@" PK[4H?  functions/VCS_INFO_get_data_svnnuW+A## vim:ft=zsh ## subversion support by: ## + Frank Terbeck ## + Phil Pennock ## Distributed under the same BSD-ish license as zsh itself. setopt localoptions noksharrays extendedglob NO_shwordsplit local svnbase svnbranch a b rrn local -A svninfo parentinfo local -xA hook_com svnbase="."; svninfo=() ${vcs_comm[cmd]} info --non-interactive | while IFS=: read a b; do svninfo[${a// /_}]="${b## #}"; done while [[ -d "${svnbase}/../.svn" ]]; do parentinfo=() ${vcs_comm[cmd]} info --non-interactive "${svnbase}/.." | while IFS=: read a b; do parentinfo[${a// /_}]="${b## #}"; done [[ ${parentinfo[Repository_UUID]} != ${svninfo[Repository_UUID]} ]] && break svninfo=(${(kv)parentinfo}) svnbase="${svnbase}/.." done svnbase="$(VCS_INFO_realpath ${svnbase})" rrn=${svnbase:t} zstyle -s ":vcs_info:${vcs}:${usercontext}:${rrn}" branchformat svnbranch || svnbranch="%b:%r" hook_com=( branch "${svninfo[URL]##*/}" revision "${svninfo[Revision]}" ) if VCS_INFO_hook 'set-branch-format' "${svnbranch}"; then zformat -f svnbranch "${svnbranch}" "b:${hook_com[branch]}" "r:${hook_com[revision]}" else svnbranch=${hook_com[branch-replace]} fi hook_com=() VCS_INFO_formats '' "${svnbranch}" "${svnbase}" '' '' "${svninfo[Revision]}" '' return 0 PK[K functions/_totdnuW+A#compdef totdconfig _arguments \ - set1 \ '-a[add totd specific options]' \ '-D[add totd specific config into dhclient-enter-hooks]' \ '-d:name server:_hosts' \ '-l[configure resolv.conf]' \ - set2 \ '-r:config to remove:(dhcp totd resolv all)' \ - set3 \ '-h[help]' PK[functions/_tagsnuW+A#autoload local prev # A `--' as the first argument says that we should tell comptags to use # the preceding function nesting level. This is only documented here because # if everything goes well, users won't have to worry about it and should # not mess with it. if [[ "$1" = -- ]]; then prev=- shift fi if (( $# )); then # We have arguments: the tags supported in this context. local curcontext="$curcontext" order tag nodef tmp if [[ "$1" = -C?* ]]; then curcontext="${curcontext%:*}:${1[3,-1]}" shift elif [[ "$1" = -C ]]; then curcontext="${curcontext%:*}:${2}" shift 2 fi [[ "$1" = -(|-) ]] && shift zstyle -a ":completion:${curcontext}:" group-order order && compgroups "$order[@]" # Set and remember offered tags. comptags "-i$prev" "$curcontext" "$@" # Sort the tags. if [[ -n "$_sort_tags" ]]; then "$_sort_tags" "$@" else zstyle -a ":completion:${curcontext}:" tag-order order || (( ! ${@[(I)options]} )) || order=('(|*-)argument-* (|*-)option[-+]* values' options) for tag in $order; do case $tag in -) nodef=yes;; \!*) comptry "${(@)argv:#(${(j:|:)~${=~tag[2,-1]}})}";; ?*) comptry -m "$tag";; esac done [[ -z "$nodef" ]] && comptry "$@" fi # Return non-zero if at least one set of tags should be used. comptags "-T$prev" return fi # The other mode: switch to the next set of tags. comptags "-N$prev" PK[[&v#v#functions/match-words-by-stylenuW+A# Match words by the style given below. The matching depends on the # cursor position. The matched_words array is set to the matched portions # separately. These look like: # # # # where the cursor position is always after the third item and `after' # is to be interpreted as `after or on'. Some # of the array elements will be empty; this depends on the style. # For example # foo bar rod stick # ^ # with the cursor where indicated will with typical settings produce the # elements `foo ', `bar', ` ', ` ', `rod', ` ' and `stick'. # # The style word-style can be set to indicate what a word is. # The three possibilities are: # # shell Words are shell words, i.e. elements of a command line. # whitespace Words are space delimited words; only space or tab characters # are considered to terminated a word. # normal (the default): the usual zle logic is applied, with all # alphanumeric characters plus any characters in $WORDCHARS # considered parts of a word. The style word-chars overrides # the parameter. (Any currently undefined value will be # treated as `normal', but this should not be relied upon.) # specified Similar to normal, except that only the words given # in the string (and not also alphanumeric characters) # are to be considered parts of words. # unspecified The negation of `specified': the characters given # are those that aren't to be considered parts of a word. # They should probably include white space. # # In the case of the `normal' or `(un)specified', more control on the # behaviour can be obtained by setting the style `word-chars' for the # current context. The value is used to override $WORDCHARS locally. # Hence, # zstyle ':zle:transpose-words*' word-style normal # zstyle ':zle:transpose-words*' word-chars '' # will force bash-style word recognition, i.e only alphanumeric characters # are considered parts of a word. It is up to the function which calls # match-words-by-style to set the context in the variable curcontext, # else a default context will be used (not recommended). # # You can override the use of word-chars with the style word-class. # This specifies the same information, but as a character class. # The surrounding square brackets shouldn't be given, but anything # which can appear inside is allowed. For example, # zstyle ':zle:*' word-class '-:[:alnum:]' # is valid. Note the usual care with `]' , `^' and `-' must be taken if # they need to appear as individual characters rather than for grouping. # # The final style is `skip-chars'. This is an integer; that many # characters counting the one under the cursor will be treated as # whitespace regardless and added to the front of the fourth element of # matched_words. The default is zero, i.e. the character under the cursor # will appear in if it is whitespace, else in # . This style is mostly useful for forcing # transposition to ignore the current character. # # The values of the styles can be overridden by options to the function: # -w # -s # -c # -C emulate -L zsh setopt extendedglob local wordstyle spacepat wordpat1 wordpat2 opt charskip wordchars wordclass local match mbegin mend pat1 pat2 word1 word2 ws1 ws2 ws3 skip local nwords MATCH MBEGIN MEND subwordrange local curcontext=${curcontext:-:zle:match-words-by-style} autoload -Uz match-word-context match-word-context while getopts "w:s:c:C:r:" opt; do case $opt in (w) wordstyle=$OPTARG ;; (s) skip=$OPTARG ;; (c) wordclass=$OPTARG ;; (C) wordchars=$OPTARG ;; (r) subwordrange=$OPTARG ;; (*) return 1 ;; esac done [[ -z $wordstyle ]] && zstyle -s $curcontext word-style wordstyle [[ -z $skip ]] && zstyle -s $curcontext skip-chars skip [[ -z $skip ]] && skip=0 case $wordstyle in (*shell*) local bufwords # This splits the line into words as the shell understands them. bufwords=(${(z)LBUFFER}) nwords=${#bufwords} wordpat1="${(q)bufwords[-1]}" # Take substring of RBUFFER to skip over $skip characters # from the cursor position. bufwords=(${(z)RBUFFER[1+$skip,-1]}) wordpat2="${(q)bufwords[1]}" spacepat='[[:space:]]#' # Assume the words are at the top level, i.e. if we are inside # 'something with spaces' then we need to ignore the embedded # spaces and consider the whole word. bufwords=(${(z)BUFFER}) if (( ${#bufwords[$nwords]} > ${#wordpat1} )); then # Yes, we're in the middle of a shell word. # Find out what's in front. eval pat1='${LBUFFER%%(#b)('${wordpat1}')('${spacepat}')}' # Now everything from ${#pat1}+1 is wordy wordpat1=${LBUFFER[${#pat1}+1,-1]} wordpat2=${RBUFFER[1,${#bufwords[$nwords]}-${#wordpat1}+1]} wordpat1=${(q)wordpat1} wordpat2=${(q)wordpat2} fi ;; (*space*) spacepat='[[:space:]]#' wordpat1='[^[:space:]]##' wordpat2=$wordpat1 ;; (*) local wc # See if there is a character class. wc=$wordclass if [[ -n $wc ]] || zstyle -s $curcontext word-class wc; then # Treat as a character class: do minimal quoting. wc=${wc//(#m)[\'\"\`\$\(\)\^]/\\$MATCH} else # See if there is a local version of $WORDCHARS. wc=$wordchars if [[ -z $wc ]]; then zstyle -s $curcontext word-chars wc || wc=$WORDCHARS fi if [[ $wc = (#b)(?*)-(*) ]]; then # We need to bring any `-' to the front to avoid confusing # character classes... we get away with `]' since in zsh # this isn't a pattern character if it's quoted. wc=-$match[1]$match[2] fi wc="${(q)wc}" fi # Quote $wc where necessary, because we don't want those # characters to be considered as pattern characters later on. if [[ $wordstyle = *specified* ]]; then if [[ $wordstyle != *unspecified* ]]; then # The given set of characters are the word characters, nothing else wordpat1="[${wc}]##" # anything else is a space. spacepat="[^${wc}]#" else # The other way round. wordpat1="[^${wc}]##" spacepat="[${wc}]#" fi else # Normal: similar, but add alphanumerics. wordpat1="[${wc}[:alnum:]]##" spacepat="[^${wc}[:alnum:]]#" fi wordpat2=$wordpat1 ;; esac # The eval makes any special characters in the parameters active. # In particular, we need the surrounding `[' s to be `real'. # This is why we quoted the wordpats in the `shell' option, where # they have to be treated as literal strings at this point. match=() eval pat1='${LBUFFER%%(#b)('${wordpat1}')('${spacepat}')}' word1=$match[1] ws1=$match[2] if [[ $wordstyle = *subword* ]]; then if [[ -z $subwordrange ]] && ! zstyle -s $curcontext subword-range subwordrange; then subwordrange='[:upper:]' fi # The rule here is that a word boundary may be an upper case letter # followed by a lower case letter, or an upper case letter at # the start of a group of upper case letters. To make # it easier to be consistent, we just use anything that # isn't an upper case characer instead of a lower case # character. # Here the initial "*" will match greedily, so we get the # last such match, as we want. integer epos if [[ $word1 = (#b)(*)([${~subwordrange}][^${~subwordrange}]*) ]]; then (( epos = ${#match[1]} )) fi if [[ $word1 = (#b)(*[^${~subwordrange}])([${~subwordrange}]*) ]]; then (( ${#match[1]} > epos )) && (( epos = ${#match[1]} )) fi if (( epos > 0 )); then pat1+=$word1[1,epos] word1=$word1[epos+1,-1] fi fi match=() charskip= repeat $skip charskip+=\? eval pat2='${RBUFFER##(#b)('${charskip}${spacepat}')('\ ${wordpat2}')('${spacepat}')}' ws2=$match[1] word2=$match[2] ws3=$match[3] if [[ $wordstyle = *subword* ]]; then # Do we have a group of upper case characters at the start # of word2 (that don't form the entire word)? # Again, rely on greedy matching of first pattern. if [[ $word2 = (#b)([${~subwordrange}][${~subwordrange}]##)(*) && -n $match[2] ]]; then # Yes, so the last one is new word boundary. (( epos = ${#match[1]} - 1 )) # Otherwise, do we have upper followed by non-upper not # at the start? Ignore the initial character, we already # know it's a word boundary so it can be an upper case character # if it wants. elif [[ $word2 = (#b)(?[^${~subwordrange}]##)[${~subwordrange}]* ]]; then (( epos = ${#match[1]} )) else (( epos = 0 )) fi if (( epos )); then # Careful: if we matched a subword there's no whitespace immediately # after the matched word, so ws3 should be empty and any existing # value tacked onto pat2. pat2="${word2[epos+1,-1]}$ws3$pat2" ws3= word2=$word2[1,epos] fi fi matched_words=("$pat1" "$word1" "$ws1" "$ws2" "$word2" "$ws3" "$pat2") PK[)functions/_lzopnuW+A#compdef lzop local expl state line decompress disp curcontext="$curcontext" sep ret=1 typeset -A opt_args _arguments -C -s \ '(-c --stdout --to-stdout)'{-c,--stdout,--to-stdout}'[write on standard output]' \ '(-d --decompress --uncompress -x -extract)'{-d,--decompress,--uncompress}'[decompress]' \ '(-x --extract -d --decompress --uncompress -n --name -p --path)'{-x,--extract}'[extract]' \ '(-f --force)'{-f,--force}'[force overwrite]' \ '(- *)'{-h,-H,--help}'[display help information]' \ '(-l --list)'{-l,--list}'[list compressed file contents]' \ '(-L --license)'{-L,--license}'[display software license]' \ '(-n --no-name -N --name)'{-n,--no-name}'[do not save or restore the original name and time stamp]' \ '(-N --name -n --no-name)'{-N,--name}'[save or restore the original name and time stamp]' \ '--no-mode[do not restore original mode]' \ '--no-time[do not restore original time stamp]' \ '(-q --quiet --silent)'{-q,--quiet,--silent}'[suppress all warnings]' \ '(-r --recursive)'{-r,--recursive}'[operate recursively on directories]' \ '(-S --suffix)'{-S+,--suffix=}'[specify suffix for compressed files]:suffix' \ '(-t --test)'{-t,--test}'[test compressed file integrity]' \ \*{-v,--verbose}'[verbose mode]' \ '(- *)'{-V,--version}'[display version number]' \ '( -1 -2 -3 -4 -5 -6 -7 -8 -9 --best)--fast' \ '(--fast -2 -3 -4 -5 -6 -7 -8 -9 --best)-1' \ '(--fast -1 -3 -4 -5 -6 -7 -8 -9 --best)-2' \ '(--fast -1 -2 -4 -5 -6 -7 -8 -9 --best)-3' \ '(--fast -1 -2 -3 -5 -6 -7 -8 -9 --best)-4' \ '(--fast -1 -2 -3 -4 -6 -7 -8 -9 --best)-5' \ '(--fast -1 -2 -3 -4 -5 -7 -8 -9 --best)-6' \ '(--fast -1 -2 -3 -4 -5 -6 -8 -9 --best)-7' \ '(--fast -1 -2 -3 -4 -5 -6 -7 -9 --best)-8' \ '(--fast -1 -2 -3 -4 -5 -6 -7 -8 --best)-9' \ '(--fast -1 -2 -3 -4 -5 -6 -7 -8 -9 )--best' \ '--ls=[list each compressed file in a format similar to ls -ln]:ls flag:->flags' \ '--info[list internal header fields for each compressed file]' \ '(-I --sysinfo)'{-I,--sysinfo}'[display information about the system]' \ '(-o --outfile)'{-o,--outfile=}'[specify output file]:output file:_files' \ '(-p --path)'{-p,--path=}'[write output files to specified directory]:directory:_files -/' \ '(-F --no-checksum)'{-F,--no-checksum}'[do not store or verify a checksum]' \ '(-k --keep -U --unlink --delete)'{-k,--keep}"[keep (don't delete) input files]" \ '(-U --unlink --delete)'{-U,--unlink,--delete}'[delete input files]' \ '--no-stdin[do not try to read stdin]' \ '--no-warn[suppress all warnings]' \ '--ignore-warn[suppress all warnings and never exit with status 2]' \ '--no-color[do not use an color escape sequences]' \ '--mono[assume a mono ANSI terminal]' \ '--color[assume a color ANSI terminal]' \ '--intro[display intro sequence]' \ '--filter=[preprocess data with a special multimedia filter]:number' \ '*:files:->files' && ret=0 case "$state" in files) if (( $+opt_args[-d] || $+opt_args[--decompress] || $+opt_args[--uncompress] || $+opt_args[-x] || $+opt_args[--extract] || $+opt_args[--test] || $+opt_args[-t] || $+opt_args[--list] || $+opt_args[-l] || $+opt_args[--ls] || $+opt_args[--info] )); then _description files expl 'compressed file' _files "$expl[@]" -g '*.[tl]zo(-.)' && ret=0 else _description files expl 'file to compress' _files "$expl[@]" -g '^*.[tl]zo(-.)' && ret=0 fi ;; flags) zstyle -s ":completion:${curcontext}:flags" list-separator sep || sep=-- disp=( "F $sep Append a \`*' for executable files" "G $sep Inhibit display of group information" "Q $sep Enclose file names in double quotes" ) disp=( ${disp[@]:#[Z$PREFIX]*} ) compset -P '[FGQ]*' compadd -d disp - ${disp[@]%% *} && ret=0 ;; esac return ret PK[#5functions/_pkgaddnuW+A#compdef pkgadd _pkgadd_pass() { _values -S : 'password descriptor' \ '(file env console)pass[literal password]:password:' \ '(pass file console)env[environment variable]:environment:_parameters -g "*export*"' \ '(pass env console)file[file]:file:_files' \ '(pass env file)console[from /dev/tty]' } _pkgadd() { _arguments -s \ '-d[device]:device file:_files' \ '-x[HTTP(S) proxy]:HTTP proxy: ' \ '-k[keystore]:keystore:_files' \ '-P[password to decrypt keystore]:password:_pkgadd_pass' \ '-Y[select packages by category]:category: ' \ - set1 \ '-n[non-interactive mode]' \ '-v[trace all scripts]' \ '-a[admin file]:admin file:_files' \ "-M[don't use vfstab file]" \ '-R[root path]:root path:_files -/' \ '-r[response file]:response file:_files' \ '-V[alternate vfstab file]:vfstab file:_files' \ '*:package instance:_pkg_instance --_opts uninstalled:-d' \ - set2 \ '-s[spool package]:spool directory:_files -/' \ '*:package instance:_pkg_instance --_opts uninstalled:-d' } _pkgadd "$@" PK[OА functions/_debfosternuW+A#compdef debfoster local curcontext="$curcontext" state line expl ret=1 _arguments -C \ '(-v --verbose)'{-v,--verbose}'[be a loudmouth]' \ '(-V --version)'{-V,--versuib}'[show version and copyright information]' \ '(-h --help)'{-h,--help}'[show help information]' \ '(-q --quiet)'{-q,--quiet}'[silently build keeper file]' \ '(-f --force)'{-f,--force}'[force system to conform to keeper file]' \ '(-m --mark-only)'{-m,--mark-only}'[do not install or delete packages]' \ '(-u --upgrade)'{-u,--upgrade}'[try to upgrade dependencies]' \ '(-c --config)'{-c,--config}'[specify configuration file]:file:_files' \ '(-k --keeperfile)'{-k,--keeperfile}'[specify keeper file]:file:_files' \ '(-n --no-keeperfile)'{-n,--no-keeperfile}'[do not read keeper file]' \ '(-i --ignore-default-rules)'{-i,--ignore-default-rules}'[ignore default rules]' \ '(-a --show-keepers)'{-a,--show-keepers}'[show packages on keeper list]' \ '(-s --show-orphans)'{-s,--show-orphans}'[show orphaned packages]' \ '(-d --show-depends)'{-d,--show-depends}'[show all depends of specified package]:package:_deb_packages avail' \ '(-e --show-dependents)'{-e,--show-dependents}'[show dependents of specified package]:package:_deb_packages avail' \ '(-p --show-providers)'{-p,--show-providers}'[show packages providing specified package]:package:_deb_packages avail' \ '(-r --show-related)'{-r,--show-related}'[show packages brought in by specified package]:package:_deb_packages avail' \ '(-t --use-tasks)'{-t,--use-tasks}'[make tasks visible as packages]' \ '*-'{-option,o}'[override any configuration option]:option string:->option' \ '*:package markings: _alternative "installed:installed packages:_deb_packages -S- installed" "uninstalled:uninstalled packages:_deb_packages uninstalled"' \ && ret=0 if [[ -n "$state" ]]; then if compset -P '*='; then case "$IPREFIX" in *(#i)(install|remove|info)cmd*) _wanted values expl 'command string' _command && ret=0 ;; *(#i)(keeperfile|dpkg(status|available))*) _wanted values expl 'metadata file' _files && ret=0 ;; *(#i)maxpriority*) _wanted values expl 'package priority' \ compadd required important standard optional extra ANY && ret=0 ;; *(#i)(use(hold|essential|predepends|recommends|suggests|tasks)|negativekeepers|verbose|force|quiet)*) _wanted values expl 'truth value' \ compadd yes no && ret=0 ;; *(#i)(no|)keepsections*) _wanted values expl 'section' compadd \ x11 web utils text tex sound shells science \ otherosfs oldlibs news net misc math mail libs \ interpreters hamradio graphics games electronics \ editors doc devel comm base admin && ret=0 ;; *(#i)guessdepends*) _wanted values expl 'name extension' \ compadd doc dev && ret=0 ;; esac else _wanted values expl 'configure file option' \ compadd -M 'm:{a-z}={A-Z}' -S '=' - \ InstallCmd RemoveCmd InfoCmd KeeperFile DpkgStatus \ DpkgAvailable MaxPriority UseHold UseEssential \ UsePreDepends UseRecommends UseSuggests UseTasks \ KeepSections NokeepSections GuessDepends NegativeKeepers \ Verbose Force Quiet && ret=0 fi fi return ret PK[ufunctions/_setupnuW+A#autoload local val nm="$compstate[nmatches]" [[ $# -eq 1 ]] && 2="$1" if zstyle -a ":completion:${curcontext}:$1" list-colors val; then zmodload -i zsh/complist if [[ "$1" = default ]]; then _comp_colors=( "$val[@]" ) else _comp_colors=( "$_comp_colors[@]" "(${2})${(@)^val:#(|\(*\)*)}" "${(M@)val:#\(*\)*}" ) fi # Here is the problem mentioned in _main_complete. # elif [[ "$1" = default && -n "$ZLS_COLORS$ZLS_COLOURS" ]]; then # zmodload -i zsh/complist # ZLS_COLORS="$ZLS_COLORS$ZLS_COLOURS" elif [[ "$1" = default ]]; then unset ZLS_COLORS ZLS_COLOURS fi if zstyle -t ":completion:${curcontext}:$1" list-packed; then compstate[list]="${compstate[list]} packed" elif [[ $? -eq 1 ]]; then compstate[list]="${compstate[list]:gs/packed//}" else compstate[list]="$_saved_list" fi if zstyle -t ":completion:${curcontext}:$1" list-rows-first; then compstate[list]="${compstate[list]} rows" elif [[ $? -eq 1 ]]; then compstate[list]="${compstate[list]:gs/rows//}" else compstate[list]="$_saved_list" fi if zstyle -t ":completion:${curcontext}:$1" last-prompt; then compstate[last_prompt]=yes elif [[ $? -eq 1 ]]; then compstate[last_prompt]='' else compstate[last_prompt]="$_saved_lastprompt" fi if zstyle -t ":completion:${curcontext}:$1" accept-exact; then compstate[exact]=accept elif [[ $? -eq 1 ]]; then compstate[exact]='' else compstate[exact]="$_saved_exact" fi [[ _last_nmatches -ge 0 && _last_nmatches -ne nm ]] && _menu_style=( "$_last_menu_style[@]" "$_menu_style[@]" ) if zstyle -a ":completion:${curcontext}:$1" menu val; then _last_nmatches=$nm _last_menu_style=( "$val[@]" ) else _last_nmatches=-1 fi [[ "$_comp_force_list" != always ]] && zstyle -s ":completion:${curcontext}:$1" force-list val && [[ "$val" = always || ( "$val" = [0-9]## && ( -z "$_comp_force_list" || _comp_force_list -gt val ) ) ]] && _comp_force_list="$val" PK[3%OOfunctions/_bugnuW+A#compdef bug reportbug querybts local _bug_commonargs _rb_commonargs _bug_commonargs=( '-d[debug: send mail to postmaster@localhost]' '-m[maintainer-only]' '-p[print to stdout instead of mail]' '-h[help]' '*:package:_deb_packages installed' ) _rb_commonargs=( '(-B --bts)'{-B,--bts=}'[use alternate BTS]:system:(debian gnome kde tdyc kde-debian)' '(-l --ldap)'{-l,--ldap}'[enable LDAP support]' '(-l --ldap)--no-ldap[disable LDAP support]' '(--proxy --http_proxy)'--{http_,}'proxy=:proxy host:_hosts' ) case "$service" in bug) _arguments \ '-c[exclude configs from report]' \ '-f[argument is a file, not a package]' \ '-H[special header]:custom header:' \ '-q[quiet - no e-mail forwarding]' \ '-s[set subject]:subject:' \ '-S[set severity]:severity:(wishlist normal important serious grave critical)' \ '-v[version]' \ '-x[do not cc submitter]' \ '-z[send configs verbatim]' \ "$_bug_commonargs[@]" ;; reportbug) _arguments \ '(-c --no-config-files)'{-c,--no-config-files}'[exclude configs from report]' \ '(-f --filename)'{-f,--filename=}'[argument is a file, not a package]:filename:_files' \ '(-H --header)'{-H,--header=}'[special header]:custom header' \ '(-s --subject)'{-s,--subject=}'[set subject]:subject' \ '(-S --severity)'{-S,--severity=}'[set severity]:severity:(wishlist normal important serious grave critical)' \ '(-x --no-cc)'{-x,--no-cc}'[do not cc submitter]' \ '(-z --no-compress)'{-z,--no-compress}'[send configs verbatim]' \ '(-a --af)'{-a,--af}'[use af instead of editor]' \ '(-g --gpg --gnupg)'{-g,--gpg,--gnupg}'[sign report with GnuPG]' \ '(-i --include)'{-i,--include}'[include text]:include file:_files' \ '(-A --attach)'{-A,--attach=}'[attach file]:attachment:_files' \ '(-M --mutt)'{-M,--mutt}'[use mutt instead of editor]' \ '(-G --gnus)'{-G,--gnus}'[use GNUS instead of editor]' \ '(-e --editor)'{-e,--editor=}'[use specified editor instead of editor]:editor' \ '--mua=[use specified mua instead of editor]' \ '--mta=[use specified mta]' \ '(-n --nmh --mh)'{-n,--nmh,--mh}'[use comp instead of editor]' \ '(-o --output)'{-o,--output=}'[output to file instead of mail]:output file:_files' \ '(-P --pgp)'{-P,--pgp}'[sign report with PGP]' \ '(-C --class)'{-C,--class=}':GNATS report class' \ '--realname=:real name' \ '(--replyto)--reply-to=' \ '(--reply-to)--replyto=' \ '--email=:originating address:_email_addresses' \ '--smtphost=:SMTP server:_hosts' \ '(-p --print)'{-p,--print}'[print to stdout instead of mail]' \ '(-q --quiet)'{-q,--quiet}'[reduce verbosity of output]' \ '(--no-query-source)--query-source' \ '(--query-source)--no-query-source' \ '(--no-debconf)--debconf' \ '(--debconf)--no-debconf' \ '(-Q --query-only)'{-Q,--query-only}'[do not submit]' \ '(-j --justification)'{-j,--justification=}':justification' \ '(-V --package-version)'{-V,--package-version=}':package version' \ '(-u --interface)'{-u,--interface=}':user interface' \ '(-t --type)'{-t,--type=}':type of report' \ '--template[output a template report only]' \ '--configure[reconfigure reportbug for this user]' \ '(--no-check-available)--check-available' \ '(--check-available)--no-check-available' \ '--mode=' \ '(-v --verify --no-verify)'{-v,--verify}'[verify integrity with debsums]' \ '(--verify -v)--no-verify' \ '(-k --kudos)'{-k,--kudos}'[send appreciative email to maintainer]' \ '--mirror=:BTS mirror:_hosts' \ '--list-cc=:carbon copy:' \ '--report-quiet' \ '(-O --offline)'{-O,--offline}'[disable external queries]' \ '(-b --no-query-bts --query-bts)'{-b,--no-query-bts}'[do not query BTS]' \ '(-b --no-query-bts)--query-bts' \ '(-T --tags)'{-T,--tags=}'[add specified tags]:tags' \ '(-m)--maintonly' \ '(-d)--debug' \ '--version' \ '--license' \ '(--no-paranoid)--paranoid' \ '(--paranoid)--no-paranoid' \ '--body=:message body string' \ '--body-file=:message body file:_files' \ "$_bug_commonargs[@]" \ "$_rb_commonargs[@]" ;; querybts) _arguments \ '(-w --web)'{-w,--web}'[launch external web browser]' \ '(-A --archive)'{-A,--archive}'[browse archived bugs]' \ '(-s --source)'{-s,--source}'[query for source packages rather than binary]' \ '(-v --version)'{-v,--version}'[show version]' \ "$_rb_commonargs[@]" \ '*:package:_deb_packages avail' ;; esac PK[+""functions/_dpkgnuW+A#compdef dpkg dpkg-deb dpkg-query dpkg-reconfigure local _dpkg_deb_actions _dpkg_common_actions _dpkg_actions _dpkg_options local _dpkg_options_recursive #_dpkg_actions_install _dpkg_actions_record_avail local _dpkg_deb_only_actions local _dpkg_deb_and_query_only_actions _dpkg_deb_and_query_only_options local _dpkg_query_actions local curcontext="$curcontext" context state line expl ret typeset -A opt_args _dpkg_deb_only_actions=( '-D[debugging output]' '(--new)--old[old archive format]' '(--old)--new[new archive format]' '--nocheck[suppress control file check]' '-z+[compression level]:compression number:(1 2 3 4 5 6 7 8 9)' ) _dpkg_deb_actions=( '(--build -b)'{--build,-b}'[build archive]:directory:_files -/' '(--contents -c)'{--contents,-c}'[list contents]:Debian package:_files -g "*.u#deb(-.)"' '(--info -I)'{--info,-I}'[show info]:Debian package:_files -g "*.u#deb(-.)"' '(--field -f)'{--field,-f}'[show fields]:Debian package:_files -g "*.u#deb(-.)"' '(--control -e)'{--control,-e}'[extract control]:Debian package:_files -g "*.u#deb(-.)"' '(--extract -x)'{--extract,-x}'[extract files]:Debian package:_files -g "*.u#deb(-.)"' '(--vextract -X)'{--vextract,-X}'[extract and list files]:Debian package:_files -g "*.u#deb(-.)"' '--fsys-tarfile[output fs tarfile]:Debian package:_files -g "*.u#deb(-.)"' ) _dpkg_common_actions=( '--help[show help]' '--version[show version]' '(--license --licence)'{--license,--licence}'[show licencing]' ) _dpkg_actions=( '(--install -i)'{--install,-i}'[install packages]:*:Debian packages:->install' '--unpack[unpack package]:Debian package:_files -g "*.deb(-.)"' '--configure[reconfigure specified packages]:*:package:->configure' '(--remove -r)'{--remove,-r}'[remove package]:*:package:->remove' '(--purge -P)'{--purge,-P}'[purge package]:*:package:->purge' '--update-avail[update available]:package file:_files' '--merge-avail[merge available]:package file:_files' '(--record-avail -A)'{--record-avail,-A}'[record available]:*:package files:->record_avail' '--forget-old-unavail[forget uninstalled unavailable]' '--clear-avail[clear available]' '(--audit -C)'{--audit,-C}'[check for broken pkgs]' '--get-selections[get selections]:pattern:' '--set-selections[set selections]' '--yet-to-unpack[list uninstalled]' '--print-architecture[print target architecture]' '--print-installation-architecture' '--compare-versions[compare version numbers]:*::expression:= ->compare_versions' ) _dpkg_options=( '--abort-after[abort after errors]:number of errors:' '--root=[alternative root]:root:_files -/' '--instdir=[change inst root but not data dir]:_files -/' '(--selected-only -O)'{--selected-only,-O}'[skip unselected packages]' '(--skip-same-version -E)'{--skip-same-version,-E}'[skip packages with same version as installed]' '(--refuse-downgrade -G)'{--refuse-downgrade,-G}'[skip packages with earlier version than installed]' '(--auto-deconfigure -B)'{--auto-deconfigure,-B}'[install can break other packages]' '--largemem[optimize for >4Mb RAM]' '--smallmem[optimize for <4Mb RAM]' '--no-act[show potential actions but do not follow through]' '-D+[debug options]:debug options:(h 1 2 3)' '--debug=[debug options]:debug options:(help 1 2 3)' '--ignore-depends=[ignore depends involving package]:package:_deb_packages avail' --{force,refuse,no-force}'--[forcing options]:what:(all downgrade configure-any hold bad-path not-root overwrite overwrite-diverted bad-verify depends-version depends confnew confold confdef confmiss conflicts architecture overwrite-dir remove-reinstreq remove-essential help)' ) _dpkg_options_recursive=( '(--recursive -R)'{--recursive,-R}'[recursive]' ) _dpkg_deb_and_query_only_actions=( '(--show -W)'{--show,-W}'[show package info]:Debian package:_files -g \*.u\#deb' ) _dpkg_deb_and_query_only_options=( '--showformat=-[alternative format]:format: ' ) _dpkg_query_actions=( '(--status -s)'{--status,-s}'[display package status]:*:packages:->status' '(--print-avail -p)'{--print-avail,-p}'[display available details]:packages:_deb_packages avail' '(--listfiles, -L)'{--listfiles,-L}'[list owned files]:*:packages:->listfiles' '(--list -l)'{--list,-l}'[list packages]:*:packages:->list' '(--search -S)'{--search,-S}'[search for file owner]:*:pattern:->search' '--admindir=[data directory]:directory:_files -/' ) # not needed anymore? # _dpkg_actions_install=('(--install)-i[install]' '(-i)--install') # _dpkg_actions_record_avail=('(--record-avail)-A[record available]' '(-A)--record-avail') case "$service" in dpkg) _arguments -C -s \ "$_dpkg_actions[@]" \ "$_dpkg_deb_actions[@]" \ "$_dpkg_common_actions[@]" \ "$_dpkg_options[@]" \ "$_dpkg_options_recursive[@]" \ "$_dpkg_query_actions[@]" && return 0 ;; dpkg-deb) _arguments "$_dpkg_deb_actions[@]" \ "$_dpkg_deb_only_actions[@]" \ "$_dpkg_common_actions[@]" \ "$_dpkg_deb_and_query_only_actions[@]" \ "$_dpkg_deb_and_query_only_options[@]" && return 0 ;; dpkg-query) _arguments "$_dpkg_query_actions[@]" \ "$_dpkg_common_actions[@]" \ "$_dpkg_deb_and_query_only_actions[@]" \ "$_dpkg_deb_and_query_only_options[@]" && return 0 ;; dpkg-reconfigure) _arguments -s -w \ '(-f --frontend)'{-f,--frontend}'[select frontend to use]:frontend:(dialog readline noninteractive gnome kde editor web)' \ '(-p --priority)'{-p,--priority}'[specify min priority of questions]:priority:(low medium high critical)' \ '--default-priority[use default question priority]' \ '(*)--all[reconfigure all installed packages using debconf]' \ '(-u --unseen-only)'{-u,--unseen-only}'[only ask questions not yet seen are asked]' \ '--force[reconfigure even packages in broken state]' \ '(-)'{-h,--help}'[display help information]' \ '*:package:_deb_packages installed' && return 0 ;; esac case "$state" in install|record_avail) _call_function ret _dpkg_$state && return ret # not needed anymore? # "${(@e):-\$_dpkg_actions_${state}}" \ _arguments -C -A '-*' -s \ "$_dpkg_options[@]" \ \!${^_dpkg_actions%%:*} \ - recur \ "$_dpkg_options_recursive[@]" \ '*:directory:_path_files -/' \ - nonrecur \ '*:Debian package:_path_files -g "*.deb(-.)"' ;; remove|status|listfiles) _call_function ret _dpkg_$state && return ret _arguments -C -A "-*" -s "$_dpkg_options[@]" \ '*:package:_deb_packages installed' ;; purge) _call_function ret _dpkg_$state && return ret _arguments -C -A "-*" -s "$_dpkg_options[@]" \ '*:package:_deb_packages xinstalled' ;; list) _call_function ret _dpkg_$state && return ret _arguments -C -A "-*" -s "$_dpkg_options[@]" \ '*:packages:_deb_packages avail' ;; compare_versions) _call_function ret _dpkg_$state && return ret _arguments -C -A "-*" -s \ '1:version A:' \ '2:operator:(lt le eq ne ge gt lt-nl le-nl ge-nl gt-nl)' \ '3:version B:' ;; configure) _call_function ret _dpkg_$state && return ret _arguments -C -A "-*" -s '--configure' \ "$_dpkg_options[@]" \ '(* -a --pending)'{-a,--pending}'[pending packages]' \ '*:package:_deb_packages installed' ;; search) _call_function ret _dpkg_$state && return ret _files ;; esac PK[=ffunctions/_user_adminnuW+A#compdef useradd usermod groupadd groupmod local args shells home=${${words[(r)-D]:+b}:-d} sun redhat [[ -e /etc/redhat-release || -e /etc/mandrake-release ]] redhat=$? if [[ $service = user* ]]; then if [[ -r /etc/shells ]]; then shells=( ${${(f)"$(&1)"}[1]}}[2]} if [[ -r $acropath ]]; then _acroread_version=${${(M)${(f)"$(<$acropath)"}:#ver=*}##ver=} fi fi fi if [[ $_acroread_version == [789].* ]]; then local -a extra_args extra_args=() if [[ $_acroread_version == [89].* ]]; then extra_args+=(-man '-installCertificate:server ip::server port') fi if [[ $_acroread_version == 9.* ]]; then extra_args+=(-openInNewInstance) fi _arguments -C \ "${extra_args[@]}" \ '--display=:X display:_x_display' \ '--screen=:X screen (overrides the screen part of DISPLAY)' \ --sync \ '-geometry:[x][{+|-}{+|-}]' \ -help \ -iconic \ '*-setenv:=' \ -tempFile \ '-tempFileTitle:title' \ -openInNewWindow \ -version \ '-visual:X visual:_x_visual' \ '-toPostScript:*::PostScript conversion options:= ->tops' \ '*:PDF file:_files -g "*.(#i)pdf(-.)"' && return [[ -n "$state" ]] && _arguments \ '-pairs:*:pdf_file_1 ps_file_1 ...:_files -g "*.(#i)(pdf|ps)(-.)"' \ -binary \ '-start:integer' \ '-end:integer' \ -optimizeForSpeed \ -landscape \ -reverse \ '(-even)-odd' \ '(-odd)-even' \ -commentsOff \ -annotsOff \ -stampsOff \ -markupsOn \ '(-level3)-level2' \ '(-level2)-level3' \ -printerhalftones \ -saveVM \ '-scale:integer' \ -shrink \ -expand \ '-size:page size (or custom size wxh in points):(letter tabloid ledger legal executive a3 a4 a5 b4 b5)' \ '-transQuality:transparency flattening level:(1 2 3 4 5)' \ '*:PDF file:_files -g "*.(#i)pdf(-.)"' && return else _x_arguments -C \ -help \ -helpall \ \*-iconic \ \*+iconic \ '-name:application name:_x_name' \ '*-setenv:=' \ -tempFile \ '-tempFileTitle:title' \ '(+useFrontEndProgram)-useFrontEndProgram' \ '(-useFrontEndProgram)+useFrontEndProgram' \ '-visual:X visual:_x_visual' \ '-xrm:X resource specification:_x_resource' \ '-toPostScript:*::PostScript conversion options:= ->tops' \ '*:PDF file:_files -g "*.(#i)pdf(-.)"' && return [[ -n "$state" ]] && _arguments \ '-pairs:*:pdf_file_1 ps_file_1 ...:_files -g "*.(#i)(pdf|ps)(-.)"' \ -binary \ '-start:integer' \ '-end:integer' \ -optimizeForSpeed \ -landscape \ -reverse \ '(-even)-odd' \ '(-odd)-even' \ -commentsOff \ '(-level2 -level3)-level1' \ '(-level1 -level3)-level2' \ '(-level1 -level2)-level3' \ -printerhalftones \ -saveVM \ '-scale:integer' \ -shrink \ '-size:page size (or custom size wxh in points):(letter tabloid ledger legal executive a3 a4 a5 b4 b5)' \ '-transQuality:transparency flattening level:(1 2 3 4 5)' \ '*:PDF file:_files -g "*.(#i)pdf(-.)"' && return fi return 1 PK[Xfunctions/_xmodmapnuW+A#compdef xmodmap local curcontext="$curcontext" state line ret=1 typeset -A opt_args _x_arguments -C \ -{help,grammar,verbose,quiet} \ '-n[only show what would be done]' \ '*-e[specify expression]:expression:->expr' \ '-pm[print modifier map]' \ '-pk[print keymap table]' \ '-pke[print keymap table as expressions]' \ '-pp[print pointer map]' \ ':X mapping file:_files' && ret=0 if [[ -n "$state" ]]; then local expl expr="${PREFIX##[ ]#}" what suf if compset -P '[^ ]##[ ]##'; then case "$expr" in keycode*) if compset -P '*=[ ]#'; then compset -P '*[ ]' what=ksyms elif [[ "$expr" = *[\ \ ]##[^\ \ ]##[\ \ ] ]]; then IPREFIX="${IPREFIX}${PREFIX}" PREFIX='' compadd -S ' ' '=' && ret=0 else _message -e keys 'key code or `any'"'" fi ;; keysym*) if compset -P '*=[ ]#'; then compset -P '*[ ]' what=ksyms elif [[ "$expr" = *[\ \ ]##[^\ \ ]##[\ \ ] ]]; then IPREFIX="${IPREFIX}${PREFIX}" PREFIX='' compadd -S ' ' '=' && ret=0 else what=ksym-eq fi ;; clear*) what=mods ;; (add|remove)*) if compset -P '*[ ]##'; then what=ksyms else what=mods-eq fi ;; pointer*) if compset -P '*=[ ]#'; then compset -P '*[ ]' _description values expl 'button code' compadd "$expl[@]" -qS ' ' 1 2 3 4 5 default return else IPREFIX="${IPREFIX}${PREFIX}" PREFIX='' compadd -S ' ' '=' && ret=0 fi ;; esac if [[ "$what" = *eq* ]]; then suf=(-S ' = ') elif [[ "$what" = *ksyms* ]]; then if [[ -n "$compstate[quote]" ]]; then suf=(-S "$compstate[quote] " -r "$compstate[quote] ") else suf=(-qS ' ') fi else suf=() fi [[ "$what" = *mods* ]] && _x_modifier "$suf[@]" && ret=0 [[ "$what" = *ksym* ]] && _x_keysym "$suf[@]" && ret=0 else _tags commands while _tags; do while _next_label commands expl command; do compadd "$expl[@]" -S ' ' keycode keysym clear add remove && ret=0 compadd "$expl[@]" -S ' = ' pointer && ret=0 done (( ret )) || return 0 done fi fi return ret PK[Bҽfunctions/tcp_aliasnuW+A# Create an alias for a TCP session. # # The syntax is similar to the `alias' builtin. Aliases with a trailing # `=' are assigned, while those without are listed. # # The alias can be used to refer to the session, however any output # from the session will be shown using information for the base # session name. Likewise, any other reference to the session's file # descriptor will cause the original session name rather than the alias to # be used. # # It is an error to attempt to create an alias for a non-existent session. # The alias will be removed when the session is closed. # # An alias can be reused without the session having to be closed. # However, a base session name cannot be used as an alias. If this # becomes necessary, the base session should be renamed with tcp_rename # first. # # With no arguments, list aliases. # # With the option -d, delete the alias. No value is allowed in this case. # # With the option -q (quiet), just return status 1 on failure. This # does not apply to bad syntax, which is always reported. Bad syntax # includes deleting aliases when supplying a value. emulate -L zsh setopt extendedglob cbases local opt quiet base value alias delete arg match mbegin mend fd array integer stat index while getopts "qd" opt; do case $opt in (q) quiet=1 ;; (d) delete=1 ;; (*) return 1 ;; esac done (( OPTIND > 1 )) && shift $(( OPTIND - 1 )) if (( ! $# )); then if (( ${#tcp_aliases} )); then for fd value in ${(kv)tcp_aliases}; do for alias in ${=value}; do print -r - \ "${alias}: alias for session ${tcp_by_fd[$fd]:-unnamed fd $fd}" done done fi return 0 fi for arg in $*; do if [[ $arg = (#b)([^=]##)=(*) ]]; then if [[ -n $delete ]]; then print "$0: value given with deletion command." >&2 stat=1 continue fi alias=$match[1] base=$match[2] if [[ -z $base ]]; then # hmm, this is very nearly a syntax error... [[ -z $quiet ]] && print "$0: empty value for alias $alias" >&2 stat=1 continue fi if [[ ${+tcp_by_name} -eq 0 || -z ${tcp_by_name[$base]} ]]; then [[ -z $quiet ]] && print "$0: no base session \`$base' for alias" stat=1 continue fi if [[ -n ${tcp_by_name[$alias]} ]]; then # already exists, OK if this is an alias... fd=${tcp_by_name[$alias]} array=(${=tcp_aliases[$fd]}) if [[ -n ${array[(r)$alias]} ]]; then # yes, we're OK; delete the old alias. unset "tcp_by_name[$alias]" index=${array[(i)$alias]} array=(${array[1,index-1]} ${array[index+1,-1]}) if [[ -z "$array" ]]; then unset "tcp_aliases[$fd]" else tcp_aliases[$fd]="$array" fi else # oops if [[ -z $quiet ]]; then print "$0: \`$alias' is already a session name." >&2 fi stat=1 continue fi fi (( ! ${+tcp_aliases} )) && typeset -gA tcp_aliases fd=${tcp_by_name[$base]} if [[ -n ${tcp_aliases[$fd]} ]]; then tcp_aliases[$fd]+=" $alias" else tcp_aliases[$fd]=$alias fi tcp_by_name[$alias]=$fd if zmodload -i zsh/parameter; then if (( ${+functions[tcp_on_alias]} )); then tcp_on_alias $alias $fd fi fi else alias=$arg fd=${tcp_by_name[$alias]} if [[ -z $fd ]]; then print "$0: no such alias \`$alias'" >&2 stat=1 continue fi # OK if this is an alias... array=(${=tcp_aliases[$fd]}) if [[ -n ${array[(r)$alias]} ]]; then # yes, we're OK if [[ -n $delete ]]; then unset "tcp_by_name[$alias]" index=${array[(i)$alias]} array=(${array[1,index-1]} ${array[index+1,-1]}) if [[ -z "$array" ]]; then unset "tcp_aliases[$fd]" else tcp_aliases[$fd]="$array" fi if zmodload -i zsh/parameter; then if (( ${+functions[tcp_on_unalias]} )); then tcp_on_unalias $alias $fd fi fi else print -r - \ "${alias}: alias for session ${tcp_by_fd[$fd]:-unnamed fd $fd}" fi else # oops if [[ -z $quiet ]]; then print "$0: \`$alias' is a session name." >&2 fi stat=1 continue fi fi done return $stat PK[||functions/_vim-addonsnuW+A#compdef vim-addons local state line cmds ret=1 typeset -A opt_args _arguments -C \ {-q,--query}'[be quiet and make the output more parseable]' \ {-r,--registry-dir}'[set the registry directory]' \ {-s,--source-dir}'[set addon source directory]' \ {-t,--target-dir}'[set addon target directory]' \ {-v,--verbose}'[increase verbosity]' \ {-y,--system-dir}'[set system-wide target directory]' \ {-h,--help}'[help]' \ {-w,--system-wide}'[set target directory to the system-wide one (overrides -t)]' \ '1: :->cmds' \ '*: :->args' && ret=0 case $state in cmds) cmds=( 'install:install the specified addon' 'remove:remove the specified addon' 'list:list available addons in registry' 'status:list the status of addons' 'disable:disable the specified addons' 'amend:under the effects of the previous disable' 'files:list the files composing the specified addon' 'show:display detailed information about the specified addon' ) _describe -t commands 'vim-addons command' cmds && ret=0 ;; args) case $line[1] in install) _wanted addon expl 'addon' compadd $(command vim-addons -q | awk '$2 == "removed" { print $1 }') && ret=0 ;; amend) _wanted addon expl 'addon' compadd $(command vim-addons -q | awk '$2 == "disabled" { print $1 }') && ret=0 ;; remove) _wanted addon expl 'addon' compadd $(command vim-addons -q | awk '$2 ~ /disabled|installed/ { print $1 }') && ret=0 ;; files|status|disable|show) _wanted addon expl 'addon' compadd $(command vim-addons list) && ret=0 ;; esac ;; esac return ret PK[jwfunctions/_limitnuW+A#compdef limit if ! ((CURRENT % 2)); then _limits elif [[ $PREFIX = u* ]]; then compadd unlimited else _message -e values "number and scaling factor" fi PK[C+functions/VCS_INFO_get_cmdnuW+A## vim:ft=zsh # find out if the user wants us to use a special binary. # the default command name is the same as the backend name. local cmd zstyle -s ":vcs_info:${vcs}:${usercontext}:${rrn}" "command" cmd vcs_comm[cmd]=${cmd:-$vcs} PK[~functions/VCS_INFO_quiltnuW+A## vim:ft=zsh:foldmethod=marker function VCS_INFO_quilt-match() { emulate -L zsh setopt extendedglob local d mode="$1" param="$2" local -a list case ${mode} in (assoc) list=( ${(kOP)param} );; (array) : "${foo[@]}" ${(t)foo}; list=( ${(OP)param} );; (*) return 1;; esac for d in "${list[@]}"; do if [[ ${PWD} == ${d%/##}(|/*) ]]; then print "$d" return 0 fi done return 1 } function VCS_INFO_quilt-standalone-detect() { emulate -L zsh setopt extendedglob local param local -i ret zstyle -s "${context}" quilt-standalone param || return 1 [[ "${param}" == 'never' ]] && return 1 [[ "${param}" == 'always' ]] && return 0 if (( ${+functions[$param]} )); then ${param} return $? fi case ${(Pt)param} in *association*) local m local -A A m="$(VCS_INFO_quilt-match assoc ${param})" A=(${(kvP)param}) (( $? == 0 )) && [[ ${A[$m]} == "true" ]] && return 0 return 1 ;; *array*) typeset -gU ${param} VCS_INFO_quilt-match array ${param} > /dev/null return $? ;; *scalar*) [[ "${(P)param}" == 'always' ]] && return 0 [[ "${(P)param}" == 'never' ]] && return 1 ;; esac # If nothing hit yet, it just wasn't meant to be. return 1 } function VCS_INFO_quilt-dirfind() { # This is a wrapper around VCS_INFO_bydir_detect(). It makes sure # that $vcs_comm[] is unchanged. Currently, changing anything in it # should not be an issue, but this makes sure the code can safely # be called elsewhere, too - if needed. emulate -L zsh setopt extendedglob local dir="$1" file="$2"; shift $# local ret oldfile olddir olddir=${vcs_comm[basedir]} vcs_comm[basedir]='' if [[ -n "${file}" ]]; then oldfile=${vcs_comm[detect_need_file]} vcs_comm[detect_need_file]=${file} fi VCS_INFO_bydir_detect ${dir} ret=$? [[ -n "${file}" ]] && vcs_comm[detect_need_file]=${oldfile} printf '%s' ${vcs_comm[basedir]} vcs_comm[basedir]="${olddir}" return ${ret} } function VCS_INFO_quilt() { emulate -L zsh setopt extendedglob local mode="$1" local patches pc tmp qstring root local -i ret local -x context local -a applied unapplied applied_string unapplied_string quiltcommand local -Ax hook_com context=":vcs_info:${vcs}.quilt-${mode}:${usercontext}:${rrn}" zstyle -t "${context}" use-quilt || return 1 case ${mode} in (standalone) VCS_INFO_quilt-standalone-detect || return 1 ;; (addon) ;; (*) printf 'Invalid mode: `%s'\''\n' "$1" return 2 ;; esac zstyle -s "${context}" quilt-patch-dir patches || patches="${QUILT_PATCHES}" if [[ "${patches}" != /* ]]; then tmp=${patches:-patches} patches="$(VCS_INFO_quilt-dirfind "${tmp}")" ret=$? (( ret )) && return ${ret} patches=${patches}/${tmp} else [[ -d ${patches} ]] || return 1 fi pc="$(VCS_INFO_quilt-dirfind .pc .version)" ret=$? if (( ret == 0 )); then [[ ${quiltmode} == 'standalone' ]] && root=${pc} pc=${pc}/.pc if [[ -e ${pc}/applied-patches ]]; then applied=( ${(f)"$(<$pc/applied-patches)"} ) # throw away empty entries applied=( ${applied:#} ) applied=( ${(Oa)applied} ) else applied=() fi fi if zstyle -t "${context}" get-unapplied; then # This zstyle call needs to be moved further up if `quilt' needs # to be run in more places than this one. zstyle -s "${context}" quiltcommand quiltcommand || quiltcommand='quilt' unapplied=( ${(f)"$(QUILT_PATCHES=$patches $quiltcommand --quiltrc /dev/null unapplied 2> /dev/null)"} ) unapplied=( ${unapplied:#} ) else unapplied=() fi if VCS_INFO_hook 'gen-applied-string' "${applied[@]}"; then if (( ${#applied} )); then applied_string=${applied[1]} else applied_string="" fi else applied_string=${hook_com[applied-string]} fi hook_com=() if VCS_INFO_hook 'gen-unapplied-string' "${unapplied[@]}"; then unapplied_string="${#unapplied}" else unapplied_string=${hook_com[unapplied-string]} fi if (( ${#applied} )); then zstyle -s "${context}" patch-format qstring || qstring="%p (%n applied)" else zstyle -s "${context}" nopatch-format qstring || qstring="no patch applied" fi hook_com=( applied "${applied_string}" unapplied "${unapplied_string}" applied-n ${#applied} unapplied-n ${#unapplied} ) if VCS_INFO_hook 'set-patch-format' ${qstring}; then zformat -f qstring "${qstring}" "p:${hook_com[applied]}" "u:${hook_com[unapplied]}" \ "n:${#applied}" "c:${#unapplied}" else qstring=${hook_com[patch-replace]} fi hook_com=() case ${mode} in (standalone) VCS_INFO_formats '' '' "${root}" '' '' '' "${qstring}" VCS_INFO_set ;; (addon) # When VCS_INFO_quilt() is called with "addon" a "local -x REPLY" variable # should be in place. That variable can be unset after it's being used. REPLY="${qstring}" ;; esac VCS_INFO_hook 'post-quilt' ${mode} ${patches} ${pc:-\\-nopc-} } VCS_INFO_quilt "$@" PK[functions/_x_visualnuW+A#autoload local expl # with the -b option, include `Best' in the matches local best="${argv[(r)-b]:+Best}" argv[(i)-b]=() _wanted visuals expl visual compadd "$@" -M 'm:{a-zA-Z}={A-Za-z}' - \ $best DirectColor TrueColor PseudoColor StaticColor GrayScale StaticGray PK[qiifunctions/_packnuW+A#compdef pack unpack pcat=unpack local expl state line case $service in pack) _arguments -C \ '-f[force packing even for files which will not benefit]' \ '-[show statistics for files]' \ '*:file to compress:_files -g "^*.z(-.)"' ;; unpack) _description files expl 'compressed file' _files "$expl[@]" -g '*.z(-.)' ;; esac PK[:`functions/_umlnuW+A#compdef linux uml_moo uml_mconsole uml_switch tunctl local curcontext="$curcontext" state st line expl suf ret=1 typeset -A opt_args case $service in uml_moo) _arguments '1:COW file:_files -g "*cow*(-.)"' '2:new backing file:_files' return ;; uml_switch) _arguments \ '-unix[listen on specified pair of sockets]:control socket: :data socket' \ '-hub[act like a hub]' return ;; uml_mconsole) if (( CURRENT == 2 )); then _wanted socket expl 'socket name' compadd {~/.uml,/tmp}/*/mconsole(N=:h:t) && ret=0 elif [[ $words[CURRENT-1] = config ]]; then if [[ -prefix ubd || -prefix eth ]]; then state=option else _wanted device expl device compadd -S '' ubd eth && ret=0 fi elif [[ $words[CURRENT-1] = remove ]]; then _wanted device expl device compadd ubd{0..7} eth{0..9} && ret=0 elif (( CURRENT == 3 )); then _values 'command' \ 'version[print the UML kernel version number]' \ 'help[print help]' \ 'halt[shutdown UML system immediately]' \ 'reboot[reboot the UML system immediately]' \ 'config[add a new device to the virtual machine]' \ 'remove[delete a device from the virtual machine]' \ 'sysrq[perform sysrq action]:key:((r\:turn\ of\ keyboard\ raw\ mode k\:secure\ access\ key b\:reboot o\:shutdown s\:sync u\:remount p\:dump\ registers t\:dump\ tasks m\:dump\ memory e\:SIGTERM\ to\ all i\:SIGKILL\ to\ all l\:SIGKILL\ to\ all\ inc.\ init h\:help {0..9}\:console\ log\ level))' \ 'cad[invoke ctrl-alt-del handler]' \ 'stop[pause the UML]' \ 'go[continue the UML]' \ && ret=0 else _message 'no more arguments' fi ;; linux) _arguments -C \ '(* -)--version[display kernel version number]' \ '(* -)--help[print usage information]' \ '(* -)--showconfig[show kernel configuration]' \ '(-)*:option:->option' && ret=0 ;; tunctl) _arguments \ '(-d)-b[brief output]' \ '-f[specify tun clone device]:tun clone device:_files' \ '(-d)-u[specify owner]:owner:_users' \ '(-b -u -t)-d[specify devicename to delete]:device name:(tap{0..9})' \ '(-d)-t[specify devicename]:device name:(tap{0..9})' return ;; esac while [[ -n $state ]]; do st=$state unset state case $st in option) if compset -P '(ssl|con)[0-9]#='; then state=channel continue elif compset -P con; then _message -e consoles 'console number' return elif compset -P ssl; then _message -e serial 'serial line number' return elif compset -P 'ubd[0-7](|r)(|s)='; then compset -P '*,' _files && return elif compset -P ubd; then _message -e devices 'device number' return elif compset -P 'eth[0-9]##='; then if compset -P 1 '*,'; then _message -e options option else _wanted transports expl transports compadd -S, \ ethertap tuntap daemon mcast slip && return fi return elif compset -P eth; then _message -e ethernet number return fi compadd -n -S '' con ssl ubd eth && ret=0 _values -C -w "option" \ 'mem[specify amount of "physical" memory to allocate]:memory' \ 'iomem[configure file as named IO memory region]:arg:->iomem' \ 'gdb[attach gdb to specified channel]:channel:->channel' \ 'gdb-pid[specify pid of debugger]:debugger pid:_pids' \ 'debugtrace[cause tracing thread to wait for debugger]' \ 'honeypot[put process stacks in the same location as on host]' \ 'debug[start kernel under gdb control]' \ 'root[specify root filesystem]:root device' \ 'umid[specify name for this UML machine]:name' \ 'uml_dir[location to place pid and umid files]:directory:_directories' \ 'initrd[boot from initrd image]:initrd file:_files' \ 'jail[enable protection of kernel memory from processes]' \ '*con[attach a console to a host channel]:channel:->channel' \ '*ssl[attach a serial line to a host channel]:channel:->channel' \ 'fake_ide[create ide0 entries which map onto ubd devices]' \ '*ubd[associate device with host file]' \ 'fakehd[change the ubd device name to "hd"]' \ '*eth[configure a network device]' \ 'ncpus[specify number of virtual processors to start]:processors' \ 'mode[force UML to run in specified mode]:mode:(tt)' \ 'mconsole[request mconsole driver to send a message to socket]:socket' \ 'xterm[specify alternate terminal emulator]:terminal emulator:->xterm' \ 'dsp[specify host dsp device]:dsp device:_files' \ 'mixer[specify host mixer device]:mixer device:_files' \ 'umn[specify ip address for host side of slip device]' && ret=0 ;; iomem) if compset -P '*,'; then _files && ret=0 else _message -e name fi ;; channel) compset -P '*,' || suf=( -S , ) _values -S : ${suf/S/s} "channel" \ pty pts xterm \ 'tty:tty:_files $suf' \ "fd:file descriptor:_file_descriptors $suf" && ret=0 ;; xterm) if compset -P 2 '*,'; then _wanted -x argument expl 'execute switch' compadd - -e -x && ret=0 elif compset -P 1 '*,'; then _wanted -x argument expl 'title switch' compadd -S , - -t -T -title && ret=0 else _wanted command expl 'terminal emulator' _command_names -e -S , && ret=0 fi ;; esac done return ret PK[<functions/_command_namesnuW+A#autoload # The option `-e' if given as the first argument says that we should # complete only external commands and executable files. This and a # `-' as the first argument is then removed from the arguments. local args defs zstyle -t ":completion:${curcontext}:commands" rehash && rehash defs=( 'commands:external command:_path_commands' ) [[ -n "$path[(r).]" || $PREFIX = */* ]] && defs=( "$defs[@]" 'executables:executable file or directory:_path_files -/g \*\(-\*\)' ) if [[ "$1" = -e ]]; then shift else [[ "$1" = - ]] && shift defs=( "$defs[@]" 'builtins:builtin command:compadd -k builtins' 'functions:shell function:compadd -k functions' 'aliases:alias:compadd -k aliases' 'suffix-aliases:suffix alias:_suffix_alias_files' 'reserved-words:reserved word:compadd -k reswords' 'jobs:: _jobs -t' 'parameters:: _parameters -g "^*readonly*" -qS= -r "\n\t\- =["' ) fi args=( "$@" ) local -a cmdpath if zstyle -a ":completion:${curcontext}" command-path cmdpath && [[ $#cmdpath -gt 0 ]] then local -a +h path local -A +h commands path=( $cmdpath ) fi _alternative -O args "$defs[@]" PK[/WWfunctions/_hdiutilnuW+A#compdef hdiutil # utilities # _hdiutil_disk() { local -a disk_desc _call_program devices hdiutil info | while read; do local disk_name="${${(M)REPLY[(w)1]%/dev/disk*}#/dev/}" if (( #disk_name )); then disk_desc+=( "$disk_name:${${(M)REPLY% *}#?}" ) fi done _describe -t devices disks disk_desc } _hdiutil_device() { local -a device_desc _call_program devices /usr/bin/hdiutil burn -list | while read; do if [[ "$REPLY" == [:space:]#IOService:* ]]; then device_desc+=( "$REPLY" ) fi done local expl _wanted devices expl device compadd "$device_desc[@]" } _hdiutil_imagesize(){ local -a arr local num="${PREFIX%%[^0-9]*}" if [[ -n "$num" ]]; then arr=( "$num"b:"$(($num / 2.**11)) mega bytes" "$num"k:"$(($num / 2.**10)) mega bytes" "$num"m:"$(($num)) mega bytes" "$num"g:"$(($num)) giga bytes" "$num"t:"$(($num * 2**10)) giga bytes" "$num"p:"$(($num * 2**20)) giga bytes" "$num"e:"$(($num * 2**30)) giga bytes" ) local expl _describe -t values "size (b, k, m, g..)" arr -V1 else _message "size (b, k, m, g..)" fi } _hdiutil_imageformat(){ local -a fmts fmts=( "UDRW:UDIF read/write image" "UDRO:UDIF read-only image" "UDZO:UDIF zlib-compressed image" "UDCO:UDIF ADC-compressed image" "UFBI:UDIF entire image with MD5 checksum" "UDTO:DVD/CD-R master for export" "UDxx:UDIF stub image" "UDSP:SPARSE (growable with content)" "Rdxx:NDIF read-only image (Disk Copy 6.3.3 format)" "DC42:Disk Copy 4.2 image" ) ofmts=( "UDRo:UDIF read-only" "UDCo:UDIF compressed" "RdWr:NDIF read/write image" "ROCo:NDIF compressed image" "Rken:NDIF compressed" ) _describe -t types "image format" fmts -V1 || _describe -t types "obsolete/deprecated image format" ofmts -V1 } _hdiutil(){ local -a _common_options _common_options=( '(: -)'-help'[display help message of a verb]' '(-quiet)-verbose' '(-verbose debug)-quiet' '(-quiet)-debug' ) local -A _common_usage_options _common_usage_options=( -shadow "-shadow:shadow file:_files -g \*.shadow" -encryption "-encryption:encryption method:(CEncryptedEncoding)" -stdinpass "-stdinpass[specify password from standard input]" -certificate "-certificate[secondary access certificate]:certificate file:_files" -cacert "-cacert[certificate authority certificate]: :_files" -imagekey "*-imagekey[image key]: :->keyvalue" -srcimagekey "*-srcimagekey[source image key]: :->keyvalue" -tgtimagekey "*-tgtimagekey[target image key]: :->keyvalue" -insecurehttp "-insecurehttp[ignore SSL host validation failure]" -plist "-plist[display output in plist format]" -recover "-recover[keychain to unlock]:keychain file:_files -g \*.keychain" ) local -a _1st_arguments _1st_arguments=( 'help:display minimal usage information' 'attach:attach a disk image' 'mount:attach a disk image' 'detach:detach a disk image' 'eject:detach a disk image' 'verify:verify the checksum of a disk image' 'create:create a disk image' 'convert:convert a disk image into another format' 'burn:burn image to optical media' 'makehybrid:generate cross-platform hybrid images' 'compact:compacts a SPARSE disk image' 'info:display information about the disk image driver and attached images' 'load:manually load the disk image driver' 'checksum:calculate the specified checksum on the image data' 'chpass:change the passphrase for an encrypted image' 'unflatten:extract any UDIF metadata into resource fork' 'flatten:embed any resource fork into UDIF data fork' 'hfsanalyze:print information about an HFS/HFS+ volume' 'mountvol:mount a volume' 'unmount:unmount a volume' 'imageinfo:print out information about a disk image' 'plugins:print information about DiskImages framework plugins' 'internet-enable:enable or disable post-processing for the image' 'resize:resize partition or image' 'segment:segment disk image' 'pmap:display the partition map' ) local size_spec='-size -sectors -megabytes -srcfolder -srcdir' # local curcontext="$curcontext" state line expl local -A opt_args _arguments -C '*:: :->subcmds' if (( CURRENT == 1 )); then _describe -t commands "hdiutil subcommands" _1st_arguments return fi case "$words[1]" in attach|mount) _arguments \ "$_common_options[@]" \ "$_common_usage_options[-encryption]" \ "$_common_usage_options[-stdinpass]" \ "$_common_usage_options[-imagekey]" \ "$_common_usage_options[-srcimagekey]" \ "$_common_usage_options[-plist]" \ "$_common_usage_options[-shadow]" \ "$_common_usage_options[-insecurehttp]" \ "$_common_usage_options[-cacert]" \ "$_common_usage_options[-recover]" \ "(-readwrite)-readonly[force the resulting device to be read-only]" \ "(-readonly)-readwrite[attempt to set the device to be read/write]" \ "(-nokernel)-nokernel[attach with/without a helper process]" \ "(-kernel)-kernel[attach with/without a helper process]" \ "-notremovable[prevent this image from being detached]" \ "(-nomount)-mount[indicate whether image should be mounted]:mount?:(required optional suppressed)" \ "(-mount)-nomount[indicate whether image should be mounted]" \ "-mountroot[mount volumes in specified path]: :_directories" \ "-mountpoint[mount volume at specified path]: :_directories" \ "-union[perform a union mount]" \ "-private[suppress mount notifications to the rest of the system]" \ "-nobrowse[mark the volumes non-browsable in applications]" \ "-owners[enable or disable owners for HFS+ volumes]: :(on off)" \ "*-drivekey[key/value pair in the IOKit registry]:key=value:" \ "(-noverify)-verify[verify image checksums]" \ "(-verify)-noverify" \ "(-noignorebadchecksums)-ignorebadchecksums[indicate bad checksums should be ignored]" \ "(-ignorebadchecksums)-noignorebadchecksums" \ "(-noidme)-idme[perform IDME actions]" \ "(-idme)-noidme" \ "(-noidmereveal)-idmereveal[reveal the results of IDME processing]" \ "(-idmereveal)-noidmereveal" \ "(-noidmetrash)-idmetrash[put IDME images in the trash after processing]" \ "(-idmetrash)-noidmetrash" \ "(-noautoopen)-autoopen[auto-open volumes after attaching an image]" \ "(-autoopen)-noautoopen" \ "(-noautoopenro)-autoopenro[auto-open read-only volumes]" \ "(-autoopenro)-noautoopenro" \ "(-noautoopenrw)-autoopenrw[auto-open read/write volumes]" \ "(-autoopenrw)-noautoopenrw" \ "1:disk image to attach:_files -g \*.\(dmg\|sparseimage\)\(\|.bin\)" \ && return 0 ;; detach|eject) _arguments \ "$_common_options[@]" \ "-force[unmount any filesystems and detaches the image]" \ "1: :_hdiutil_disk" && return 0 ;; verify) _arguments \ "$_common_options[@]" \ "$_common_usage_options[-encryption]" \ "$_common_usage_options[-stdinpass]" \ "$_common_usage_options[-imagekey]" \ "$_common_usage_options[-srcimagekey]" \ "$_common_usage_options[-plist]" \ "1:disk image to verify:_files -g \*.\(dmg\|sparseimage\)\(\|.bin\)" \ && return 0 ;; create) local fold_opts="-format -crossdev -nocrossdev -scrub -noscrub" _arguments \ "$_common_options[@]" \ "$_common_usage_options[-encryption]" \ "$_common_usage_options[-stdinpass]" \ "$_common_usage_options[-imagekey]:" \ "$_common_usage_options[-srcimagekey]" \ "$_common_usage_options[-tgtimagekey]" \ "$_common_usage_options[-plist]" \ "($size_spec $fold_opts)-size[specify size]: :_hdiutil_imagesize" \ "($size_spec $fold_opts)-sectors[specify size]:512 byte sectors" \ "($size_spec $fold_opts)-megabytes[specify size]:mega bytes" \ "($size_spec)-srcfolder[specify directory]: :_directories" \ "($size_spec)-srcdir[specify directory]: :_directories" \ "-align[size to which partition is aligned]:size" \ "-type[image type]:image type:(UDIF SPARSE)" \ "-fs[filesystem to make]:filesystem:(HFS+ HFS+J HFSX HFS MS-DOS UFS)" \ "-volname[volume name]:name" \ "-uid[uid of root directory]:uid in number" \ "-gid[gid of root directory]:gid in number" \ "-mode[mode of root directory]:mode" \ "-nouuid[suppress addiing a UUID]" \ "(-noautostretch)-autostretch" \ "(-autostretch)-noautostretch" \ "-stretch[max_stretch]: :_hdiutil_imagesize" \ "-fsargs[additional arguments to pass to newfs]:arguments" \ "-layout[partition layout]:partition layout:(NONE SPUD UNIVERSAL\ CD UNIVERSAL\ HD)" \ "-partitionType[partition type]:partition type:(Apple_HFS Apple_UFS)" \ "-ov[overwrite an existing file]" \ "-attach[attach the image after creating it]" \ "-format:format:_hdiutil_imageformat" \ "(-nocrossdev)-crossdev[cross device boundaries when copying from the source]" \ "(-crossdev)-nocrossdev" \ "(-noscrub)-scrub[skip temporary files and trashes]" \ "(-scrub)-noscrub" \ "(-noanyowners)-anyowners[allow user files being copied]" \ "(-anyowners)-noanyowners" \ "1:disk image to create:_files" && return 0 if [[ $state = keyvalue ]]; then _values 'key=value' \ "di-sparse-puma-compatible: :(TRUE FALSE)" \ "di-shadow-puma-compatible: :(TRUE FALSE)" \ "encrypted-encoding-version:version:(1 2)" \ "zlib-level:compression level:(1 2 3 4 5 6 7 8 9)" && return 0 fi ;; convert) _arguments \ "$_common_options[@]" \ "$_common_usage_options[-encryption]" \ "$_common_usage_options[-stdinpass]" \ "$_common_usage_options[-certificate]" \ "$_common_usage_options[-srcimagekey]" \ "$_common_usage_options[-tgtimagekey]" \ "$_common_usage_options[-shadow]" \ "$_common_usage_options[-insecurehttp]" \ "$_common_usage_options[-cacert]" \ "$_common_usage_options[-plist]" \ "-align:size (512 byte sectors)" \ "-segmentSize: :_hdiutil_imagesize" \ "-pmap[add partition map]" \ "-tasks[number of tasks for compression operation]:number:" \ "-ov[overwrite an existing file]" \ "-format:format:_hdiutil_imageformat" \ "-o:target disk image:_files" \ "1:source disk image:_files -g \*.\(dmg\|sparseimage\)\(\|.bin\)" \ && return 0 if [[ $state = keyvalue ]]; then _values 'key=value' \ "zlib-level:compression level:(1 2 3 4 5 6 7 8 9)" && return 0 fi ;; burn) _arguments \ "$_common_options[@]" \ "$_common_usage_options[-shadow]" \ "$_common_usage_options[-insecurehttp]" \ "$_common_usage_options[-cacert]" \ "$_common_usage_options[-srcimagekey]" \ "$_common_usage_options[-encryption]" \ "$_common_usage_options[-stdinpass]" \ "-device[device to use for burning]:device:_hdiutil_device" \ "-testburn[don\'t turn on laser]" \ "-anydevice[allow burning to devices not qualified by Apple]" \ "(-eject)-noeject[don\'t eject disc after burning]" \ "(-noeject)-eject" \ "(-verifyburn)-noverifyburn[don\'t verify disc contents after burn]" \ "(-noverifyburn)-verifyburn" \ "(-addpmap)-noaddpmap[don\'t add partition map]" \ "(-noaddpmap)-addpmap" \ "(-skipfinalfree)-noskipfinalfree[don\'t skip final free partition]" \ "(-noskipfinalfree)-skipfinalfree" \ "(-nooptimizeimage)-optimizeimage[optimize filesystem for burning]" \ "(-optimizeimage)-nooptimizeimage" \ "-nounderrun[turn off buffer underrun protection]" \ "-forceclose[force the disc to be closed after burning]" \ "-speed[desired \"x-factor\"]:x_factor:(1 2 4 6 max)" \ "-sizequery[calculate the required size without burning anything]" \ "-erase[erase the media]" \ "-fullerase[erase all sectors of the disc]" \ "-list[list all burning devices with paths suitable for -device]" \ "1:disk image:_files -g \*.\(dmg\|sparseimage\)\(\|.bin\)" \ && return 0 ;; makehybrid) _arguments \ "$_common_options[@]" \ "$_common_usage_options[-encryption]" \ "$_common_usage_options[-stdinpass]" \ "$_common_usage_options[-shadow]" \ "$_common_usage_options[-insecurehttp]" \ "$_common_usage_options[-cacert]" \ "-hfs[generate an HFS+ filesystem]" \ "-iso[generate an ISO9660 filesystem with Rock Ridge extensions]" \ "-joliet[generate Joliet extensions to ISO9660]" \ "-hfs-blessed-directory[blessed folder for booting Mac OS X]: :_directories" \ "-hfs-openfolder[folder automatically opened]: :_directories" \ "-hfs-startupfile-size[Startup File size]:bytes" \ "-abstract-file[path to an ISO9660/Joliet Abstract file]: :_file" \ "-bibliography-file[path to a ISO9660/Joliet Bibliography file]: :_file" \ "-copyright-file[path to a ISO9660/Joliet Copyright file]: :_file" \ "-application[creator application name]:creator name" \ "-preparer[data preparer name]:preparer name" \ "-publisher[publisher name]:publisher name" \ "-system-id[system identifier]:system identifier" \ "-keep-mac-specific[keep Macintosh-specific files in non-HFS+ filesystems]" \ "-default-volume-name[default volume name for all filesystems]:name" \ "-hfs-volume-name[volume name for HFS+ filesystem]:name" \ "-iso-volume-name[volume name for ISO9660 filesystem]:name" \ "-joliet-volume-name[volume name for Joliet]:name" \ "-hide-all[glob expression to hide]:glob expression" \ "-hide-hfs[glob expression to hide in HFS+]:glob expression" \ "-hide-iso[glob expression to hide in ISO9660]:glob expression" \ "-hide-joliet[glob expression to hide in Joliet]:glob expression" \ "-print-size[print size estimate and quit]" \ "-plistin[accept command-line options as a plist on stdin]" \ "-ov[overwrite an existing file]" \ "(-noverify)-verify[verify image checksums]" \ "(-verify)-noverify" \ "(-nokernel)-nokernel[attach with a helper process]" \ "(-kernel)-kernel[attach without a helper process]" \ "-o:target disk image:_files" \ "1:source disk image or directory:_files -g \*.\(dmg\|sparseimage\)\(\|.bin\)" \ && return 0 ;; compact) _arguments \ "$_common_options[@]" \ "$_common_usage_options[-encryption]" \ "$_common_usage_options[-stdinpass]" \ "$_common_usage_options[-srcimagekey]" \ "$_common_usage_options[-shadow]" \ "$_common_usage_options[-insecurehttp]" \ "$_common_usage_options[-cacert]" \ "$_common_usage_options[-plist]" \ "1:sparse image:_files -g \*.sparseimage" && return 0 ;; info) _arguments "$_common_options[@]" \ "$_common_usage_options[-plist]" && return 0 ;; load) _arguments "$_common_options[@]" && return 0 ;; checksum) _arguments \ "$_common_options[@]" \ "$_common_usage_options[-encryption]" \ "$_common_usage_options[-stdinpass]" \ "$_common_usage_options[-srcimagekey]" \ "$_common_usage_options[-shadow]" \ "$_common_usage_options[-insecurehttp]" \ "$_common_usage_options[-cacert]" \ "$_common_usage_options[-plist]" \ "-type:image type:(UDIF-CRC32 UDIF-MD5 DC42 CRC28 CRC32 MD5)" \ "1:disk image:_files -g \*.\(dmg\|sparseimage\)\(\|.bin\)" \ && return 0 ;; chpass) _arguments \ "$_common_options[@]" \ "$_common_usage_options[-recover]" \ "$_common_usage_options[-srcimagekey]" \ "-oldstdinpass[specify old password from standard input]" \ "-newstdinpass[specify new password from standard input]" \ "1:disk image:_files -g \*.\(dmg\|sparseimage\)\(\|.bin\)" \ && return 0 ;; unflatten) _arguments \ "$_common_options[@]" \ "$_common_usage_options[-encryption]" \ "$_common_usage_options[-stdinpass]" \ "$_common_usage_options[-srcimagekey]" \ "1:disk image:_files -g \*.\(dmg\|sparseimage\)\(\|.bin\)" \ && return 0 ;; flatten) _arguments \ "$_common_options[@]" \ "$_common_usage_options[-encryption]" \ "$_common_usage_options[-stdinpass]" \ "$_common_usage_options[-srcimagekey]" \ "(-xml)-noxml[don\'t embed XML data for in-kernel attachment]" \ "(-noxml)-xml" \ "(-rsrcfork)-norsrcfork[don\'t embed resource fork data]" \ "(-norsrcfork)-rsrcfork" \ "1:disk image:_files -g \*.\(dmg\|sparseimage\)\(\|.bin\)" \ && return 0 ;; hfsanalyze) _arguments \ "$_common_options[@]" \ "$_common_usage_options[-encryption]" \ "$_common_usage_options[-stdinpass]" \ "$_common_usage_options[-srcimagekey]" \ "$_common_usage_options[-shadow]" \ "$_common_usage_options[-insecurehttp]" \ "$_common_usage_options[-cacert]" \ "1:disk image or device:_files -g \*.\(dmg\|sparseimage\)\(\|.bin\)" \ && return 0 ;; mountvol) _arguments \ "$_common_options[@]" \ "$_common_usage_options[-plist]" \ "1: :_path_files -W /dev -g disk\*" && return 0 ;; unmount) _arguments \ "$_common_options[@]" \ "-force[unmount filesystem regardless of open files]" \ "1:device or mount point:_files" && return 0 ;; imageinfo) _arguments \ "$_common_options[@]" \ "$_common_usage_options[-encryption]" \ "$_common_usage_options[-stdinpass]" \ "$_common_usage_options[-srcimagekey]" \ "$_common_usage_options[-shadow]" \ "$_common_usage_options[-insecurehttp]" \ "$_common_usage_options[-cacert]" \ "$_common_usage_options[-plist]" \ "-format[just print out the image format]" \ "-checksum[just print out the image checksum]" \ "1:disk image:_files -g \*.\(dmg\|sparseimage\)\(\|.bin\)" \ && return 0 ;; plugins) _arguments \ "$_common_options[@]" "$_common_usage_options[-plist]" && return 0 ;; internet-enable) _arguments \ "$_common_options[@]" \ "$_common_usage_options[-encryption]" \ "$_common_usage_options[-stdinpass]" \ "$_common_usage_options[-srcimagekey]" \ "$_common_usage_options[-plist]" \ "(-yes -no -query)"{-yes,-no,-query} \ "1:disk image:_files -g \*.\(dmg\|sparseimage\)\(\|.bin\)" \ && return 0 ;; resize) _arguments -C \ "$_common_options[@]" \ "$_common_usage_options[-encryption]" \ "$_common_usage_options[-stdinpass]" \ "$_common_usage_options[-srcimagekey]" \ "$_common_usage_options[-shadow]" \ "$_common_usage_options[-insecurehttp]" \ "$_common_usage_options[-cacert]" \ "$_common_usage_options[-plist]" \ "(-sectors)-size[specify size]: :_hdiutil_imagesize" \ "(-size)-sectors[specify size]:size (512 byte sectors)/min/max:" \ "-imageonly[only resize image file]" \ "-partitiononly[only resize partition(s) in the image]" \ "-partitionNumber[partition to resize]:partition number" \ "-growonly[only allow the image to grow]" \ "-shrinkonly[only allow the image to shrink]" \ "-nofinalgap[allow elimination of trailing free partition]" \ "-limits[displays min/current/max size]" \ "1:disk image:_files -g \*.dmg\(\|.bin\)" \ && return 0 ;; segment) _arguments \ "$_common_options[@]" \ "$_common_usage_options[-encryption]" \ "$_common_usage_options[-stdinpass]" \ "$_common_usage_options[-srcimagekey]" \ "$_common_usage_options[-tgtimagekey]" \ "$_common_usage_options[-plist]" \ "(-segmentSize)-segmentCount[number of segments]:number" \ "(-segmentCount)-segmentSize[segment size]: :_hdiutil_imagesize" \ "-firstSegmentSize[first segment size]: :_hdiutil_imagesize" \ "-restricted[make restricted segments]" \ "-o[first segment name]:name" \ "1:source disk image:_files -g \*.dmg\(\|.bin\)" \ && return 0 ;; pmap) _arguments \ "$_common_options[@]" \ "$_common_usage_options[-encryption]" \ "$_common_usage_options[-stdinpass]" \ "$_common_usage_options[-srcimagekey]" \ "$_common_usage_options[-shadow]" \ "$_common_usage_options[-insecurehttp]" \ "$_common_usage_options[-cacert]" \ "-options[just print out the image checksum]: :->option" \ "1:disk image:_files -g \*.\(dmg\|sparseimage\)\(\|.bin\)" \ && return 0 case "$state" in option) _values -s '' option \ "r[process all without modification]" \ "x[process 2K & 512 entries and merge]" \ "s[return all quantities in sectors]" \ "S[sort all entries by block number]" \ "g[account for all unmapped space]" \ "c[combine adjacent freespace entries]" \ "f[extend last partition to device end]" \ "v[synthesize single volumes as a single partition entry]" \ "k[skip zero length entries]" \ "K[skip all free & void partitions]" \ "m[merge small free partitions into a previous partition]" \ "i[ignore small free partitions caused by block alignment]" ;; esac ;; *) _message "unknown hdiutil command: $words[1]" _default ;; esac return 1 } _hdiutil "$@" PK[(tfunctions/_object_classesnuW+A#compdef odmget odmshow odme local expl _wanted objectclasses expl 'object class' \ _files -W ${ODMDIR:-/etc/objrepos} -g '^*.vc(-.)' "$@" - PK[D  functions/_reprepronuW+A#compdef reprepro local context state line distfile typeset -A opt_args local -a codenames _arguments \ '(-h --help)'{-h,--help}'[display help]' \ '*'{-v,-V,--verbose}'[be more verbose]' \ '--silent[be less verbose]' \ '(-b --basedir)'{-b,--basedir}':basedir:_files -/' \ '--confdir:config dir:_files -/' \ '--distdir:dist dir:_files -/' \ '--logdir:log dir:_files -/' \ '--overridedir:override dir:_files -/' \ '--dbdir:db dir:_files -/' \ '--listdir:list dir:_files -/' \ '--methoddir:method dir:_files -/' \ '(-C --component)'{-C,--component}':component:(component1 component2)' \ '(-A --architecture)'{-A,--architecture}':architecture:(amd64 sparc)' \ '(-T --type)'{-T,--type}':file type:(dsc deb udeb)' \ '(-S --section)'{-S,--section}':section:(section1 section2)' \ '(-P --priority)'{-P,--priority}':priority:(high low)' \ '--export=:whether and how:(never changed normal force)' \ '--ignore=:error type:(what otherwhat)' \ '--nolistsdownload[do not download Release or index files]' \ '--keepunreferencedfiles[do not delete files that are no longer used]' \ '--keepunneededlists' \ '--keepdirectories' \ '--ask-passphrase' \ '--noskipold' \ '--waitforlock:count:' \ '--spacecheck:behavior:(full none)' \ '--dbsafetymargin:bytes count:' \ '--safetymargin:bytes count:' \ '--noguessgpgtty' \ ':reprepro command:(export createsymlinks list listfilter remove update iteratedupdate checkupdate predelete pull checkpull includedeb includeudeb includedsc include processincoming check checkpool rereference dumpreferences dumpunreferenced deleteunreferenced reoverride dumptracks retrack removealltracks removetrack tidytracks copy clearvanished gensnapshot rerunnotifiers)' \ '*::subcmd:->subcmd' && return 0 case "$state" in (subcmd) case "$words[1]" in (export|update|iteratedupdate|checkupdate|predelete|pull|checkpull|check) if [[ -n "$opt_args[--confdir]" ]]; then distfile=${opt_args[--confdir]}/distributions elif [[ -n "$opt_args[-b]" ]]; then distfile=${opt_args[-b]}/conf/distributions elif [[ -n "$opt_args[--basedir]" ]]; then distfile=${opt_args[--basedir]}/conf/distributions elif [[ -n "$REPREPRO_BASE_DIR" ]]; then distfile=${REPREPRO_BASE_DIR}/conf/distributions else distfile=$PWD/conf/distributions fi codenames=($(awk '/^[Cc][Oo][Dd][Ee][Nn][Aa][Mm][Ee]: / {$1="";print}' "$distfile")) _wanted -V 'codenames' expl 'codename' compadd -a codenames ;; (*) _files ;; esac ;; esac PK[0waXXfunctions/_smitnuW+A#compdef smit smitty local state line expl curcontext="$curcontext" _arguments -C \ '-s[specify smit.script file]:smit.script file:_files' \ '-l[specify smit.log file]:smit.log file:_files' \ '-C[use curses interface]' \ '-D[debug mode]' \ '-d[FastPath is dialogue screen]' \ '-f[allow redirection of stdin and stdout]' \ '-h[display help/usage message]' \ '-M[start smit in windows mode]' \ '-m[FastPath is menu screen]' \ '-n[FastPath is selector screen]' \ '-o[alternate SMIT/ODM database]' \ '-t[generate trace information]' \ '-v[verbose]' \ '-x[do not run any execute commands]' \ '-X[do not run any commands]' \ '1:fast path:->fastpath' [[ "$state" = fastpath ]] && (( $+commands[odmget] )) && _wanted fastpaths expl 'fast path' compadd \ $(odmget sm_cmd_hdr sm_name_hdr|sed -n 's/^ id = \"\(.*\)\"/\1/p') PK[D  functions/_git-buildpackagenuW+A#compdef git-buildpackage _arguments \ '--version[show program version number and exit]' \ '--help[show help message and exit]' \ '--git-ignore-new[build with uncommited changes in the source tree]' \ '--git-no-ignore-new[negates --git-ignore-new]' \ '--git-verbose[verbose command execution]' \ '--git-tag[create a tag after a successful build]' \ '--git-tag-only[do not build, only tag and run the posttag hook]' \ '--git-retag[do not fail if the tag already exists]' \ '--git-sign-tags[sign tags]' \ '--git-no-sign-tags[negates --git-sign-tags]' \ '--git-keyid=-[GPG keyid to sign tags with]:GPG key:' \ '--git-debian-tag=-[format string for debian tags]:default is debian/%(version)s:' \ '--git-upstream-tag=-[format string for upstream tags]:default is upstream/%(version)s:' \ '--git-pristine-tar[use pristine-tar to create .orig.tar.gz]' \ '--git-no-pristine-tar[negates --git-pristine-tar]' \ '--git-force-create[force creation of orig.tar.gz]' \ '--git-no-create-orig[do not create orig.tar.gz]' \ '--git-tarball-dir=-[location to look for external tarballs]:tarball directory:_files -/' \ '--git-compression=-[compression type]:compression:(auto gzip bzip2 lzma xz)' \ '--git-compression-level=-[set compression level]:level:(1 2 3 4 5 6 7 8 9)' \ '--git-upstream-branch=-[upstream branch]::' \ '--git-debian-branch=-[branch the Debian package is being developed on]::' \ '--git-ignore-branch[build although debian-branch != current branch]' \ '--git-no-ignore-branch[negates --git-ignore-branch]' \ '--git-builder=-[command to build the Debian package]:command:' \ '--git-cleaner=-[command to clean the working copy]:command:' \ '--git-prebuild=-[command to run before a build]:command:' \ '--git-postbuild=-[hook run after a successful build]:command:' \ '--git-posttag=-[hook run after a successful tag operation]:command:' \ '--git-pbuilder[Invoke git-pbuilder for building]' \ '--git-no-pbuilder[negates --git-pbuilder]' \ '--git-dist=-[build for this distribution when using git-pbuilder]:distribution:' \ '--git-arch=-[build for this architecture when using git-pbuilder]:architecture:' \ '--git-export-dir=-[before building the package export the source into this directory]:directory:_files -/' \ '--git-export=-[export treeish object instead of HEAD]:treeish:' \ '--git-dont-purge[retain exported package build directory]' \ '--git-overlay[extract orig tarball when using export-dir option]' \ '--git-no-overlay[negates --git-overlay]' \ '*:Other options:_dpkg-buildpackage' PK[ޯ|functions/_nautilusnuW+A#compdef nautilus _arguments \ '--browser[open a browser window]' \ '(--check -c)'{-c,--check}'[perform a quick set of self-check tests]' \ '(--geometry -g)'{-g,--geometry=}':geometry:_x_geometry' \ '(--no-default-window -n)'{-n,--no-default-window}'[only create windows for explicitly specified URIs]' \ '--no-desktop[do not manage the desktop]' \ '(--quit -q)'{-q,--quit}'[quit Nautilus]' \ '--help[show a summary of options]' \ '--version[show version]' \ '*:URI: _alternative "files:file:_files" "urls:URL:_urls"' PK[ڋHHfunctions/_toolchain-sourcenuW+A#compdef tpkg-install tpkg-make tpkg-debarch tpkg-update tpkg-install-libc local expl (( CURRENT == 2 )) && _wanted target expl 'target platform' \ compadd alpha-linux arm-linux hppa-linux i{3..6}86-linux ia32-linux ia64-linux m68k-linux \ mipsel-linux mips-linux ppc-linux powerpc-linux sparc-linux s390-linux PK[p)functions/promptinitnuW+A## ## zsh prompt themes extension ## by Adam Spiers ## ## Load with `autoload -Uz promptinit; promptinit'. ## Type `prompt -h' for help. ## typeset -gaU prompt_themes typeset -ga prompt_theme typeset -g prompt_newline prompt_themes=() promptinit () { emulate -L zsh setopt extendedglob local ppath='' name theme # Autoload all prompt_*_setup functions in fpath for theme in $^fpath/prompt_*_setup(N); do if [[ $theme == */prompt_(#b)(*)_setup ]]; then name="$match[1]" if [[ -r "$theme" ]]; then prompt_themes=($prompt_themes $name) autoload -Uz prompt_${name}_setup else print "Couldn't read file $theme containing theme $name." fi else print "Eh? Mismatch between glob patterns in promptinit." fi done # To manipulate precmd and preexec hooks... autoload -Uz add-zsh-hook # Variables common to all prompt styles prompt_newline=$'\n%{\r%}' } prompt_preview_safely() { emulate -L zsh print -P "%b%f%k" if [[ -z "$prompt_themes[(r)$1]" ]]; then print "Unknown theme: $1" return fi local -a psv; psv=($psvar); local -a +h psvar; psvar=($psv) # Ick local +h PS1=$PS1 PS2=$PS2 PS3=$PS3 PS4=$PS4 RPS1=$RPS1 local -a precmd_functions preexec_functions # The next line is a bit ugly. It (perhaps unnecessarily) # runs the prompt theme setup function to ensure that if # the theme has a _preview function that it's been autoloaded. prompt_${1}_setup if typeset +f prompt_${1}_preview >&/dev/null; then prompt_${1}_preview "$@[2,-1]" else prompt_preview_theme "$@" fi } set_prompt() { emulate -L zsh local opt preview theme usage old_theme usage='Usage: prompt Options: -c Show currently selected theme and parameters -l List currently available prompt themes -p [] Preview given themes (defaults to all) -h [] Display help (for given theme) -s Set and save theme Switch to new theme immediately (changes not saved) Use prompt -h for help on specific themes.' getopts "chlps:" opt case "$opt" in (h|p) setopt localtraps if [[ -z "$prompt_theme[1]" ]]; then # Not using a prompt theme; save settings local -a psv; psv=($psvar); local -a +h psvar; psvar=($psv) # Ick local +h PS1=$PS1 PS2=$PS2 PS3=$PS3 PS4=$PS4 RPS1=$RPS1 local precmd_functions preexec_functions else trap 'prompt_${prompt_theme[1]}_setup "${(@)prompt_theme[2,-1]}"' 0 fi ;; esac case "$opt" in c) if [[ -n $prompt_theme ]]; then print -n "Current prompt theme" (( $#prompt_theme > 1 )) && print -n " with parameters" print " is:\n $prompt_theme" else print "Current prompt is not a theme." fi return ;; h) if [[ -n "$2" && -n $prompt_themes[(r)$2] ]]; then if functions prompt_$2_setup >/dev/null; then # The next line is a bit ugly. It (perhaps unnecessarily) # runs the prompt theme setup function to ensure that if # the theme has a _help function that it's been autoloaded. prompt_$2_setup fi if functions prompt_$2_help >/dev/null; then print "Help for $2 theme:\n" prompt_$2_help else print "No help available for $2 theme." fi print "\nType \`prompt -p $2' to preview the theme, \`prompt $2'" print "to try it out, and \`prompt -s $2' to use it in future sessions." else print "$usage" fi ;; l) print Currently available prompt themes: print $prompt_themes return ;; p) preview=( $prompt_themes ) (( $#* > 1 )) && preview=( "$@[2,-1]" ) for theme in $preview; do [[ "$theme" == "$prompt_theme[*]" ]] && continue prompt_preview_safely "$=theme" done print -P "%b%f%k" ;; s) print "Set and save not yet implemented. Please ensure your ~/.zshrc" print "contains something similar to the following:\n" print " autoload -Uz promptinit" print " promptinit" print " prompt $*[2,-1]" shift ;& *) if [[ "$1" == 'random' ]]; then local random_themes if (( $#* == 1 )); then random_themes=( $prompt_themes ) else random_themes=( "$@[2,-1]" ) fi local i=$(( ( $RANDOM % $#random_themes ) + 1 )) argv=( "${=random_themes[$i]}" ) fi if [[ -z "$1" || -z $prompt_themes[(r)$1] ]]; then print "$usage" return fi # Reset some commonly altered bits to the default add-zsh-hook -D precmd "prompt_*_precmd" add-zsh-hook -D preexec "prompt_*_preexec" set -A zle_highlight ${zle_highlight:#default:*} (( ${#zle_highlight} )) || unset zle_highlight prompt_$1_setup "$@[2,-1]" && prompt_theme=( "$@" ) ;; esac } prompt () { local prompt_opts set_prompt "$@" (( $#prompt_opts )) && setopt noprompt{bang,cr,percent,subst} "prompt${^prompt_opts[@]}" true } prompt_preview_theme () { emulate -L zsh local -a psv; psv=($psvar); local -a +h psvar; psvar=($psv) # Ick local +h PS1=$PS1 PS2=$PS2 PS3=$PS3 PS4=$PS4 RPS1=$RPS1 local precmd_functions preexec_functions print -n "$1 theme" (( $#* > 1 )) && print -n " with parameters \`$*[2,-1]'" print ":" prompt_${1}_setup "$@[2,-1]" [[ -n ${precmd_functions[(r)prompt_${1}_precmd]} ]] && prompt_${1}_precmd [[ -o promptcr ]] && print -n $'\r'; : print -P "${PS1}command arg1 arg2 ... argn" [[ -n ${preexec_functions[(r)prompt_${1}_preexec]} ]] && prompt_${1}_preexec } [[ -o kshautoload ]] || promptinit "$@" PK[id@^functions/_pdfnuW+A#compdef pdf2dsc pdf2ps pdfimages pdfinfo pdftopbm pdftops pdftotext pdfopt pdffonts kpdf okular local expl ext='' # ghostscript: # pdf2dsc pdf2ps pdfopt # xpdf: # pdfimages pdfinfo pdftopbm pdftops pdftotext xpdf pdffonts # KDE 3: # kpdf # KDE 4: # okular if [[ "$1" == '-z' ]]; then ext='(|.bz2|.gz|.Z)' shift fi _description files expl 'PDF file' _files "$@" "$expl[@]" -g "*.(#i)pdf$ext(-.)" PK[7Afunctions/_grepnuW+A#compdef grep egrep fgrep -value-,GREP_OPTIONS,-default- # Ulrik Haugen 2001 local arguments matchers command if [[ $service = *GREP_OPT* ]]; then compset -q words=( fake "$words[@]" ) (( CURRENT++ )) command=grep else arguments=( '(-e --regexp -f --file)1: :_guard "^--*" pattern' '*:files:_files' ) command="$words[1]" fi if [[ $service != [ef]grep ]]; then matchers='(--extended-regexp --fixed-strings --basic-regexp --perl-regexp -E -F -G -P)' arguments+=( $matchers{--extended-regexp,-E}'[use extended regular expression]' $matchers{--fixed-strings,-F}'[use literal strings]' $matchers{--basic-regexp,-G}'[use basic regular expression]' $matchers{--perl-regexp,-P}'[use perl regular expression]' ) fi arguments=( $arguments[@] '(--after-context -A)'{--after-context=,-A+}'[specify lines of trailing context]:lines' '(--text -a --binary-files -I)'{--text,-a}'[process binary file as if it were text]' '(--before-context -B)'{--before-context=,-B+}'[specify lines of leading context]:lines' '(--context,-C)'{--context=,-C-}'[specify lines of context]:lines' '(--color --colour)--'{color,colour}'=-[distinguish matching string]::when:(always never auto)' '(--byte-offset -b -c)'{--byte-offset,-b}'[print the byte offset with output lines]' '(--text -a -I)--binary-files=[specify type to assume for binary files]:file type:(binary without-match text)' '(--count -c --byte-offset -b --line-number -n)'{--count,-c}'[only print a count of matching lines]' '(--directories -d -r --recursive)'{--directories=,-d+}'[specify handling of directories]:action on directory:(read skip recurse)' '(--devices -D)'{--devices=,-D+}'[specify handling of devices, FIFOs and sockets]:action on device:(read skip)' '(1)*'{--regexp=,-e+}'[specify pattern]:pattern' '(1)*'{--file=,-f+}'[specify pattern file]:file:_files' '(--with-filename -H --no-filename -h)'{--with-filename,-H}'[print filename with each match]' '(--no-filename -h --with-filename -H --null -Z --files-without-match -L --file-with-matches -l)'{--no-filename,-h}'[suppress printing of filenames]' '--label=[provide filename to print for stdin]:filename label for stdin' '--line-buffered[flush output on every line]' '(--text -a --binary-files)-I[process binary files as if non-matching]' '(--ignore-case -i -y)'{--ignore-case,-i,-y}'[case-insensitive]' '(--files-without-match -L --file-with-matches -l --no-filename -h)'{--files-without-match,-L}"[output non-matching files' names only]" '(--files-with-matches -l --files-without-match -L --no-filename -h)'{--files-with-matches,-l}"[output matching files' names only]" '(--max-count -m)'{--max-count=,-m+}'[stop after specified no of matches]:max number of matches' '(--line-number -n -c)'{--line-number,-n}'[prefix output with line numbers]' '(--only-matching -o)'{--only-matching,-o}'[show only matching part of line]' '(--quiet --silent -q)'{--quiet,--silent,-q}'[suppress normal output]' '(--recursive -r -R -d --directories)'{--recursive,-r,-R}'[recurse subdirectories]' '*--include=[examine files matching specified pattern]:file pattern' '*--exclude=[skip files matching specified pattern]:file pattern' '*--exclude-from=[skip files matching pattern in specified file]:file:_files' '*--exclude-dir=[skip directories matching specified pattern]:directory pattern' '(--no-messages -s)'{--no-messages,-s}'[suppress messages about unreadable]' '(--version -V)'{--version,-V}'[display version info]' '(--invert-match -v)'{--invert-match,-v}'[select non-matching lines]' '(--word-regexp -w --line-regexp -x)'{--word-regexp,-w}'[force pattern to match only whole words]' '(--line-regexp -x --word-regexp -w)'{--line-regexp,-x}'[force pattern to match only whole lines]' '(--null -Z --no-filename -h)'{--null,-Z}'[print 0 byte after FILE name]' '--help[display help]' '--mmap[memory map input]' ) # remove long options? _pick_variant -c "$command" gnu=gnu unix --help || arguments=( ${arguments:#(|*\)(\*|))--*} ) _arguments -S -s $arguments[@] PK[x||  functions/_ccalnuW+A#compdef ccal _arguments \ '-nodata[ignore appointment descriptions file]' \ '-data-file=[load appointments from file]:caldat file:_files' \ '-future[show only future appointments on current month]' \ "-today[show only today's appointments on current month]" \ '-europe[European format (first day is Monday)]' \ '-american[North American format (first day is Sunday)]' \ '-maxappts=[display maximum of n appointments]:number of appointments:('{8..50}')' \ '-pause[pause for keystroke before exiting]' \ '-nocolor[inhibit use of colors]' \ '-color-file=[load color definitions from file]:calcol file:_files' \ '-8bit[display 8-bit ascii characters]' \ '1:month:(1 2 3 4 5 6 7 8 9 10 11 12 jan feb mar apr may jun jul aug sep oct nov dec)' \ '2:year:' PK[Wfunctions/zfgcpnuW+A# function zfgcp { # ZFTP get as copy: i.e. first arguments are remote, last is local. # Supposed to work exactly like a normal copy otherwise, i.e. # zfgcp rfile lfile # or # zfgcp rfile1 rfile2 rfile3 ... ldir # Options: # -G don't to remote globbing, else do # -t update the local file times to the same time as the remote. # Currently this only works if you have the `perl' command, # and that perl is version 5 with the standard library. # See the function zfrtime for more gory details. # # If there is no current connection, try to use the existing set of open # parameters to establish one and close it immediately afterwards. emulate -L zsh [[ $curcontext = :zf* ]] || local curcontext=:zfgcp local opt remlist rem loc opt_G opt_t integer stat do_close while getopts :Gt opt; do [[ $opt = '?' ]] && print "zfgcp: bad option: -$OPTARG" >&2 && return 1 eval "opt_$opt=1" done (( OPTIND > 1 )) && shift $(( OPTIND - 1 )) zfautocheck || return 1 # hmm, we should really check this after expanding the glob, # but we shouldn't expand the last argument remotely anyway. if [[ $# -gt 2 && ! -d $argv[-1] ]]; then print "zfgcp: last argument must be a directory." 2>&1 return 1 elif [[ $# == 1 ]]; then print "zfgcp: not enough arguments." 2>&1 return 1 fi if [[ -d $argv[-1] ]]; then local dir=$argv[-1] argv[-1]= for remlist in $*; do # zfcd directory hack to put the front back to ~ if [[ $remlist = $HOME || $remlist = $HOME/* ]]; then remlist="~${remlist#$HOME}" fi if [[ $opt_G != 1 ]]; then zfrglob remlist fi if (( $#remlist )); then for rem in $remlist; do loc=$dir/${rem:t} if zftp get $rem >$loc; then [[ $opt_t = 1 ]] && zfrtime $rem $loc else stat=1 fi done fi done else if [[ $1 = $HOME || $1 = $HOME/* ]]; then 1="~${1#$HOME}" fi zftp get $1 >$2 || stat=$? fi (( $do_close )) && zfclose return $stat # } PK[=H3functions/_bisonnuW+A#compdef bison _arguments -s -S \ '(--file-prefix)-b+[specify output file prefix]:output file prefix' \ '(--defines)-d[write token definition file]' \ '(--raw)-r[output bison token numbers]' \ '(--token-table)-k[output token table]' \ '(--no-lines)-l[don'"'"'t generate #line directives]' \ '(--no-parser)-n[don'"'"'t generate parse (only declarations)]' \ '(--output-file)-o+[specify parser output file name]:parser file name:_files' \ '(--name-prefix)-p+[change yy prefix]:prefix string' \ '(--debug)-t[output YYDEBUG definition]' \ '(--verbose)-v[verbose mode]' \ '(--version)-V[show version]' \ '(--help)-h[show help]' \ '(--yacc --fixed-output-file)-y[imitate yacc'"'"'s output file convention]' \ ':input file:_files -g \*.\(\#i\)\(bison\|yacc\|y\)\(-.\)' \ -- \ '*=outfile:parser file name:_files' \ '*file-prefix=prefix:output file prefix' \ '*name-prefix=prefix:prefix string' PK[hUV  functions/_duploadnuW+A#compdef dupload if (( ! $+_dupload_sites )); then _dupload_sites=( $(grep -hs "^\$cfg" /etc/dupload.conf ~/.dupload.conf | sed 's/^\$cfg{\([^}]*\)}.*$/\1/') ) fi _arguments \ '--to:nickname[nickname of target site]:('"$_dupload_sites"')' \ '(-d --debug)'{-d,--debug}'[ftp verbosity]:debuglevel:' \ '(-f --force)'{-f,--force}'[upload ignoring logs]' \ '(-k --keep)'{-k,--keep}'[keep going, skip broken]' \ '--no[dry run]' \ '--nomail[suppress announcement]' \ '--mailonly[dry run and real announcement]' \ '--noarchive[add anti-archival header]' \ '(-p --print)'{-p,--print}'[print config legibly]' \ '(-q --quiet)'{-q,--quiet}'[quiet]' \ '(-V --Version)'{-V,--Version}'[display version information]' \ '*:changes file:_files -g "*.changes(-.)"' PK[]0functions/_piupartsnuW+A#compdef piuparts local context state line typeset -A opt_args _arguments -s \ '(-a --apt)'{-a,--apt} \ '(-b --basetgz)'{-b,--basetgz=}':base tarball:_files' \ '(-d --distribution)'{-d,--distribution=}':Debian distribution:(sarge etch sid experimental)' \ '(-i --ignore)*'{-i,--ignore=}':file to ignore:_files' \ '(-I --ignore-regexp)*'{-I,--ignore-regexp=}':expression to ignore' \ '(-k --keep-tmpdir)'{-k,--keep-tmpdir} \ '(-l --log-file)'{-l,--logfile=}':log file:_files' \ '(-m --mirror)'{-m,--mirror=}':Debian mirror:_urls' \ '(-n --no-ignores)'{-n,--no-ignores} \ '(-p --pbuilder)'{-p,--pbuilder}'[use /var/cache/pbuilder/base.tgz]' \ '(-s --save)'{-s,--save=}':target tarball:_files' \ '(-t --tmpdir)'{-t,--tmpdir=}':temp dir:_files -/' \ '-V[version]' \ '*:package:->packages' && return 0 case "$state" in (packages) if (( $+opt_args[-a] )); then _deb_packages avail else _files -g '*.deb' fi ;; esac PK[zZUfunctions/forward-word-matchnuW+Aemulate -L zsh setopt extendedglob autoload -Uz match-words-by-style local curcontext=":zle:$WIDGET" word local -a matched_words integer count=${NUMERIC:-1} if (( count < 0 )); then (( NUMERIC = -count )) zle ${WIDGET/forward/backward} return fi while (( count-- )); do match-words-by-style # For some reason forward-word doesn't work like the other word # commands; it skips whitespace only after any matched word # characters. if [[ -n $matched_words[4] ]]; then # just skip the whitespace word=$matched_words[4] else # skip the word and trailing whitespace word=$matched_words[5]$matched_words[6] fi if [[ -n $word ]]; then (( CURSOR += ${#word} )) else return 1 fi done return 0 PK[7ALLfunctions/_email_addressesnuW+A#autoload # options: # # -n plugin - can complete nicknames from specified plugin # -s sep - complete a list of addresses separated by specified character # -c - e-mail address must be of form user@host (no comments or aliases) # # Plugins are written as separate functions with names starting `_email-'. # They should either do their own completion or return the addresses in the # reply array in the form 'alias:address' and return 300. The -c option is # passed on to plugins (and -n could be if needed ever). New plugins will be # picked up and run automatically. # plugins (( $+functions[_email-mail] )) || _email-mail() { local rc rcfiles i rcfiles=( $files[$plugin] ) for ((i=1;i<=$#rcfiles;i++)); do rcfiles+=( ${~${(M)${(f)"$(<$rcfiles[i])"}:#source*}##source[[:blank:]]##}(N) ) done reply=() for rc in $rcfiles; do reply+=( ${${${(M)${(f)"$(<$rc)"}:#alias*}##alias[[:blank:]]##}/[[:blank:]]##/:} ) done return 300 } (( $+functions[_email-mutt] )) || _email-mutt() { _email-mail } (( $+functions[_email-mush] )) || _email-mush() { _email-mail } (( $+functions[_email-MH] )) || _email-MH() { reply=( ${${(f)"$(_call_program aliases ali 2>/dev/null)"}/: /:} ) return 300 } (( $+functions[_email-pine] )) || _email-pine() { reply=( ${${${${${(f)"$(<~/.addressbook)"}:#*DELETED*}:#\ *}/ [^ ]# /:}%% *} ) return 300 } (( $+functions[_email-ldap] )) || _email-ldap() { local -a expl ali res filter local -A opts local dn cn mail zparseopts -D -E -A opts c zstyle -a ":completion:${curcontext}:$curtag" filter filter (( $#filter )) || return filter=( "("${filter}"=${PREFIX}*${SUFFIX})" ) (( $#filter > 1 )) && filter="(|"${(j..)filter}")" res=( ${(f)"$(_call_program $curtag ldapsearch -LLL \$filter cn mail 2>/dev/null)"} ) (( $#res > 1 )) || return for dn cn mail in "${res[@]}"; do if (( $+opts[-c] )); then ali+=( "${mail#*: }" ) else cn="${cn#*: }" [[ $cn = *$~__specials* ]] && cn="\"$cn\"" ali+=( "$cn <${mail#*: }>" ) fi done compstate[insert]=menu _wanted email-ldap expl 'matching names' \ compadd -U -i "$IPREFIX" -I "$ISUFFIX" "$@" -a - ali } (( $+functions[_email-local] )) || _email-local() { local suf opts zparseopts -D -E -A opts c S:=suf if compset -P '*@'; then _hosts "$@" "$suf[@]" else suf=() compset -S '@*' || suf=( -qS @ ) _users "$suf[@]" "$@" fi } _email_addresses() { local -a plugins reply list args local -A opts files local plugin rcfile muttrc expl ret fret local __specialx='][()<>@,;:\\".' local __spacex=" " # Space, tab local __specials="[$__specialx]" local __atom="[^$__specialx$__spacex]##" local __space="[$__spacex]#" # Really, space or comment local __qtext='[^"\\]' local __qpair='\\?' local __beginq='"' local __endq='(|[^\\])"' local __dot="$__space.$__space" local __domainref="$__atom" local __domainlit='\[([^]]|'"$__qpair"')#(|[^\\])\]' local __quotedstring="$__beginq($__qtext|$__qpair)#$__endq" local __word="($__atom|$__quotedstring)" local __phrase="($__space$__word$__space)#" # Strictly, should use `##' local __localpart="$__word($__dot$__word)#" local __subdomain="($__domainref|$__domainlit)" local __domain="$__subdomain($__dot$__subdomain)#" local __addrspec="$__localpart$__space@$__space$__domain" local __addresses="($__qtext|$__quotedstring)##" zparseopts -D -E -A opts n: s: c set -- "$@" -M 'r:|[.@]=* r:|=* m:{a-zA-Z}={A-Za-z}' if [[ -n $opts[-s] ]]; then # remove up to the last unquoted separator if [[ ${(Q)PREFIX} = (#b)($~__addresses$opts[-s])* ]]; then IFS="$opts[-s]" eval 'compset -P $(( ${#${=${:-x${match[1]}x}}} - 1 )) "*${opts[-s]}"' fi # for the suffix, I'm too lazy to work out how to preserve quoted separators compset -S "$opts[-s]*" || set -- -q -S "$opts[-s]" "$@" fi # get list of all plugins except any with missing config files if ! zstyle -s ":completion:${curcontext}:email-addresses" muttrc muttrc; then [[ -e ~/mutt/muttrc ]] && muttrc="~/mutt/muttrc" || muttrc="~/.muttrc" fi files=( MH ${MH:-~/.mh_profile} mutt $~muttrc mush ~/.mushrc mail ${MAILRC:-~/.mailrc} pine ~/.addressbook ) plugins=( ${${(k)functions[(I)_email-*]#*-}:#(${(kj.|.)~files})} $files(Ne:'REPLY=( ${(k)files[(r)$REPLY]} ):') ) ret=1 _tags email-$plugins while _tags; do for plugin in $plugins; do if _requested email-$plugin; then while _next_label email-$plugin expl 'email address'; do args=() if (( $+opts[-c] )) || zstyle -t \ ":completion:${curcontext}:$curtag" strip-comments then args=( '-c' ) fi if ! _call_function fret _email-$plugin "$@" $args; then _message "$plugin: plugin not found" continue fi ret=$(( ret && fret )) if (( fret == 300 )); then if (( ! $+opts[-c] )) && [[ $opts[-n] = $plugin ]]; then zformat -a list ' -- ' "${reply[@]}" _wanted mail-aliases expl 'alias' compadd "$@" \ -d list - ${reply%%:*} && ret=0 else if (( $#args )); then reply=( ${(SM)${reply#*:}##$~__addrspec} ) else # remove lines not containing `@' as they probably aren't addresses reply=( "${(@)${(M@)reply:#*@*}#*:}" ) fi compadd -a "$@" "$expl[@]" reply && ret=0 fi fi done fi done (( ret )) || return 0 done return 1 } _email_addresses "$@" PK[)Ǘfunctions/_looknuW+A#compdef look local curcontext="$curcontext" state line expl ret=1 typeset -A opt_args _arguments -C -s \ '-t+[termination character]:termination character:' \ '-f[case insensitive]' \ '-d[dictionary order]' \ ':string:->string' \ ':dictionary file:_files' && ret=0 [[ -n "$state" && ! -prefix - ]] && _wanted values expl 'word prefix' \ compadd - $(_call_program words $words[1] '"$PREFIX"' 2>/dev/null) && return return ret PK[t^functions/_ctags_tagsnuW+A#autoload local expl tags [[ -r tags ]] && tags=( ${${${(f)"$(< tags)"}:#!*}%%[[:blank:]]*} ) _wanted ctags expl 'tag' compadd -M 'm:{a-zA-Z}={A-Za-z}' -a "$@" - tags PK[Hqeqefunctions/_path_filesnuW+A#autoload local -a match mbegin mend # Look for glob qualifiers. Do this first: if we're really # in a glob qualifier, we don't actually want to expand # the earlier part of the path. We can't expand inside # parentheses otherwise, so as we test that successfully # we should be able to commit to glob qualifiers here. # # Extra nastiness to be careful about a quoted parenthesis. # The initial tests look for parentheses with zero or an # even number of backslashes in front. We also require that # there was at least one character before the parenthesis for # a bare glob qualifier. # The later test looks for an outstanding quote. if _have_glob_qual $PREFIX; then compset -p ${#match[1]} if [[ -o extendedglob ]] && compset -P '\#'; then _globflags else _globquals fi return fi # Utility function for in-path completion. This allows `/u/l/b' # to complete to `/usr/local/bin'. local linepath realpath donepath prepath testpath exppath skips skipped local tmp1 tmp2 tmp3 tmp4 i orig eorig pre suf tpre tsuf opre osuf cpre local pats haspats ignore pfx pfxsfx sopt gopt opt sdirs ignpar cfopt listsfx local nm=$compstate[nmatches] menu matcher mopts sort mid accex fake local listfiles listopts tmpdisp origtmp1 Uopt local accept_exact_dirs path_completion integer npathcheck local -a Mopts typeset -U prepaths exppaths exppaths=() # Get the options. zparseopts -a mopts \ 'P:=pfx' 'S:=pfxsfx' 'q=pfxsfx' 'r:=pfxsfx' 'R:=pfxsfx' \ 'W:=prepaths' 'F:=ignore' 'M+:=matcher' \ J+: V+: X+: 1 2 n 'f=tmp1' '/=tmp1' 'g+:-=tmp1' sopt="-${(@j::M)${(@)tmp1#-}#?}" (( $tmp1[(I)-[/g]*] )) && haspats=yes (( $tmp1[(I)-g*] )) && gopt=yes if (( $tmp1[(I)-/] )); then pats="${(@)${(@M)tmp1:#-g*}#-g}" pats=( '*(-/)' ${${(z):-x $pats}[2,-1]} ) else pats="${(@)${(@M)tmp1:#-g*}#-g}" pats=( ${${(z):-x $pats}[2,-1]} ) fi pats=( "${(@)pats:# #}" ) if (( $#pfx )); then compset -P "$pfx[2]" || pfxsfx=( "$pfx[@]" "$pfxsfx[@]" ) fi if (( $#prepaths )); then tmp1="${prepaths[2]}" if [[ "$tmp1[1]" = '(' ]]; then prepaths=( ${^=tmp1[2,-2]%/}/ ) elif [[ "$tmp1[1]" = '/' ]]; then prepaths=( "${tmp1%/}/" ) else prepaths=( ${(P)^tmp1%/}/ ) (( ! $#prepaths )) && prepaths=( ${tmp1%/}/ ) fi (( ! $#prepaths )) && prepaths=( '' ) else prepaths=( '' ) fi if (( $#ignore )); then if [[ "${ignore[2]}" = \(* ]]; then ignore=( ${=ignore[2][2,-2]} ) else ignore=( ${(P)ignore[2]} ) fi fi # If we were given no file selection option, we behave as if we were given # a `-f'. if [[ "$sopt" = -(f|) ]]; then if [[ -z "$gopt" ]]; then sopt='-f' pats=('*') else unset sopt fi fi if (( ! $mopts[(I)-[JVX]] )); then local expl if [[ -z "$gopt" && "$sopt" = -/ ]]; then _description directories expl directory else _description files expl file fi tmp1=$expl[(I)-M*] if (( tmp1 )); then if (( $#matcher )); then matcher[2]="$matcher[2] $expl[1+tmp1]" else matcher=(-M "$expl[1+tmp1]") fi fi mopts=( "$mopts[@]" "$expl[@]" ) fi # If given no `-F' option, we may want to use $fignore, turned into patterns. [[ -z "$_comp_no_ignore" && $#ignore -eq 0 && ( -z $gopt || "$pats" = \ #\*\ # ) && -n $FIGNORE ]] && ignore=( "?*${^fignore[@]}" ) if (( $#ignore )); then _comp_ignore=( "$_comp_ignore[@]" "$ignore[@]" ) (( $mopts[(I)-F] )) || mopts=( "$mopts[@]" -F _comp_ignore ) fi if [[ $#matcher -eq 0 && -o nocaseglob ]]; then # If globbing is case insensitive and there's no matcher, # do case-insensitive matching. matcher=( -M 'm:{a-zA-Z}={A-Za-z}' ) fi if (( $#matcher )); then # Add the current matcher to the options to compadd. mopts=( "$mopts[@]" "$matcher[@]" ) fi if zstyle -s ":completion:${curcontext}:" file-sort tmp1; then case "$tmp1" in *size*) sort=oL;; *links*) sort=ol;; *(time|date|modi)*) sort=om;; *access*) sort=oa;; *(inode|change)*) sort=oc;; *) sort=on;; esac [[ "$tmp1" = *rev* ]] && sort[1]=O [[ "$tmp1" = *follow* ]] && sort="-${sort}-" if [[ "$sort" = on ]]; then sort= else mopts=( "${(@)mopts/#-J/-V}" ) tmp2=() for tmp1 in "$pats[@]"; do if _have_glob_qual "$tmp1" complete; then # unbalanced parenthesis is correct: match[1] contains the start, # match[5] doesn't contain the end. tmp2+=( "${match[1]}#q${sort})(${match[5]})" ) else tmp2+=( "${tmp1}(${sort})" ) fi done pats=( "$tmp2[@]" ) fi fi # Check if we have to skip over sequences of slashes. The value of $skips # is used below to match the pathname components we always have to accept # immediately. if zstyle -t ":completion:${curcontext}:paths" squeeze-slashes; then skips='((.|..|)/)##' else skips='((.|..)/)##' fi zstyle -s ":completion:${curcontext}:paths" special-dirs sdirs zstyle -t ":completion:${curcontext}:paths" list-suffixes && listsfx=yes [[ "$pats" = ((|*[[:blank:]])\*(|[[:blank:]]*|\([^[:blank:]]##\))|*\([^[:blank:]]#/[^[:blank:]]#\)*) ]] && sopt=$sopt/ zstyle -a ":completion:${curcontext}:paths" accept-exact accex zstyle -a ":completion:${curcontext}:" fake-files fake zstyle -s ":completion:${curcontext}:" ignore-parents ignpar zstyle -t ":completion:${curcontext}:paths" accept-exact-dirs && accept_exact_dirs=1 zstyle -T ":completion:${curcontext}:paths" path-completion && path_completion=1 if [[ -n "$compstate[pattern_match]" ]]; then if { [[ -z "$SUFFIX" ]] && _have_glob_qual "$PREFIX" complete } || _have_glob_qual "$SUFFIX" complete; then # Copy all glob qualifiers from the line to # the patterns used when generating matches tmp3=${match[5]} if [[ -n "$SUFFIX" ]]; then SUFFIX=${match[2]} else PREFIX=${match[2]} fi tmp2=() for tmp1 in "$pats[@]"; do if _have_glob_qual "$tmp1" complete; then # unbalanced parenthesis is correct: match[1] contains the start, # match[5] doesn't contain the end. tmp2+=( "${match[1]}${tmp3}${match[5]})") else tmp2+=( "${tmp1}(${tmp3})" ) fi done pats=( "$tmp2[@]" ) fi fi # We get the prefix and the suffix from the line and save the whole # original string. Then we see if we will do menu completion. pre="$PREFIX" suf="$SUFFIX" opre="$PREFIX" osuf="$SUFFIX" orig="${PREFIX}${SUFFIX}" eorig="$orig" [[ $compstate[insert] = (*menu|[0-9]*) || -n "$_comp_correct" || ( -n "$compstate[pattern_match]" && "${orig#\~}" != (|*[^\\])[][*?#~^\|\<\>]* ) ]] && menu=yes if [[ -n "$_comp_correct" ]]; then cfopt=- Uopt=-U else Mopts=(-M "r:|/=* r:|=*") fi # Now let's have a closer look at the string to complete. if [[ "$pre" = [^][*?#^\|\<\>\\]#(\`[^\`]#\`|\$)*/* && "$compstate[quote]" != \' ]]; then # If there is a parameter expansion in the word from the line, we try # to complete the beast by expanding the prefix and completing anything # after the first slash after the parameter expansion. # This fails for things like `f/$foo/b/' where the first `f' is # meant as a partial path. linepath="${(M)pre##*\$[^/]##/}" function { # do not treat an unset parameter expansion as the empty string setopt localoptions nounset eval 'realpath=${(e)~linepath}' 2>/dev/null } [[ -z "$realpath" || "$realpath" = "$linepath" ]] && return 1 pre="${pre#${linepath}}" i='[^/]' i="${#linepath//$i}" orig="${orig[1,(in:i:)/][1,-2]}" donepath= prepaths=( '' ) elif [[ "$pre[1]" = \~ && -z "$compstate[quote]" ]]; then # It begins with `~', so remember anything before the first slash to be able # to report it to the completion code. Also get an expanded version of it # (in `realpath'), so that we can generate the matches. Then remove that # prefix from the string to complete, set `donepath' to build the correct # paths and make sure that the loop below is run only once with an empty # prefix path by setting `prepaths'. linepath="${pre[2,-1]%%/*}" if [[ -z "$linepath" ]]; then realpath="${HOME%/}/" elif [[ "$linepath" = ([-+]|)[0-9]## ]]; then if [[ "$linepath" != [-+]* ]]; then tmp1="$linepath" else if [[ "$linepath" = -* ]]; then tmp1=$(( $#dirstack $linepath )) else tmp1=$linepath[2,-1] fi [[ -o pushdminus ]] && tmp1=$(( $#dirstack - $tmp1 )) fi if (( ! tmp1 )); then realpath=$PWD/ elif [[ tmp1 -le $#dirstack ]]; then realpath=$dirstack[tmp1]/ else _message 'not enough directory stack entries' return 1 fi elif [[ "$linepath" = [-+] ]]; then realpath=${~:-\~$linepath}/ else eval "realpath=~${linepath}/" 2>/dev/null if [[ -z "$realpath" ]]; then _message "unknown user \`$linepath'" return 1 fi fi linepath="~${linepath}/" [[ "$realpath" = "$linepath" ]] && return 1 pre="${pre#*/}" orig="${orig#*/}" donepath= prepaths=( '' ) else # If the string does not start with a `~' we don't remove a prefix from the # string. linepath= realpath= if zstyle -s ":completion:${curcontext}:" preserve-prefix tmp1 && [[ -n "$tmp1" && "$pre" = (#b)(${~tmp1})* ]]; then pre="$pre[${#match[1]}+1,-1]" orig="$orig[${#match[1]}+1,-1]" donepath="$match[1]" prepaths=( '' ) elif [[ "$pre[1]" = / ]]; then # If it is a absolute path name, we remove the first slash and put it in # `donepath' meaning that we treat it as the path that was already handled. # Also, we don't use the paths from `-W'. pre="$pre[2,-1]" orig="$orig[2,-1]" donepath='/' prepaths=( '' ) else # The common case, we just use the string as it is, unless it begins with # `./' or `../' in which case we don't use the paths from `-W'. [[ "$pre" = (.|..)/* ]] && prepaths=( '' ) donepath= fi fi # Now we generate the matches. First we loop over all prefix paths given # with the `-W' option. for prepath in "$prepaths[@]"; do # Get local copies of the prefix, suffix, and the prefix path to use # in the following loop, which walks through the pathname components # in the string from the line. skipped= cpre= if [[ ( -n $accept_exact_dirs || -z $path_completion ) && \ ${pre} = (#b)(*)/([^/]#) ]]; then # We've been told either that we can accept an exact directory prefix # immediately, or that path expansion is inhibited. Try the longest # path prefix first: in the first case, this saves stats in the simple # case and may get around automount behaviour if early components don't # yet exist, and in the second case this is the prefix we want to keep. # # Explanation of substitution: For tmp1 and tpre, which are used further # on, we need to remove quotes from everything that's not a pattern # character, because the code that does the file generation only # strips quotes from pattern characters (you know better than # to ask why). Because we need to test for a real directory, # however, for tmp2 we unquote everything. tmp1=${match[1]} tpre=${match[2]} tmp2=${(Q)tmp1} tmp1=${tmp1//(#b)\\(?)/$match[1]} tpre=${tpre//(#b)\\([^\\\]\[\^\~\(\)\#\*\?])/$match[1]} # Theory: donepath needs the quoting of special characters # still in it. However, we need it without at this point. # (I think.) Note this is different from the above where we're # doing something a bit different. tmp3=${donepath//(#b)\\(?)/$match[1]} while true; do if [[ -z $path_completion || -d $prepath$realpath$tmp3$tmp2 ]]; then tmp3=$tmp3$tmp1/ # Now put donepath back the way it should be. (I think.) donepath=${tmp3//(#b)([\\\]\[\^\~\(\)\#\*\?])/\\$match[1]} pre=$tpre break elif [[ $tmp1 = (#b)(*)/([^/]#) ]]; then tmp1=$match[1] tpre=$match[2]/$tpre else break fi done fi tpre="$pre" tsuf="$suf" # Now we strip quoting from pattern characters, too, because # testpath is used as a literal string. I suppose we could # alternatively use ${~testpath} later. # # I'm not sure if donepath itself should be entirely unquoted at # some point but probably not here, since we need the quoted pattern # characters in tmp1 below (I think). testpath="${donepath//(#b)\\([\\\]\[\^\~\(\)\#\*\?])/$match[1]}" tmp2="${(M)tpre##${~skips}}" tpre="${tpre#$tmp2}" tmp1=( "$prepath$realpath$donepath$tmp2" ) # count of attemps for pws non-canonical hack (( npathcheck = 0 )) while true; do origtmp1=("${tmp1[@]}") # Get the prefix and suffix for matching. if [[ "$tpre" = */* ]]; then PREFIX="${tpre%%/*}" SUFFIX= else PREFIX="${tpre}" SUFFIX="${tsuf%%/*}" fi # Force auto-mounting. There might be a better way... # Commented out in the hope that `pws non-canonical hack' # down below does this for us. Can be uncommented if it # doesn't. # : ${^tmp1}/${PREFIX}${SUFFIX}/.(/) # Get the matching files by globbing. tmp2=( "$tmp1[@]" ) if [[ "$tpre$tsuf" = */* ]]; then compfiles -P$cfopt tmp1 accex "$skipped" "$_matcher $matcher[2]" "$sdirs" fake elif [[ "$sopt" = *[/f]* ]]; then compfiles -p$cfopt tmp1 accex "$skipped" "$_matcher $matcher[2]" "$sdirs" fake "$pats[@]" else compfiles -p$cfopt tmp1 accex "$skipped" "$_matcher $matcher[2]" '' fake "$pats[@]" fi tmp1=( $~tmp1 ) 2> /dev/null if [[ -n "$PREFIX$SUFFIX" ]]; then # See which of them match what's on the line. # pws non-canonical hack which seems to work so far... # if we didn't match by globbing, check that there is # something to match by explicit name. This is for # `clever' filing systems where names pop into existence # when referenced. # # As suggested by Bart, to make sure the "compfiles" checks # still work we repeat the tests above if we successfully # find something that might need adding, but we make sure # we only do this once for completion of each path segment. if (( ! $#tmp1 && npathcheck == 0 )); then (( npathcheck = 1 )) for tmp3 in "$tmp2[@]"; do if [[ -n $tmp3 && $tmp3 != */ ]]; then tmp3+=/ fi if [[ -e "$tmp3${(Q)PREFIX}${(Q)SUFFIX}" ]] then (( npathcheck = 2 )) fi done if (( npathcheck == 2 )); then # repeat loop with same arguments tmp1=("$origtmp1[@]") continue fi fi if (( ! $#tmp1 )); then tmp2=( ${^${tmp2:#/}}/$PREFIX$SUFFIX ) elif [[ "$tmp1[1]" = */* ]]; then if [[ -n "$_comp_correct" ]]; then tmp2=( "$tmp1[@]" ) builtin compadd -D tmp1 "$matcher[@]" - "${(@)tmp1:t}" if [[ $#tmp1 -eq 0 ]]; then tmp1=( "$tmp2[@]" ) compadd -D tmp1 "$matcher[@]" - "${(@)tmp2:t}" fi else tmp2=( "$tmp1[@]" ) compadd -D tmp1 "$matcher[@]" - "${(@)tmp1:t}" fi else tmp2=( '' ) compadd -D tmp1 "$matcher[@]" -a tmp1 fi # If no file matches, save the expanded path and continue with # the outer loop. if (( ! $#tmp1 )); then if [[ "$tmp2[1]" = */* ]]; then tmp2=( "${(@)tmp2#${prepath}${realpath}}" ) if [[ "$tmp2[1]" = */* ]]; then tmp2=( "${(@)tmp2:h}" ) compquote tmp2 if [[ "$tmp2" = */ ]]; then exppaths=( "$exppaths[@]" ${^tmp2}${tpre}${tsuf} ) else exppaths=( "$exppaths[@]" ${^tmp2}/${tpre}${tsuf} ) fi elif [[ ${tpre}${tsuf} = */* ]]; then exppaths=( "$exppaths[@]" ${tpre}${tsuf} ) ### this once was in an `else' (not `elif') fi fi continue 2 fi elif (( ! $#tmp1 )); then # A little extra hack: if we were completing `foo/' and `foo' # contains no files, this will normally produce no matches and other # completers might think that's it's their time now. But if the next # completer is _correct or something like that, this will result in # an attempt to correct a valid directory name. So we just add the # original string in such a case so that the command line doesn't # change but other completers still think there are matches. # We do this only if we weren't given a `-g' or `-/' option because # otherwise this would keep `_files' from completing all filenames # if none of the patterns match. if [[ -z "$tpre$tsuf" && -n "$pre$suf" ]]; then pfxsfx=(-S '' "$pfxsfx[@]") ### Don't remember what the break was good for. We explicitly ### execute this only when there are no matches in the directory, ### so why continue? ### ### tmp1=( "$tmp2[@]" ) ### break elif [[ -n "$haspats" && -z "$tpre$tsuf$suf" && "$pre" = */ ]]; then PREFIX="${opre}" SUFFIX="${osuf}" compadd -nQS '' - "$linepath$donepath$orig" tmp4=- fi continue 2 fi if [[ -n "$ignpar" && -z "$_comp_no_ignore" && "$tpre$tsuf" != */* && $#tmp1 -ne 0 && ( "$ignpar" != *dir* || "$pats" = '*(-/)' ) && ( "$ignpar" != *..* || "$tmp1[1]" = *../* ) ]]; then compfiles -i tmp1 _comp_ignore "$ignpar" "$prepath$realpath$donepath" (( $#_comp_ignore && $mopts[(I)-F] )) || mopts=( "$mopts[@]" -F _comp_ignore ) fi # Step over to the next component, if any. if [[ "$tpre" = */* ]]; then tpre="${tpre#*/}" elif [[ "$tsuf" = */* ]]; then tpre="${tsuf#*/}" tsuf= else break fi # There are more components, so skip over the next components and make a # slash be added. tmp1=( ${tmp1//(#b)([][()|*?^#~<>\\=])/\\${match[1]}} ) tmp2="${(M)tpre##((.|..|)/)##}" if [[ -n "$tmp2" ]]; then skipped="/$tmp2" tpre="${tpre#$tmp2}" else skipped=/ fi (( npathcheck = 0 )) done # The next loop searches the first ambiguous component. tmp3="$pre$suf" tpre="$pre" tsuf="$suf" [[ -n "${prepath}${realpath}${testpath}" ]] && tmp1=( "${(@)tmp1#${prepath}${realpath}${testpath}}" ) while true; do # First we check if some of the files match the original string # for this component. If there are some we remove all other # names. This avoids having `foo' complete to `foo' and `foobar'. # The return value is non-zero if the component is ambiguous. compfiles -r tmp1 "${(Q)tmp3}" tmp4=$? if [[ "$tpre" = */* ]]; then tmp2="${cpre}${tpre%%/*}" PREFIX="${linepath}${donepath}${tmp2}" SUFFIX="/${tpre#*/}${tsuf#*/}" else tmp2="${cpre}${tpre}" PREFIX="${linepath}${donepath}${tmp2}" SUFFIX="${tsuf}" fi # This once tested `|| [[ -n "$compstate[pattern_match]" && # "$tmp2" = (|*[^\\])[][*?#~^\|\<\>]* ]]' but it should now be smart # enough to handle multiple components with patterns. if (( tmp4 )); then # It is. For menu completion we now add the possible completions # for this component with the unambiguous prefix we have built # and the rest of the string from the line as the suffix. # For normal completion we add the rests of the filenames # collected as the suffixes to make the completion code expand # it as far as possible. tmp2="$testpath" if [[ -n "$linepath" ]]; then compquote -p tmp2 tmp1 elif [[ -n "$tmp2" ]]; then compquote -p tmp1 compquote tmp2 else compquote tmp1 tmp2 fi if [[ -z "$_comp_correct" && "$compstate[pattern_match]" = \* && -n "$listsfx" && "$tmp2" = (|*[^\\])[][*?#~^\|\<\>]* ]]; then PREFIX="$opre" SUFFIX="$osuf" fi # This once tested `-n $menu ||' but our menu-completion expert says # that's not what we want. if [[ -z "$compstate[insert]" ]] || { ! zstyle -t ":completion:${curcontext}:paths" expand suffix && [[ -z "$listsfx" && ( -n "$_comp_correct" || -z "$compstate[pattern_match]" || "$SUFFIX" != */* || "${SUFFIX#*/}" = (|*[^\\])[][*?#~^\|\<\>]* ) ]] }; then # We have not been told to insert the match, so we are # listing, or something. (( tmp4 )) && zstyle -t ":completion:${curcontext}:paths" ambiguous && compstate[to_end]= if [[ "$tmp3" = */* ]]; then if [[ -z "$listsfx" || "$tmp3" != */?* ]]; then # I think this means we are expanding some directory # back up the path. tmp1=("${(@)tmp1%%/*}") _list_files tmp1 "$prepath$realpath$testpath" compadd $Uopt -Qf "$mopts[@]" \ -p "${Uopt:+$IPREFIX}$linepath$tmp2" \ -s "/${tmp3#*/}${Uopt:+$ISUFFIX}" \ -W "$prepath$realpath$testpath" \ "$pfxsfx[@]" $Mopts \ $listopts \ -a tmp1 else # Same with a non-empty suffix tmp1=("${(@)^tmp1%%/*}/${tmp3#*/}") _list_files tmp1 "$prepath$realpath$testpath" compadd $Uopt -Qf "$mopts[@]" \ -p "${Uopt:+$IPREFIX}$linepath$tmp2" \ -s "${Uopt:+$ISUFFIX}" \ -W "$prepath$realpath$testpath" \ "$pfxsfx[@]" $Mopts \ $listopts \ -a tmp1 fi else _list_files tmp1 "$prepath$realpath$testpath" compadd $Uopt -Qf "$mopts[@]" -p "${Uopt:+$IPREFIX}$linepath$tmp2" \ -s "${Uopt:+$ISUFFIX}" \ -W "$prepath$realpath$testpath" \ "$pfxsfx[@]" $Mopts \ $listopts \ -a tmp1 fi else # We are inserting the match into the command line. if [[ "$tmp3" = */* ]]; then tmp4=( $Uopt -Qf "$mopts[@]" -p "${Uopt:+$IPREFIX}$linepath$tmp2" -W "$prepath$realpath$testpath" "$pfxsfx[@]" $Mopts ) if [[ -z "$listsfx" ]]; then for i in "$tmp1[@]"; do tmpdisp=("$i") _list_files tmpdisp "$prepath$realpath$testpath" compadd "$tmp4[@]" -s "${Uopt:+$ISUFFIX}" $listopts - "$tmpdisp" done else [[ -n "$compstate[pattern_match]" ]] && SUFFIX="${SUFFIX:s./.*/}*" for i in "$tmp1[@]"; do _list_files i "$prepath$realpath$testpath" compadd "$tmp4[@]" $listopts - "$i" done fi else _list_files tmp1 "$prepath$realpath$testpath" compadd $Uopt -Qf "$mopts[@]" -p "${Uopt:+$IPREFIX}$linepath$tmp2" \ -s "${Uopt:+$ISUFFIX}" \ -W "$prepath$realpath$testpath" \ "$pfxsfx[@]" $Mopts \ $listopts \ -a tmp1 fi fi tmp4=- break fi # If we have checked all components, we stop now and add the # strings collected after the loop. if [[ "$tmp3" != */* ]]; then tmp4= break fi # Otherwise we add the unambiguous component to `testpath' and # take it from the filenames. testpath="${testpath}${tmp1[1]%%/*}/" tmp3="${tmp3#*/}" if [[ "$tpre" = */* ]]; then if [[ -z "$_comp_correct" && -n "$compstate[pattern_match]" && "$tmp2" = (|*[^\\])[][*?#~^\|\<\>]* ]]; then cpre="${cpre}${tmp1[1]%%/*}/" else cpre="${cpre}${tpre%%/*}/" fi tpre="${tpre#*/}" elif [[ "$tsuf" = */* ]]; then [[ "$tsuf" != /* ]] && mid="$testpath" if [[ -z "$_comp_correct" && -n "$compstate[pattern_match]" && "$tmp2" = (|*[^\\])[][*?#~^\|\<\>]* ]]; then cpre="${cpre}${tmp1[1]%%/*}/" else cpre="${cpre}${tpre}/" fi tpre="${tsuf#*/}" tsuf= else tpre= tsuf= fi tmp1=( "${(@)tmp1#*/}" ) done if [[ -z "$tmp4" ]]; then if [[ "$mid" = */ ]]; then PREFIX="${opre}" SUFFIX="${osuf}" tmp4="${testpath#${mid}}" tmp3="${mid%/*/}" tmp2="${${mid%/}##*/}" if [[ -n "$linepath" ]]; then compquote -p tmp3 else compquote tmp3 fi compquote tmp4 tmp2 tmp1 for i in "$tmp1[@]"; do _list_files tmp2 "$prepath$realpath${mid%/*/}" compadd $Uopt -Qf "$mopts[@]" -p "${Uopt:+$IPREFIX}$linepath$tmp3/" \ -s "/$tmp4$i${Uopt:+$ISUFFIX}" \ -W "$prepath$realpath${mid%/*/}/" \ "$pfxsfx[@]" $Mopts $listopts - "$tmp2" done else if [[ "$osuf" = */* ]]; then PREFIX="${opre}${osuf}" SUFFIX= else PREFIX="${opre}" SUFFIX="${osuf}" fi tmp4="$testpath" if [[ -n "$linepath" ]]; then compquote -p tmp4 tmp1 elif [[ -n "$tmp4" ]]; then compquote -p tmp1 compquote tmp4 else compquote tmp4 tmp1 fi if [[ -z "$_comp_correct" && -n "$compstate[pattern_match]" && "${PREFIX#\~}$SUFFIX" = (|*[^\\])[][*?#~^\|\<\>]* ]]; then tmp1=("$linepath$tmp4${(@)^tmp1}") _list_files tmp1 "$prepath$realpath" compadd -Qf -W "$prepath$realpath" "$pfxsfx[@]" "$mopts[@]" \ -M "r:|/=* r:|=*" $listopts -a tmp1 else # Not a pattern match _list_files tmp1 "$prepath$realpath$testpath" compadd $Uopt -Qf -p "${Uopt:+$IPREFIX}$linepath$tmp4" \ -s "${Uopt:+$ISUFFIX}" \ -W "$prepath$realpath$testpath" \ "$pfxsfx[@]" "$mopts[@]" $Mopts $listopts -a tmp1 fi fi fi done # If we are configured to expand paths as far as possible and we collected # expanded paths that are different from the string on the line, we add # them as possible matches. Do that only if we are currently trying the # last entry in the matcher-list style, otherwise other match specs might # make the suffix that didn't match this time match in one of the following # attempts. if [[ _matcher_num -eq ${#_matchers} ]] && zstyle -t ":completion:${curcontext}:paths" expand prefix && [[ nm -eq compstate[nmatches] && $#exppaths -ne 0 && "$linepath$exppaths" != "$eorig" ]]; then PREFIX="${opre}" SUFFIX="${osuf}" compadd -Q "$mopts[@]" -S '' -M "r:|/=* r:|=*" -p "$linepath" -a exppaths fi [[ nm -ne compstate[nmatches] ]] PK['26||functions/_flashernuW+A#compdef flasher _arguments \ '(--fiasco -F)'{--fiasco,-F}':location of a FIASCO image:_files' \ '(--kernel -k)'{--kernel,-k}':location of kernel image:_files' \ '(--initfs -n)'{--initfs,-n}':location of initfs image:_files' \ '(--rootfs -r)'{--rootfs,-r}':location of root JFFS2 image:_files' \ '(--xloader -x)'{--xloader,-x}':location of X-Loader image:_files' \ '(--secondary -s)'{--secondary,-s}':location of NOLO secondary bootloader image:_files' \ '(--2nd -2)'{--2nd,-2}':location of NOLO cold flasher ("2nd") image:_files' \ '(--unpack -u)'{--unpack,-u}'::unpack a FIASCO image:_files' \ '(--flash -f)'{--flash,-f}'[load and flash all supplied images]' \ '(--load -l)'{--load,-l}'[only load all supplied images]' \ '(--boot -b)'{--boot,-b}'::kernel cmdline' \ '(--reboot -R)'{--reboot,-R}'[reboot the board]' \ '(--read-board-id -i)'{--read-board-id,-i}'[print out the board type]' \ '(--serial-port -S)'{--serial-port,-S}':serial port used for cold flashing' \ '(--initialize-port -I)'{--initialize-port,-I}':something' \ '(--cold-flash -c)'{--cold-flash,-c}'[cold flash the device]' \ '--enable-rd-mode[enable R&D mode on the device]' \ '--disable-rd-mode[disable R&D mode on the device]' \ '--set-rd-flags::R&D mode flags to set' \ '--clear-rd-flags::R&D mode flags to clear' \ '--query-rd-mode[query the device R&D mode status and flags]' \ '--set-root-device:default root device' \ '--query-root-device[query the default root device]' \ '--enable-usb-host-mode[set the device into USB host mode]' \ '--disable-usb-host-mode[set the device into USB peripheral mode]' \ '--flash-only:components' PK[ yyfunctions/prompt_off_setupnuW+A# Very simple prompt prompt_off_setup () { PS1="%# " PS2="> " prompt_opts=( cr percent ) } prompt_off_setup "$@" PK[*{>>functions/_psutilsnuW+A#compdef epsffit extractres fixdlsrps fixfmps fixmacps fixpsditps fixpspps fixscribeps fixtpps fixwfwps fixwpps fixwwps includeres psbook psmerge psnup psresize psselect pstops getafm showchar case "$service" in epsffit) _arguments \ '-v[print version]' \ '-c[centres the image in the bounding box given]' \ '-r[rotates the image by 90 degrees anti-clockwise]' \ '-a[alters the aspect ratio to fit the bounding box]' \ '-s[adds a showpage at the end of the image]' \ '-m[rotates the image to maximise the size]' \ ':lower left x:' \ ':lower left y:' \ ':upper right x:' \ ':upper right y:' \ ':input file:_ps' \ ':output file:_ps' ;; psbook) _arguments \ '-q[quiet mode]' \ '-v[print version]' \ '-s-[signature size]:signature size:' \ ':input file:_ps' \ ':output file:_ps' ;; psnup) _arguments \ '-q[quiet mode]' \ '-v[print version]' \ '(-p)-w-[page width]:paper width:' \ '(-p)-h-[page height]:paper height:' \ '(-w -h)-p-[page size]:paper size:(a3 a4 a5 b5 letter legal 10x14)' \ '(-P)-W-[input page width]:input paper width:' \ '(-P)-H-[input page height]:input paper height:' \ '(-W -H)-P-[input page paper]:input paper paper:(a3 a4 a5 b5 letter legal 10x14)' \ '( -r -f)-l[landscape (rotated left)]' \ '(-l -f)-r[seascape (rotated right)]' \ '(-l -r )-f[flipped]' \ '-c[column major layout]' \ '-m-[margins around whole page]:margins around whole page:' \ '-b-[border around individual pages]:border around individual pages:' \ '-d-[draw borders]:line width for borders:' \ '-s-[override scale]:scale:' \ '( -4 -8 -n)-2[2 logical pages on a sheet]' \ '(-2 -8 -n)-4[4 logical pages on a sheet]' \ '(-2 -4 -n)-8[8 logical pages on a sheet]' \ '(-2 -4 -8 )-n[n-up]:pages on a sheet:' \ '-t-[layout tolerance]:layout tolerance:' \ ':input file:_ps' \ ':output file:_ps' ;; psresize) _arguments \ '-q[quiet mode]' \ '-v[print version]' \ '(-p)-w-[page width]:paper width:' \ '(-p)-h-[page height]:paper height:' \ '(-w -h)-p-[page size]:paper size:(a3 a4 a5 b5 letter legal 10x14)' \ '(-P)-W-[input page width]:input paper width:' \ '(-P)-H-[input page height]:input paper height:' \ '(-W -H)-P-[input page paper]:input paper paper:(a3 a4 a5 b5 letter legal 10x14)' \ ':input file:_ps' \ ':output file:_ps' ;; psselect) _arguments \ '-q[quiet mode]' \ '-v[print version]' \ '-e[select even pages]' \ '-o[select odd pages]' \ '-r[reverse order]' \ '-p-[pages]:pages:' \ ':input file:_ps' \ ':output file:_ps' ;; pstops) _arguments \ '-q[quiet mode]' \ '-v[print version]' \ '-d-[draw borders]:line width for borders:' \ '-b[no bind operator]' \ '(-p)-w-[page width]:paper width:' \ '(-p)-h-[page height]:paper height:' \ '(-w -h)-p-[page size]:paper size:(a3 a4 a5 b5 letter legal 10x14)' \ ':[modulo\:][-]pageno[L][R][U][@scale][(xoff,yoff)][+|,]...:' \ ':input file:_ps' \ ':output file:_ps' ;; extractres) _arguments \ '-m[merge]' \ ':input file:_ps' ;; fixmacps) _arguments \ '-d[directory]:directory:_files -/' \ '-n[name]:name:' \ ':input file:_ps' ;; psmerge) _arguments \ '-o-[output file]:output file:_ps' \ '-t[thorough]' \ '*:input file:_ps' ;; fixdlsrps|fixfmps|fixpsditps|fixpspps|fixscribeps|fixtpps|fixwfwps|fixwpps|fixwwps|includeres) _ps ;; getafm) _arguments \ ':font name:' ;; showchar) _arguments \ ':font name:' \ ':character name:' ;; esac PK[functions/_pydocnuW+A#compdef pydoc local context state line typeset -A opt_args _arguments \ '-k[keyword]:keyword:' \ '-p[port]:port:_ports' \ '-g[gui]' \ '-w[write out HTML]:file or dir:_files' \ ':keyword, topic, module, package, or dotted reference:->lookup' && return 0 _alternative \ 'keywords:keyword:compadd ${=${${(f)"$(pydoc keywords)"}[2,-1]}}' \ 'topics:topic:compadd ${=${${(f)"$(pydoc topics)"}[2,-1]}}' \ 'modules:module:' PK[q+functions/VCS_INFO_detect_gitnuW+A## vim:ft=zsh ## git support by: Frank Terbeck ## Distributed under the same BSD-ish license as zsh itself. setopt localoptions NO_shwordsplit [[ $1 == '--flavours' ]] && { print -l git-p4 git-svn; return 0 } if VCS_INFO_check_com ${vcs_comm[cmd]} && ${vcs_comm[cmd]} rev-parse --is-inside-work-tree &> /dev/null ; then vcs_comm[gitdir]="$(${vcs_comm[cmd]} rev-parse --git-dir 2> /dev/null)" || return 1 if [[ -d ${vcs_comm[gitdir]}/svn ]] ; then vcs_comm[overwrite_name]='git-svn' elif [[ -d ${vcs_comm[gitdir]}/refs/remotes/p4 ]] ; then vcs_comm[overwrite_name]='git-p4' ; fi return 0 fi return 1 PK[4"ggfunctions/_most_recent_filenuW+A#compdef -k complete-word \C-xm # Complete the most recently modified file matching the pattern on the line # so far: globbing is active, i.e. *.txt will be expanded to the most recent # file ending in .txt # # With a prefix argument, select the Nth most recent matching file; # negative arguments work in the opposite direction, so for example # `Esc - \C-x m' gets you the oldest file. local file tilde etilde if [[ $PREFIX = \~*/* ]]; then tilde=${PREFIX%%/*} etilde=${~tilde} # PREFIX and SUFFIX have full command line quoting in, but we want # any globbing characters which are quoted to stay quoted. eval "file=($PREFIX*$SUFFIX(om[${NUMERIC:-1}]N))" file=(${file/#$etilde}) file=($tilde${(q)^file}) else eval "file=($PREFIX*$SUFFIX(om[${NUMERIC:-1}]N))" file=(${(q)file}) fi (( $#file )) && compadd -U -i "$IPREFIX" -I "$ISUFFIX" -f -Q -- $file PK[;{WWfunctions/_volume_groupsnuW+A#autoload local expl _wanted volumegroups expl 'volume group' compadd "$@" - $(lsvg) PK[@qf&&functions/edit-command-linenuW+A# Edit the command line using your usual editor. # Binding this to 'v' in the vi command mode map, # autoload -Uz edit-command-line # zle -N edit-command-line # bindkey -M vicmd v edit-command-line # will give ksh-like behaviour for that key, # except that it will handle multi-line buffers properly. local tmpfile=${TMPPREFIX:-/tmp/zsh}ecl$$ print -R - "$PREBUFFER$BUFFER" >$tmpfile exec 0 )); then local i for i in "$@"; do case "$i" in -i) packages+=(${${(M)_fink_pkgs:#?i?*}#* }) ;; -o) packages+=(${${(M)_fink_pkgs:#(i)*}#* }) ;; -n) packages+=(${${(M)_fink_pkgs:# n *}#* }) ;; esac done else packages=(${_fink_pkgs#* }) fi } _fink_get_packages_without_cache(){ local expl packages=(${(f)"$( command fink list -t "$@" "$PREFIX" \ | command grep -v '\[virtual package\]' \ | command cut -f2 )"}) } _fink_get_packages(){ # variable packages will be set if zstyle -t ":completion:${curcontext}:" use-cache; then _fink_get_packages_with_cache "$@" else _fink_get_packages_without_cache "$@" fi } _finkpkgs_caching_policy(){ local -a oldp oldp=( "$1"(Nmw+1) ) (( $#oldp )) || [[ /sw/var/cache/apt/pkgcache.bin -nt "$1" ]] || [[ /sw/var/lib/dpkg/available -nt "$1" ]] } _fink(){ local -a _1st_arguments _1st_arguments=( 'install:install or update packages' 'remove:remove packages' 'purge:remove packages and configuration files' 'update-all:update all installed packages to the latest version' 'list:search package name or conditions and list' 'apropos:search package descriptions or conditions and list' 'describe:display a description of the package' 'fetch:download package source files' 'fetch-all:downloads all package source files' 'fetch-missing:download all missing package source files' 'build:build .deb packages' 'rebuild:rebuild .deb packages' 'reinstall:reinstall packages' 'configure:rerun the fink configuration process' 'selfupdate:upgrade to a new fink release' 'validate:validate files' 'scanpackages:call dpkg-scanpackages' 'checksums:validate the MD5 digest of all tarballs' 'cleanup:removes obsolete package files' ) local context state line expl local -A opt_args _arguments \ '(-h --help)'{-h,--help}'[display help text]' \ '(-q --quiet)'{-q,--quiet}'[causes fink to be less verbose]' \ '(-V --version)'{-V,--version}'[display version information]' \ '(-v --verbose)'{-v,--verbose}'[causes fink to be more verbose]' \ '(-y --yes)'{-y,--yes}'[assume default answer for interactive questions]' \ '*:: :->subcmds' && return 0 if (( CURRENT == 1 )); then _describe -t commands "fink subcommand" _1st_arguments return fi local -a packages case "$words[1]" in install|update|enable|activate|use) _fink_get_packages -n -o _wanted packages expl 'not installed or outdated fink package' compadd -a packages ;; remove|disable|deactivate|unuse|delete|purge) _fink_get_packages -i _wanted packages expl 'installed package' compadd -a packages ;; #update-all) list) _arguments \ '(-t --tab)'{-t,--tab}'[outputs list with tabs as field delimiter]' \ '(-i --installed)'{-i,--installed}'[packages currently installed]' \ '(-u --uptodate)'{-u,--uptodate}'[packages up to date]' \ '(-o --outdate)'{-o,--outdated}'[packages newer version is available]' \ '(-n --notinstalled)'{-n,--notinstalled}'[packages not installed]' \ '(-b --buildonly)'{-b,--buildonly}'[packages Build Only Depends]' \ '(-s --section)'{-s=,--section=}'[sections]:section name' \ '(-m --maintainer)'{-m=,--maintainer=}'[maintainer]:maintainer name' \ --tree='[tree]:tree name' \ '(-w --width)'{-w=,--width=}'[width of display]:number or "auto"' \ '(1 : -)'{-h,--help}'[display help text]' \ '1: :->pkgs' && return 0 if [[ "$state" == pkgs ]]; then _fink_get_packages _wanted packages expl 'package name hint' compadd -a packages fi ;; apropos) _arguments \ '(-t --tab)'{-t,--tab}'[output the list with tabs as field delimiter]' \ '(-w --width)'{-w=,--width=}'[width of display]:number or "auto"' \ '(1 : -)'{-h,--help}'[display help text]' \ '1: :->pkgs' && return 0 if [[ "$state" == pkgs ]]; then _fink_get_packages _wanted packages expl 'package hint' compadd -a packages fi ;; describe|desc|description|info) _fink_get_packages _wanted packages expl 'package' compadd -a packages ;; #fetch) #fetch-all) fetch-missing) _arguments \ '(-i --ignore-restrictive)'{-i,--ignore-restrictive}'[do not fetch packages that are "License: Restrictive"]' ;; #build) rebuild|reinstall) _fink_get_packages _wanted packages expl 'package' compadd -a packages ;; #configure) #selfupdate) validate|check) _wanted files expl 'finkinfo file' _files -g \*.info ;; #scanpackages) #checksums) #cleanup) esac } _fink "$@" PK[  functions/_yastnuW+A#compdef yast yast2 _arguments \ '(- 1)'{-h,--help}'[display help information]' \ '(- 1)'{-l,--list}'[list all available modules]' \ '(-g --geometry)'{-g,--geometry}'[specify default window size]:_x_geometry' \ '(-s --style)'{-s,--style}'[specify widget style]:style:(qt)' \ '--noborder[no window manager border for main window]' \ '--fullscreen[use full screen]' \ '(-)'{-i,--install}'[install package]:*:package file:_files -g "*.rpm(-.)"' \ '1:module:( ${${(f)"$($words[1] -l 2>/dev/null)"}[2,-1]##* } )' PK[)9$$functions/_whereisnuW+A#compdef whereis _command_names -e PK[ɼfunctions/_sshfsnuW+A#compdef sshfs _arguments \ '-V[version]' \ '-p:tcp port:' \ '-C[compression]' \ '-o:options:_values -s , "sshfs or fuse or mount options" reconnect sshfs_sync no_readahead sshfs_debug cache=:cache\ setting:(yes no) cache_timeout=:seconds: cache_stat_timeout=:seconds: cache_dir_timeout=:seconds: cache_link_timeout=:seconds: ssh_command=:ssh\ command:_command_names directport=:port: SSHOPT=:ssh\ option: default_permissions allow_other allow_root kernel_cache large_read direct_io max_read=:size: hard_remove debug fs_name=:name: use_ino readdir_ino' \ '-d[debug]' \ '-f[foreground]' \ '-s[disable multithreaded operation]' \ '-r[mount read-only]' \ '-h[help]' \ ':remote directory:_user_at_host -S:' \ ':mountpoint:_files -/' PK[{functions/_envnuW+A#compdef env if _pick_variant gnu=Free\ Soft unix --version; then _arguments \ '(--ignore-environment -i)'{-i,--ignore-environment}'[start with empty environment]' \ '*'{-u,--unset=}'[remove variable from the environment]:env var to remove:compadd ${(k)parameters[(R)*export*]}' \ '--help[help]' \ '--version[version]' \ '(-):command: _command_names -e' \ '*::arguments: _normal' else _precommand fi PK[-""functions/_texinfonuW+A#compdef info tkinfo install-info makeinfo texi2dvi texindex local curcontext="$curcontext" state line ret=1 local -A opt_args local -a info case $service in info) info=( _call_program info ${words[1]} ) _arguments -C -s \ '(: -)--apropos=[look up string in indices]:search string: ' \ '(-f --file)'{\*-d,\*--directory=}'[add directory to infopath]:info dir:_files -/' \ '--dribble=[record keystrokes]:file with keystrokes:_files' \ '(-f --file -d --directory)'{-f,--file=}'[info file to show]:info file:_files -g "*.info(|.gz|.bz2)(-.)"' \ '(: - -h --help)'{-h,--help}'[display usage]' \ '(-o --output -O)--index-search=[go directly to node if found]:search string: ' \ '(--index-search -o --output -O)'{-o,--output=}'[dump selected nodes to filename]:filename:_files -g "*(-.)"' \ '(-R --raw-escapes)'{-R,--raw-escapes}'[do not remove ANSI escapes from man pages]' \ '--restore=[read keystrokes from file]:filename:_files -g "*(-.)"' \ '(--index-search -o --output -O --show-options --usage)'{-O,--show-options,--usage}'[go to command-line options node]' \ '--subnodes[recursively output menu items]' \ '--vi-keys[use Vi-like key bindings]' \ '(: -)--version[display version information]' \ '(--apropos -h --help -O --output --version)*::menu item:->item' && ret=0 info=( $info {(kv)opt_args[(I)(-d|--directory|-f|--file)]} ) ;; install-info) if _pick_variant debian=Debian gnu --version; then _arguments -S \ '(* -)--help[display help information]' \ '(* -)--version[display version information]' \ '(--maxwidth --align --calign)--remove[delete existing entries]' \ '(--maxwidth --align --calign)--remove-exactly[delete existing entries taking exact entry name]' \ '--section[specify section to add entry in]:regexp::title' \ '--infodir=[specify directory containing dir file]:info directory:_files -/' \ '--align=[specify minimum indentation for description]:indentation' \ '--calign=[specify minimum indentation for continuation lines of description]:indentation' \ '--maxwidth=[specify maximum width of dir file]:width' \ '--quiet[suppress informational output]' \ '--description=[specify description for menu entry]:description' \ '--menuentry=[specify the menu entry for dir file]:menu entry' \ '--keep-old=[inhibit replacement of existing entries/removal of empty sections]' \ '--test[do not update dir file]' \ '--debug[enable debugging]' \ '*:info file:_files -g "*.info(-.)"' return else _arguments \ '(--delete --remove)'{--delete,--remove}'[delete existing entries]' \ '(2)--dir-file=[specify dir file]:dir file:_files -g "dir(-.)"' \ \*{--entry,--info}'[specify directory entry to add]:text' \ '(- 1 2)--help[display help information]' \ '(1)--info-file=[specify info file to install in the directory]:info file:_files -g "*.info(-.)"' \ '(2)--info-dir=[specify directory containing dir file]:info directory:_files -/' \ '--quiet[suppress warnings]' \ '(--delete --remove)--section=[put new entries in specified section]' \ '(- 1 2)--version[display version information]' \ '1:info file:_files -g "*.info(-.)"' \ '2:dir file:_files -g "dir(-.)"' return fi ;; makeinfo) _arguments -s \ '--error-limit=[specify number of errors to quit after]:number' \ '--force[preserve output even if errors]' \ '(* -)--help[display help]' \ '--no-validate[suppress node cross-reference validation]' \ '--no-warn[suppress warnings]' \ '--reference-limit=[warn about at most specified number of references]:number' \ '(-v --verbose)'{-v,--verbose}'[explain what is being done]' \ '(* -)--version[display version info]' \ '(--html --xml)--docbook[output in DocBook format]' \ '(--docbook --xml)--html[output in HTML format]' \ '--no-headers[suppress node separators and menus]' \ '(--docbook --html)--xml[output in XML (TexinfoML) format]' \ '(-E --macro-expand)'{-E,--macro-expand}'[output macro-expanded source to specified file]:file:_files' \ '(--docbook --xml)--no-split[suppress splitting of output]' \ '--number-sections[output chapter and section numbers]' \ '(-o --output=)'{-o,--output}'[specify output file]:output file:_files' \ '(--docbook --html --xml)--enable-encoding[output special characters]' \ '(--docbook --html --xml)--fill-column=[specify width to break lines at]:width' \ '(--docbook --html --xml)--footnote-style=[specify style for output of footnotes]:((separate\:in\ own\ node end\:at\ end\ of\ node))' \ '(--docbook --html --xml)--paragraph-indent=[specify spaces to indent paragraphs by]' \ '(--docbook --html --xml)--split-size=[split Info files at specified size]:size' \ '--commands-in-node-names[allow @ commands in node names]' \ '-D[define variable]:variable' \ '-I[specify directory to append to @include search path]:directory:_files -/' \ '-P[specify directory to prepend to @include search path]:directory:_files -/' \ '-U[undefine variable]:variable' \ '(--html --no-ifhtml)--ifhtml[process @ifhtml and @html when not generating HTML]' \ '(--no-ifinfo)--ifinfo[process @ifinfo even when not generating Info]' \ '(--no-iftex)--iftex[process @iftex and @tex text]' \ '(--no-ifplaintext)--ifplaintext[process @ifplaintext even when not generating plain text]' \ '(--ifhtml)--no-ifhtml[do not process @ifhtml and @html text]' \ '(--ifinfo)--no-ifinfo[do not process @ifinfo text]' \ '(--ifplaintext)--no-ifplaintext[do not process @ifplaintext text]' \ '(--iftex)--no-iftex[do not process @iftex and @tex text]' \ '*:texinfo file:_texi' return ;; texi2dvi) _arguments -s \ '(-b --batch)'{-b,--batch}'[no interaction]' \ '(-c --clean)'{-c,--clean}'[remove all auxiliary files]' \ '(-D --debug)'{-D,--debug}'[turn on shell debugging (set -x)]' \ '(- *)'{-h,--help}'[display help information]' \ '(-o --output)'{-o,--output=}'[specify output file]:output file:_files' \ '(-q -s --quiet --silent -V --verbose)'{-q,-s,--silent,--quiet}'[no output except errors]' \ '(-q -s --quiet --silent -V --verbose)'{-V,--verbose}'[report on what is done]' \ '(- *)'{-v,--version}'[display version information]' \ '-@[use @input instead of \input; for preloaded Texinfo]' \ '(-e --expand)'{-e,--expand}'[force macro expansion using makeinfo]' \ '-I[specify search dir for texinfo files]:directory:_files -/' \ '(-l --language)'{-l,--language}'[specify language of input file]:language:(LaTeX Texinfo)' \ '(-p --pdf)'{-p,--pdf}'[use pdftex or pdflatex for processing]' \ \*{-t,--texinfo}'[specify command to insert after @setfilename]:command' \ '*:file:_texi' return ;; texindex) _arguments \ '(* -)--help[display help]' \ '(* -)--version[display version info]' \ '(--no-keep)--keep[keep temporary files around after processing]' \ '(--keep)--no-keep[do not keep temporary files (default)]' \ '(-o --output)'{-o,--output=}'[specify output file]:file:_files' \ '*:texinfo file:_texi' return ;; tkinfo) _x_arguments -C \ '-+'{headers,buttons,balloons,scrollthrough,pagesep,showdir} \ '-linklook:menu display:(color font underline)' \ '-highlight:link display:(color inverse underline)' \ '-searchlook:search match display:(color inverse underline)' \ '-iconic' \ '-dir:info path:_dir_list' \ '-file:info file:_files -g "*.info(|.gz|.bz2)(-.)"' \ '-node:info node:->item' \ '*::menu items:->item' && ret=0 info=( _call_program info info ${(kv)opt_args[(I)-file]/-file/-f} ) ;; esac case $state in item ) local -a items tags expl infopath (( $#INFOPATH )) && infopath=( -W ${s/:/INFOPATH} ) tags=(items) if [[ $CURRENT -eq 1 ]]; then tags+=files fi _tags $tags while _tags; do if _requested files expl 'info file'; then _files "$expl[@]" $infopath -g '*.info' && ret=0 fi if _requested items; then items=(${${(M)${${(f)"$(${info} --output - ${words[1,CURRENT-1]} 2>/dev/null)"}[1,(r)[[:space:]]#--- The Detailed Node Listing ---[[:space:]]#]}:#\* *~\* Menu:*}:/(#b)\*[[:space:]]##([^:]##):(#B)( \(?##\)[^.]#.|(:|))[[:space:]]#(#b)(*)[[:space:]]#/$match[1]${match[2]:+:}$match[2]}) _describe -t items "menu item" items && ret=0 fi done ;; esac return ret PK[uufunctions/capitalize-word-matchnuW+Aemulate -L zsh setopt extendedglob autoload match-words-by-style local curcontext=":zle:$WIDGET" word local -a matched_words integer count=${NUMERIC:-1} while (( count-- > 0 )); do match-words-by-style word=${(j..)matched_words[4,5]} if [[ -n $word ]]; then LBUFFER+=${(C)word} RBUFFER=${(j..)matched_words[6,7]} else return 1 fi done return 0 PK[T[{ { functions/_history_complete_wordnuW+A#compdef -K _history-complete-older complete-word \e/ _history-complete-newer complete-word \e, # # Complete words from the history # # by Adam Spiers, with help gratefully received from # Sven Wischnowsky and Bart Schaefer # # Available styles: # # list -- avoid to display lists of available matches # stop -- stop before looping at beginning and end of matches # sort -- sort matches lexically (default is to sort by age) # remove-all-dups -- # remove /all/ duplicate matches rather than just consecutives # range -- range of history words to complete _history_complete_word () { eval "$_comp_setup" local expl direction stop curcontext="$curcontext" if [[ -z "$curcontext" ]]; then curcontext=history-words::: else curcontext="history-words${curcontext#*:}" fi if [[ $WIDGET = *newer ]]; then direction=newer else direction=older fi zstyle -t ":completion:${curcontext}:history-words" stop && stop=yes zstyle -T ":completion:${curcontext}:history-words" list || compstate[list]='' if [[ $LASTWIDGET = _history-complete-* && ( -n "$compstate[old_list]" || -n $_hist_stop ) ]]; then if [[ "$direction" == older ]]; then if [[ $_hist_stop = new ]]; then PREFIX=$_hist_old_prefix _history_complete_word_gen_matches compstate[insert]=2 _hist_stop= elif [[ $_hist_stop = old ]]; then PREFIX=$_hist_old_prefix _history_complete_word_gen_matches compstate[insert]=1 _hist_stop= elif [[ compstate[old_insert] -lt _hist_menu_length ]]; then compstate[old_list]=keep (( compstate[insert] = compstate[old_insert] + 1 )) elif [[ -n $stop ]]; then _hist_stop=old _message 'beginning of history reached' return 1 else compstate[old_list]=keep compstate[insert]=1 fi elif [[ "$direction" == 'newer' ]]; then if [[ $_hist_stop = old ]]; then PREFIX=$_hist_old_prefix _history_complete_word_gen_matches compstate[insert]=$(( $compstate[nmatches] - 1 )) _hist_stop= elif [[ $_hist_stop = new ]]; then PREFIX=$_hist_old_prefix _history_complete_word_gen_matches compstate[insert]=$compstate[nmatches] _hist_stop= elif [[ compstate[old_insert] -gt 1 ]]; then compstate[old_list]=keep (( compstate[insert] = compstate[old_insert] - 1 )) elif [[ -n $stop ]]; then _hist_stop=new _message 'end of history reached' return 1 else compstate[old_list]=keep compstate[insert]=$_hist_menu_length fi fi return 0 else _hist_stop= _hist_old_prefix="$PREFIX" _history_complete_word_gen_matches fi (( $compstate[nmatches] )) } _history_complete_word_gen_matches () { [[ -n "$_hist_stop" ]] && PREFIX="$_hist_old_prefix" _main_complete _history zstyle -T ":completion:${curcontext}:history-words" list || compstate[list]= _hist_menu_length="$compstate[nmatches]" if [[ $_lastcomp[insert] != *unambig* ]]; then case "$direction" in newer) compstate[insert]=$_hist_menu_length [[ -n "$_hist_stop" ]] && (( compstate[insert]-- )) ;; older) compstate[insert]=1 [[ -n "$_hist_stop" ]] && (( compstate[insert]++ )) ;; esac fi _hist_stop= return } _history_complete_word "$@" PK[g functions/_paxnuW+A#compdef pax _arguments -s \ '-r[read]' \ '-w[write]' \ '-a[append]' \ '-b:block size:(512 1024 1536 2048 2560 3072 3584 4096 4608 5120 5632 6144 6656 7168 7680 8192 8704 9216 9728 10240 10752 11264 11776 12288 12800 13312 13824 14336 14848 15360 15872 16384 16896 17408 17920 18432 18944 19456 19968 20480 20992 21504 22016 22528 23040 23552 24064 24576 25088 25600 26112 26624 27136 27648 28160 28672 29184 29696 30208 30720 31232 31744 32256 32768 33280 33792 34304 34816 35328 35840 36352 36864 37376 37888 38400 38912 39424 39936 40448 40960 41472 41984 42496 43008 43520 44032 44544 45056 45568 46080 46592 47104 47616 48128 48640 49152 49664 50176 50688 51200 51712 52224 52736 53248 53760 54272 54784 55296 55808 56320 56832 57344 57856 58368 58880 59392 59904 60416 60928 61440 61952 62464 62976 63488 64000 64512 1k 2k 3k 4k 5k 6k 7k 8k 9k 10k 11k 12k 13k 14k 15k 16k 17k 18k 19k 20k 21k 22k 23k 24k 25k 26k 27k 28k 29k 30k 31k 32k 33k 34k 35k 36k 37k 38k 39k 40k 41k 42k 43k 44k 45k 46k 47k 48k 49k 50k 51k 52k 53k 54k 55k 56k 57k 58k 59k 60k 61k 62k 63k 1b 2b 3b 4b 5b 6b 7b 8b 9b 10b 11b 12b 13b 14b 15b 16b 17b 18b 19b 20b 21b 22b 23b 24b 25b 26b 27b 28b 29b 30b 31b 32b 33b 34b 35b 36b 37b 38b 39b 40b 41b 42b 43b 44b 45b 46b 47b 48b 49b 50b 51b 52b 53b 54b 55b 56b 57b 58b 59b 60b 61b 62b 63b 64b 65b 66b 67b 68b 69b 70b 71b 72b 73b 74b 75b 76b 77b 78b 79b 80b 81b 82b 83b 84b 85b 86b 87b 88b 89b 90b 91b 92b 93b 94b 95b 96b 97b 98b 99b 100b 101b 102b 103b 104b 105b 106b 107b 108b 109b 110b 111b 112b 113b 114b 115b 116b 117b 118b 119b 120b 121b 122b 123b 124b 125b 126b)' \ '-c[match all but specified]' \ '-d[match only directory but not contents]' \ '-f:archive:_files -g "*.(tar|cpio)"' \ '-i[interactively rename files]' \ '-j[filter archive through bzip2]' \ '-k[do not overwrite existing files]' \ '-l[hardlink files]' \ '-n[select only the first match for each pattern]' \ '-o:options:_values options write_opt\:writeopt\:\(nodir\)' \ '-p:privileges:(a ae aem am amo amp ao ap e em em m mo mp o p)' \ '-s:substitution expression:' \ '-t[reset access times of files after access]' \ '-u[ignore older files]' \ '-v[verbose]' \ '-x:output format:(cpio bcpio sv4cpio sv4crc tar ustar)' \ '-B:maximum number of octets per archive:' \ '-D[ignore older files by ctime]' \ '-E:maximum number of consecutive read faults:' \ '*-G:group:_groups' \ '-H[follow only command-line symlinks]' \ '-L[follow all symlinks]' \ '-P[do not follow symlinks]' \ '-T:time range:' \ '*-U:user:_users' \ '-X[do not descend into directories that have a different device ID]' \ '-Y[ignore older files by ctime after file name mods]' \ '-Z[ignore older files after file name mods]' \ '*:files:_files' PK[O< < functions/_bzip2nuW+A#compdef bzip2 bunzip2 bzcat=bunzip2 bzip2recover -redirect-,<,bunzip2=bunzip2 -redirect-,>,bzip2=bunzip2 -redirect-,<,bzip2=bzip2 local decompress expl state line curcontext="$curcontext" ret=1 typeset -A opt_args case "$service" in bzip2recover) [[ $CURRENT = 2 ]] && state=files;; bzip2) decompress=no;& bunzip2) _arguments -C -s -S \ '(--help)-h[display help message]' \ '(-h)--help[display help message]' \ '(--decompress --compress -z --test -t)-d[decompress]' \ '(-d --compress -z --test -t)--decompress[decompress]' \ '(--compress --decompress -d --test -t)-z[compress]' \ '(-z --decompress -d --test -t)--compress[compress]' \ "(--keep)-k[keep (don't delete) input files]" \ "(-k)--keep[keep (don't delete) input files]" \ '(--force)-f[force overwrite]' \ '(-f)--force[force overwrite]' \ '(--test --decompress -d --compress -z )-t[test compressed file integrity]' \ '(-t --decompress -d --compress -z )--test[test compressed file integrity]' \ '(--stdout)-c[write on standard output]' \ '(-c)--stdout[write on standard output]' \ '(--quiet)-q[suppress all warnings]' \ '(-q)--quiet[suppress all warnings]' \ '*-v[verbose mode]' \ '*--verbose[verbose mode]' \ '(--license)-L[display software license]' \ '(-L)--license[display software license]' \ '(--version)-V[display version number]' \ '(-V)--version[display version number]' \ '(--small)-s[use less memory (at most 2500k)]' \ '( -2 -3 -4 -5 -6 -7 -8 -9)-1' \ '(-1 -3 -4 -5 -6 -7 -8 -9)-2' \ '(-1 -2 -4 -5 -6 -7 -8 -9)-3' \ '(-1 -2 -3 -5 -6 -7 -8 -9)-4' \ '(-1 -2 -3 -4 -6 -7 -8 -9)-5' \ '(-1 -2 -3 -4 -5 -7 -8 -9)-6' \ '(-1 -2 -3 -4 -5 -6 -8 -9)-7' \ '(-1 -2 -3 -4 -5 -6 -7 -9)-8' \ '(-1 -2 -3 -4 -5 -6 -7 -8 )-9' \ '*:files:->files' && ret=0 ;; esac if [[ "$state" = files ]]; then (( $+opt_args[-z] || $+opt_args[--compress] )) && decompress=no (( $+opt_args[-d] || $+opt_args[--decompress] || $+opt_args[-t] || $+opt_args[--test] )) && unset decompress if [[ -z "$decompress" ]]; then _description files expl 'compressed file' _files "$expl[@]" -g '*.(bz2|tbz|tbz2)(-.)' && return else _description files expl 'file to compress' _files "$expl[@]" -g '^*.(bz2|tbz|tbz2)(-.)' && return fi fi return ret PK[F{functions/VCS_INFO_nvcsformatsnuW+A## vim:ft=zsh ## Written by Frank Terbeck ## Distributed under the same BSD-ish license as zsh itself. setopt localoptions noksharrays NO_shwordsplit local c v rr if [[ $1 == '-preinit-' ]] ; then c='default' v='-preinit-' rr='-all-' fi zstyle -a ":vcs_info:${v:-$vcs}:${c:-$usercontext}:${rrn:-$rr}" nvcsformats msgs (( ${#msgs} > maxexports )) && msgs[${maxexports},-1]=() return 0 PK[gSv//functions/compauditnuW+A# So that this file can also be read with `.' or `source' ... compaudit() { # Define and then call # Audit the fpath to assure that it contains all the directories needed by # the completion system, and that those directories are at least unlikely # to contain dangerous files. This is far from perfect, as the modes or # ownership of files or directories might change between the time of the # audit and the time the function is executed. # This function is designed to be called from compinit, which assumes that # it is in the same directory, i.e., it can be autoloaded from the initial # fpath as compinit was. Most local parameter names in this function must # therefore be the same as those used in compinit. emulate -L zsh setopt extendedglob [[ -x /usr/bin/getent ]] || getent() { if [[ $2 = <-> ]]; then grep ":$2:[^:]*$" /etc/$1 else grep "^$2:" /etc/$1 fi } # The positional parameters are the directories to check, else fpath. if (( $# )); then local _compdir='' elif (( $#fpath == 0 )); then print 'compaudit: No directories in $fpath, cannot continue' 1>&2 return 1 else set -- $fpath fi # _i_check is defined by compinit; used here as a test for whether this # function is running standalone or was called by compinit. If called # by compinit, we use parameters that are defined in compinit's scope, # otherwise we make them local here. (( $+_i_check )) || { local _i_q _i_line _i_file _i_fail=verbose local -a _i_files _i_addfiles _i_wdirs _i_wfiles local -a -U +h fpath } fpath=( $* ) # _compdir may be defined by the user; see the compinit documentation. # If it isn't defined, we want it to point somewhere sensible, but the # user is allowed to set it to empty to bypass the check below. (( $+_compdir )) || { local _compdir=${fpath[(r)*/$ZSH_VERSION/*]} [[ -z $_compdir ]] && _compdir=$fpath[1] ### [[ -d $_compdir/../Base ]] && _compdir=${_compdir:h} } _i_wdirs=() _i_wfiles=() _i_files=( ${^~fpath:/.}/^([^_]*|*~|*.zwc)(N) ) if [[ -n $_compdir ]]; then if [[ $#_i_files -lt 20 || $_compdir = */Base || -d $_compdir/Base ]]; then # Too few files: we need some more directories, or we need to check # that all directories (not just Base) are present. _i_addfiles=() if [[ -d $_compdir/Base/Core ]]; then # Add all the Completion subdirectories (CVS-layout) _i_addfiles=(${_compdir}/*/*(/^M)) elif [[ -d $_compdir/Base ]]; then # Likewise (installation-layout) _i_addfiles=(${_compdir}/*(/^M)) fi for _i_line in {1..$#_i_addfiles}; do _i_file=${_i_addfiles[$_i_line]} [[ -d $_i_file && -z ${fpath[(r)$_i_file]} ]] || _i_addfiles[$_i_line]= done fpath=($fpath $_i_addfiles) _i_files=( ${^~fpath:/.}/^([^_]*|*~|*.zwc)(N) ) fi fi [[ $_i_fail == use ]] && return 0 # RedHat Linux "per-user groups" check. This is tricky, because it's very # difficult to tell whether the sysadmin has put someone else into your # "private" group (e.g., via the default group field in /etc/passwd, or # by NFS group sharing with an untrustworthy machine). So we must assume # that this has not happened, and pick the best group. local GROUP GROUPMEM _i_pw _i_gid _i_ulwdirs if ((UID == EUID )); then getent group $LOGNAME | IFS=: read GROUP _i_pw _i_gid GROUPMEM else getent group $EGID | IFS=: read GROUP _i_pw _i_gid GROUPMEM fi # We search for: # - world/group-writable directories in fpath not owned by root and the user # - parent-directories of directories in fpath that are world/group-writable # and not owned by root and the user (that would allow someone to put a # digest file for one of the directories into the parent directory) # - digest files for one of the directories in fpath not owned by root and # the user # - and for files in directories from fpath not owned by root and the user # (including zwc files) if [[ $GROUP == $LOGNAME && ( -z $GROUPMEM || $GROUPMEM == $LOGNAME ) ]]; then _i_wdirs=( ${^fpath}(N-f:g+w:^g:${GROUP}:,-f:o+w:,-^u0u${EUID}) ${^fpath:h}(N-f:g+w:^g:${GROUP}:,-f:o+w:,-^u0u${EUID}) ) else _i_wdirs=( ${^fpath}(N-f:g+w:,-f:o+w:,-^u0u${EUID}) ${^fpath:h}(N-f:g+w:,-f:o+w:,-^u0u${EUID}) ) fi if [[ -f /etc/debian_version ]] then _i_ulwdirs=( ${(M)_i_wdirs:#/usr/local/*} ) _i_wdirs=( ${_i_wdirs:#/usr/local/*} ${^_i_ulwdir}(Nf:g+ws:^g:staff:,f:o+w:,^u0) ) fi _i_wdirs=( $_i_wdirs ${^fpath}.zwc^([^_]*|*~)(N-^u0u${EUID}) ) _i_wfiles=( ${^fpath}/^([^_]*|*~)(N-^u0u${EUID}) ) case "${#_i_wdirs}:${#_i_wfiles}" in (0:0) _i_q= ;; (0:*) _i_q=files ;; (*:0) _i_q=directories ;; (*:*) _i_q='directories and files' ;; esac if [[ -n "$_i_q" ]]; then [[ $_i_fail == verbose ]] && { print There are insecure ${_i_q}: 1>&2 print -l - $_i_wdirs $_i_wfiles } return 1 fi return 0 } # Define and then call compaudit "$@" PK[lTTfunctions/_dumpadmnuW+A#compdef dumpadm _dumpadm() { local -a content content=( "kernel"\:"Kernel memory pages only" "all"\:"All memory pages" "curproc"\:"Kernel memory pages plus curproc pages" ) _arguments -s \ '-n[dont run savecore on reboot]' \ '-u[update dump configuration from dumpadm.conf]' \ '-y[run savecore on reboot]' \ '-c[set dump content]:dump content:(($content))' \ '-d[set dump device]:block devices:_files -g "*(-%b)"' \ '-m[set minfree size ]:' \ '-s[set the savecore directory]:directory:_files -/' \ '-r[alternate root directory]:directory:_files -/' } _dumpadm "$@" PK[Kx*]]functions/calendar_lockfilesnuW+A# Lock the given files. # Append the names of lockfiles to the array lockfiles. local file lockfile msgdone # Number of attempts to lock a file. Probably not worth stylising. integer lockattempts=4 loadtried # The lockfile name is not stylised: it has to be a fixed # derivative of the main fail. for file; do lockfile=$file.lockfile for (( i = 0; i <= lockattempts; i++ )); do if ln -s $file $lockfile >/dev/null 2>&1; then lockfiles+=($lockfile) break fi if zle && [[ -z $msgdone ]]; then msgdone="${lockfile}: waiting to acquire lock" zle -M $msgdone fi if (( ! loadtried )); then zmodload -i zsh/zselect 2>/dev/null (( loadtried = 1 )) fi if zmodload -e zsh/zselect; then # This gives us finer grained timing (100th second). # Randomize the sleep between .1 and 2 seconds so that # we are much less likely to have multiple instances # retrying at once. zselect -t $(( 10 + RANDOM * 190 / 32768 )) else sleep 1 fi done if [[ -n $msgdone ]]; then zle -M ${msgdone//?/ } msgdone= fi if [[ ${lockfiles[-1]} != $lockfile ]]; then msgdone="Failed to lock $file; giving up after $lockattempts attempts. Another instance of calendar may be using it. Delete $lockfiles if you believe this to be an error." if zle; then zle -M $msgdone else print $msgdone >&2 fi # The parent should take action to delete any lockfiles # already locked. Typically this won't be necessary, since # we will always lock the main calendar file first. return 1 fi done return 0 PK[cofunctions/_ncftpnuW+A#compdef ncftp lftp local expl bookmarks=$HOME/.$service/bookmarks if [[ -f $bookmarks ]]; then bookmarks=(${"${(f)$(<$bookmarks)}"%%[[:space:],]*}) [[ $service == ncftp ]] && shift 2 bookmarks _wanted bookmarks expl bookmark compadd -a bookmarks && return 0 fi _hosts PK[o>! ! functions/_rakenuW+A#compdef rake # rake, version 0.8.3 local curcontext="$curcontext" state line expl ret=1 typeset -A opt_args _arguments -C -s -S \ '(--classic-namespace -C)'{--classic-namespace,-C}'[put Task and FileTask in the top level namespace]' \ '(--dry-run -n)'{--dry-run,-n}'[do a dry run without executing actions]' \ '(- *)'{--describe,-D}'[describe the tasks (matching the specified pattern), then exit]:pattern::' \ '(--execute -e)'{--execute,-e}'[execute some Ruby code and exit]:Ruby code:' \ '(--execute-print -p)'{--execute-print,-p}'[execute some Ruby code, print the result, then exit]:Ruby code:' \ '(--execute-continue -E)'{--execute-continue,-E}'[execute some Ruby code, then continue with normal task processing]:Ruby code:' \ '(- *)'{--help,-h,-H}'[display help information]' \ \*{--libdir,-I}'[include specified directory in the search path for required modules]:library directory:_files -/' \ '(--rakelibdir --rakelib -R)'{--rakelibdir,--rakelib,-R}'[auto-import any .rake files in the specified directory. (default is 'rakelib')]:rake library directory:_files -/' \ '(--nosearch -N)'{--nosearch,-N}'[do not search parent directories for the Rakefile]' \ '(- *)'{--prereqs,-P}'[display the tasks and prerequisites, then exit]' \ '(--quiet -q --silent -s --verbose -v)'{--quiet,-q}'[do not log messages to standard output]' \ '(--rakefile -f)'{--rakefile,-f}'[use specified file as the rakefile]:rake file:_files' \ \*{--require,-r}'[require specified module before executing rakefile]:library:->library' \ '(- *)--rules[trace the rules resolution]' \ '(--quiet -q --silent -s --verbose -v)'{--silent,-s}"[like --quiet, but also suppresses the 'in directory' announcement]" \ '(--system,-g)'{--system,-g}'[using system wide (global) rakefiles (usually '~/.rake/*.rake')]' \ '(- *)'{--tasks,-T}'[display the tasks (matching the specified pattern) with descriptions, then exit]:pattern::' \ '(--trace -t)'{--trace,-t}'[turn on invoke/execute tracing, enable full backtrace]' \ '(--quiet -q --silent -s --verbose -v)'{--verbose,-v}'[log message to standard output (default)]' \ '(- *)'{--version,-V}'[display version information]' \ '*:target:->target' && ret=0 case "$state" in library) local -a dirs dirs=( $(_call_program directories ruby -e 'puts\ \$:' 2>/dev/null) ${(s.:.)opt_args[-I]} ) _wanted libraries expl library _path_files -W dirs && ret=0 ;; target) local -a targets targets=( ${${(f)"$(_call_program targets $words[1] -sT $opt_args[(I)(-N|--nosearch)] ${(kv)opt_args[(I)(-f|--rakefile)]} 2>/dev/null)"}/(#b)rake ([^ ]##) ##\# (*)/${${match[1]}//:/\\:}:${match[2]:l}} ) if (( ! ${targets[(I)rake aborted!]} )) then _describe -t targets 'rake target' targets && ret=0 else _message -e targets 'rake target' fi ;; esac return ret PK[ functions/_store_cachenuW+A#autoload # # Storage component of completions caching layer local _cache_ident _cache_ident_dir _cache_ident="$1" if zstyle -t ":completion:${curcontext}:" use-cache; then # Decide which directory to cache to, and ensure it exists zstyle -s ":completion:${curcontext}:" cache-path _cache_dir : ${_cache_dir:=${ZDOTDIR:-$HOME}/.zcompcache} if [[ ! -d "$_cache_dir" ]]; then if [[ -e "$_cache_dir" ]]; then _message "cache-dir style points to a non-directory\!" else # if module load fails, we *should* be okay using normal mkdir so # we load feature b:mkdir instead of b:zf_mkdir; note that modules # loaded in a sub-shell don't affect the parent. ( zmodload -F zsh/files b:mkdir; mkdir -m 0700 -p "$_cache_dir" ) 2>/dev/null if [[ ! -d "$_cache_dir" ]]; then _message "couldn't create cache-dir $_cache_dir" return 1 fi fi fi _cache_ident_dir="$_cache_dir/$_cache_ident" _cache_ident_dir="$_cache_ident_dir:h" if [[ ! -d "$_cache_ident_dir" ]]; then if [[ -e "$_cache_ident_dir" ]]; then _message "cache ident dir points to a non-directory:$_cache_ident_dir" else # See also rationale in zmodload above ( zmodload -F zsh/files b:mkdir; mkdir -m 0700 -p "$_cache_ident_dir" ) 2>/dev/null if [[ ! -d "$_cache_ident_dir" ]]; then _message "couldn't create cache-ident_dir $_cache_ident_dir" return 1 fi fi fi shift for var; do case ${(Pt)var} in (*readonly*) ;; (*(association|array)*) print -r "$var=( ${(kv@Pqq)^^var} )";; (*) print -r "$var=${(Pqq)^^var}";; esac done >! "$_cache_dir/$_cache_ident" else return 1 fi return 0 PK[]yfunctions/zfgotonuW+A# zfgoto bname # Go to bookmark bname, a location on a remote FTP host. Unless # this was the last session or is for anonymous FTP, prompt for # the user's password. # # Maybe this should try and look for an appropriate session to use # for the transfer. emulate -L zsh setopt extendedglob [[ $curcontext = :zf* ]] || local curcontext=:zfgoto # Set ZFTP_BMFILE if not already set. This should agree with # the corresponding line in zfmark. : ${ZFTP_BMFILE:=${ZFDOTDIR:-$HOME}/.zfbkmarks} typeset -A bkmarks local line opt_n opt while getopts :n opt; do [[ $opt = '?' ]] && print "zfgoto: bad option: -$OPTARG" && return 1 eval "opt_$opt=1" done (( OPTIND > 1 )) && shift $(( OPTIND - 1 )) if (( $# != 1 )); then print "Usage: zfgoto bookmark" >&2 return 1 fi if [[ -n $opt_n && -f ~/.ncftp/bookmarks ]]; then local oldifs=$IFS IFS=, while read -rA line; do bkmarks[$line[1]]="${line[3]:-anonymous}@${line[2]}:${line[6]}" done < ~/.ncftp/bookmarks IFS=$oldifs elif [[ -f $ZFTP_BMFILE ]]; then # read in file: could optimise this by recording last read time # comparing with file while read -r line; do # ignore blank and comment lines [[ $line = [[:blank:]]# || $line = [[:blank:]]#'#'* ]] && continue bkmarks[${line%% *}]="${line#* }" done <$ZFTP_BMFILE fi line=${bkmarks[$1]} if [[ -z $line ]]; then print "Bookmark \`$1' not found" >&2 return 1 fi local user host dir user=${line%%@*} line=${line#*@} host=${line%%:*} dir=${line#*:} if [[ $ZFTP_USER = $user && $ZFTP_HOST = $host ]]; then # We're already there, just change directory zfcd ${dir:-~} elif [[ $user = ftp || $user = anonymous ]]; then # Anonymous ftp, so we don't need password etc. zfanon $host && [[ -n $dir ]] && zfcd $dir elif [[ $zfconfig[lastloc_$ZFTP_SESSION] = ${host}:* && $user = $zfconfig[lastuser_$ZFTP_SESSION] ]]; then # This was the last session, so assume it's still setup in the # open parameters zfopen && [[ -n $dir ]] && zfcd $dir else # Last try: see if it's in the parameters. local params params=($(zftp params)) if [[ $host = $params[1] && $user = $params[2] ]]; then zfopen && [[ -n $dir ]] && zfcd $dir else zfopen $host $user && [[ -n $dir ]] && zfcd $dir fi fi PK['functions/tcp_opennuW+A# Open a TCP session, add it to the list, handle it with zle if that's running. # Unless using -a, -f, -l or -s, first two arguments are host and port. # # Remaining argument, if any, is the name of the session, which mustn't # clash with an existing one. If none is given, the number of the # connection is used (i.e. first connection is 1, etc.), or the first # available integer if that is already in use. # # Session names, whether provided on the command line or in the # .ztcp_sessions file should not be `clever'. A clever name is one # with characters that won't work. This includes whitespace and an # inconsistent set of punctuation characters. If in doubt, stick # to alphanumeric, underscore and non-initial hyphen. # # -a fd Accept a connection on fd and make that the session. # This will block until a successful incoming connection is received. # # fd is probably a value returned by ztcp -l; no front-end # is currently provided for that but it should simply be # a matter of calling `ztcp -l port' and storing $REPLY, then # closing the listened port with `ztcp -c $stored_fd'. # # -f fd `Fake' tcp connection on the given file descriptor. This # could be, for example, a file descriptor already opened to # a named pipe. It should not be a regular file, however. # Note that it is not a good idea for two different sessions # to be attempting to read from the same named pipe, so if # both ends of the pipe are to be handled by zsh, at least # one should use the `-z' option. # # -l sesslist # -s sessname # Open by session name or comma separated list; either may # be repeated as many times as necessary. The session must be # listed in the file ${ZDOTDIR:-$HOME}/.ztcp_sessions. Lines in # this file look exactly like a tcp_open command line except the # session name is at the start, for example # sess1 pwspc 2811 # has the effect of # tcp_open pwspc 2811 sess1 # Remaining arguments (other than options) to tcp_open are # not allowed. Options in .ztcp_sessions are not handled. # The file must be edited by hand. # # -z Don't install a zle handler for reading on the file descriptor. # Otherwise, if zle is enabled, the file descriptor will # be tested while at the shell prompt and any input automatically # printed in the same way as job control notification. # # If a session is successfully opened, and if the function `tcp_on_open' # exists, it is run with the arguments session_name, session_fd. emulate -L zsh setopt extendedglob cbases # Global set up for TCP function suite. zmodload -i zsh/net/tcp || return 1 zmodload -i zsh/zutil autoload -Uz tcp_alias tcp_close tcp_command tcp_expect tcp_fd_handler autoload -Uz tcp_log tcp_output tcp_proxy tcp_read tcp_rename tcp_send autoload -Uz tcp_sess tcp_spam tcp_talk tcp_wait tcp_point tcp_shoot # TCP_SECONDS_START is only set if we override TCP_SECONDS locally, # so provide a global value for convenience. Should probably always be 0. (( ${+TCP_SECONDS_START} )) || typeset -gF TCP_SECONDS_START # Processing for new connection. local opt accept fake nozle sessfile sess quiet local -a sessnames sessargs integer stat while getopts "a:f:l:qs:z" opt; do case $opt in (a) accept=$OPTARG if [[ $accept != [[:digit:]]## ]]; then print "option -a takes a file descriptor" >&2 return 1 fi ;; (f) fake=$OPTARG if [[ $fake != [[:digit:]]## ]]; then print "option -f takes a file descriptor" >&2 return 1 fi ;; (l) sessnames+=(${(s.,.)OPTARG}) ;; (q) quiet=1 ;; (s) sessnames+=($OPTARG) ;; (z) nozle=1 ;; (*) return 1 ;; esac done (( OPTIND > 1 )) && shift $(( OPTIND - 1 )) (( ${+tcp_by_fd} )) || typeset -gA tcp_by_fd (( ${+tcp_by_name} )) || typeset -gA tcp_by_name typeset -A sessassoc if (( ${#sessnames} )); then if [[ $# -ne 0 || -n $accept || -n $fake ]]; then print "Incompatible arguments with \`-s' option." >&2 return 1 fi for sess in ${sessnames}; do sessassoc[$sess]= done sessfile=${ZDOTDIR:-$HOME}/.ztcp_sessions if [[ ! -r $sessfile ]]; then print "No session file: $sessfile" >&2 return 1 fi while read -A sessargs; do [[ ${sessargs[1]} = '#'* ]] && continue if (( ${+sessassoc[${sessargs[1]}]} )); then sessassoc[${sessargs[1]}]="${sessargs[2,-1]}" fi done < $sessfile for sess in ${sessnames}; do if [[ -z $sessassoc[$sess] ]]; then print "Couldn't find session $sess in $sessfile." >&2 return 1 fi done else if [[ -z $accept && -z $fake ]]; then if (( $# < 2 )); then set -- wrong number of arguments else host=$1 port=$2 shift $(( $# > 1 ? 2 : 1 )) fi fi if [[ -n $1 ]]; then sessnames=($1) shift else sessnames=($(( ${#tcp_by_fd} + 1 ))) while [[ -n $tcp_by_name[$sessnames[1]] ]]; do (( sessnames[1]++ )) done fi sessassoc[$sessnames[1]]="$host $port" fi if (( $# )); then print "Usage: $0 [-z] [-a fd | -f fd | host port [ session ] ] $0 [-z] [ -s session | -l sesslist ] ..." >&2 return 1 fi local REPLY fd for sess in $sessnames; do if [[ -n $tcp_by_name[$sess] ]]; then print "Session \`$sess' already exists." >&2 return 1 fi sessargs=() if [[ -n $fake ]]; then fd=$fake; else if [[ -n $accept ]]; then ztcp -a $accept || return 1 else sessargs=(${=sessassoc[$sess]}) ztcp $sessargs || return 1 fi fd=$REPLY fi tcp_by_fd[$fd]=$sess tcp_by_name[$sess]=$fd [[ -o zle && -z $nozle ]] && zle -F $fd tcp_fd_handler # needed for new completion system, so I'm not too sanguine # about requiring this here... if zmodload -i zsh/parameter; then if (( ${+functions[tcp_on_open]} )); then if ! tcp_on_open $sess $fd; then if [[ -z $quiet ]]; then if (( ${#sessargs} )); then print "Session $sess" \ "(host $sessargs[1], port $sessargs[2] fd $fd): tcp_on_open FAILED." else print "Session $sess (fd $fd) tcp_on_open FAILED." fi tcp_close -- $sess else tcp_close -q -- $sess fi stat=1 continue fi fi fi if [[ -z $quiet ]]; then if (( ${#sessargs} )); then print "Session $sess" \ "(host $sessargs[1], port $sessargs[2] fd $fd) opened OK." else print "Session $sess (fd $fd) opened OK." fi fi done if [[ -z $TCP_SESS || -z $tcp_by_name[$TCP_SESS] ]]; then # careful in case we closed it again... if [[ -n $tcp_by_name[$sessnames[1]] ]]; then [[ -z $quiet ]] && print "Setting default TCP session $sessnames[1]" typeset -g TCP_SESS=$sessnames[1] fi fi return $stat PK[y1JJ'functions/down-line-or-beginning-searchnuW+A# Like down-line-or-search, but uses the whole line prefix up to the # cursor position for searching forwards. emulate -L zsh if [[ ${+NUMERIC} -eq 0 && ( $LASTWIDGET = $__searching || $RBUFFER != *$'\n'* ) ]] then [[ $LASTWIDGET = $__searching ]] && CURSOR=$__savecursor __searching=$WIDGET __savecursor=$CURSOR if zle .history-beginning-search-forward; then [[ $RBUFFER = *$'\n'* ]] || zstyle -T ':zle:down-line-or-beginning-search' leave-cursor && zle .end-of-line return fi [[ $RBUFFER = *$'\n'* ]] || return fi __searching='' zle .down-line-or-history PK[ ]functions/_sttynuW+A#compdef stty local expl if [[ "$words[CURRENT-1]" = \ (*erase|discard|status|dsusp|intr|kill|lnext|quit|reprint|start|s*p) ]]; then _wanted characters expl 'control character' compadd '^-' '^h' '^?' '^c' '^u' else compset -P '[-+]' _wanted values expl setting \ compadd rows columns intr quit erase kill eof eol eol2 start stop \ susp dsusp reprint discard werase lnext parenb parodd cs8 \ cstopb hupcl cread clocal parext ignbrk brkint ignpar \ parmrk inpck istrip inlcr igncr icrnl iuclc ixon ixany ixoff \ imaxbel isig icanon xcase echo echoe echok echonl noflsh \ tostop echoctl echoprt echoke flusho pending iexten opost \ olcuc onlcr ocrnl onocr onlret ofill ofdel fi PK[z/f  functions/pick-web-browsernuW+A# Function to find a web browser to run on a URL or file. # Can also be run as a script. It is suitable for use as # a suffix alias: # alias -s html=pick-web-browser # # The single argument is the URL or file name which may be of any type. # The only processing which occurs is that if the argument is a file, # it is converted into a URL. As the function takes account of # any necessary conversions to the file name (for example, if it # contains spaces), it is generally preferable to pass in raw file # names rather than convert them to URLs elsewhere. # # The function takes account of the fact that many X Windows browsers # which are already running on the current display can take a command # to pass the URL to that process for handling. A typical sign # that this has happened is that apparently nothing happens --- you # need to check the browser window. # # If no $DISPLAY is set, the function tries to start a terminal-based # browser instead. emulate -L zsh setopt extendedglob cbases nonomatch warncreateglobal zmodload -i zsh/zutil local -a xbrowsers ttybrowsers # X Windows browsers which might be running and can accept # a remote URL. zstyle -a :mime: x-browsers xbrowsers || xbrowsers=(firefox mozilla netscape opera konqueror) # Preferred command line browsers. zstyle -a :mime: tty-browsers ttybrowsers || ttybrowsers=(elinks links lynx) # Characters in addition to alphanumerics which can appear literally # in a URL. `-' should be the first if it appears, so append others # to the end. local litc="-_./" local -a windows remoteargs match mbegin mend local url browser command url=$1 if [[ -f $url ]]; then if [[ $url = *[^-_[:alnum:]]* ]]; then # Convert special characters into hex escapes. local sofar while [[ $url = (#b)([${litc}[:alnum:]]#)([^${litc}[:alnum:]])(*) ]] do sofar+="$match[1]%${$(( [#16] ##$match[2] ))##0x}" url=$match[3] done url="$sofar$url" fi # Turn this into a local URL if [[ $url = /* ]]; then url=file://$url else url=file://$PWD/$url fi fi local bstyle local -a bstyles zstyle -a :mime: browser-styles bstyles || bstyles=(running x tty) for bstyle in $bstyles; do case $bstyle in (running) [[ -z $DISPLAY ]] && continue # X Windows running # Get the name of all windows running; use the internal name, not # the friendly name, which is less useful. windows=(${(ou)${(M)${(f)"$(xwininfo -root -all)"}:#*\"*\"\:[[:space:]]\(\"*}/(#b)*\"*\"\:[[:space:]]\(\"(*)\"[[:space:]]\"*\"\)*/$match[1]}) #windows=(${(f)"$(xwininfo -root -all | # perl -ne '/.*"(.*)": \("(.*)" "(.*)"\).*/ and $w{$2} = 1; # END { print join("\n", keys %w), "\n" }')"}) # Is any browser we've heard of running? for browser in $xbrowsers; do # Some browser executables call themselves -bin if [[ $windows[(I)(#i)$browser(|[.-]bin)] -ne 0 ]]; then if zstyle -s ":mime:browser:running:${browser}:" command command; then # The (q)'s here and below are pure paranoia: no browser # name is going to include metacharacters, and we already # converted difficult characters in the URL to hex. zformat -f command $command b:${(q)browser} u:${(q)url} eval $command else case $browser in (konqueror) # kfmclient is less hairy and better supported than direct # use of dcop. Run kfmclient --commands # for more information. Note that as konqueror is a fully # featured file manager, this will actually do complete # MIME handling, not just web pages. kfmclient openURL $url || dcop $(dcop|grep konqueror) default openBrowserWindow $url ;; (firefox) # open in new tab $browser -new-tab $url ;; (opera) $browser -newpage $url ;; (*) # Mozilla bells and whistles are described at: # http://www.mozilla.org/unix/remote.html $browser -remote "openURL($url)" ;; esac fi return fi done ;; (x) [[ -z $DISPLAY ]] && continue # Start our preferred X Windows browser in the background. for browser in $xbrowsers; do if eval "[[ =$browser != \\=$browser ]]"; then if zstyle -s ":mime:browser:new:${browser}:" command command; then zformat -f command $command b:${(q)browser} u:${(q)url} eval $command "&" else # The following is to make the job text more readable. eval ${(q)browser} ${(q)url} "&" fi return fi done ;; (tty) # Start up dumb terminal browser. for browser in $ttybrowsers; do if eval "[[ =$browser != \\=$browser ]]"; then if zstyle -s ":mime:browser:new:${browser}" command command; then zformat -f command $command b:${(q)browser} u:${(q)url} eval $command else $browser $url fi return fi done ;; esac done # No eligible browser. return 255 PK[=ZQQfunctions/tcp_proxynuW+A# Listen on the given port and for every connection, start a new # command (defaults to $SHELL) in the background on the accepted fd. # WARNING: this can leave your host open to the universe. For use # in a restricted fashion on a secure network. # # Remote logins are much more efficient... local TCP_LISTEN_FD trap '[[ -n $TCP_LISTEN_FD ]] && ztcp -c $TCP_LISTEN_FD; return 1' \ HUP INT TERM EXIT PIPE if [[ $1 != <-> ]]; then print "Usage: $0 port [cmd args... ]" >&2 return 1 fi integer port=$1 shift ztcp -l $port || return 1 TCP_LISTEN_FD=$REPLY (( $# )) || set -- ${SHELL:-zsh} local cmd=$1 shift while ztcp -a $TCP_LISTEN_FD; do # hack to expand aliases without screwing up arguments eval $cmd '$* <&$REPLY >&$REPLY 2>&$REPLY &' # Close the session fd; we don't need it here any more. ztcp -c $REPLY done PK[I e<#functions/incremental-complete-wordnuW+A# Autoload this function, run `zle -N ' and bind # to a key. # This allows incremental completion of a word. After starting this # command, a list of completion choices can be shown after every character # you type, which you can delete with ^h or DEL. RET will accept the # completion so far. You can hit TAB to do normal completion, ^g to # abort back to the state when you started, and ^d to list the matches. # # This works only with the new function based completion system. # Recommended settings: # zstyle ':completion:incremental:*' completer _complete _ignored # zstyle :incremental stop-keys $'[\e\C-b\C-f\C-n\C-p\C-u-\C-x]' # BUGS: # The _oldlist completer breaks incremental completion. Use a context- # specific completer zstyle as shown above to disable the _oldlist # completer in this function. # The main widget function. incremental-complete-word() { emulate -L zsh unsetopt autolist menucomplete automenu # doesn't work well local key lbuf="$LBUFFER" rbuf="$RBUFFER" pmpt pstr word local lastl lastr wid twid num post toolong local curcontext="${curcontext}" stop brk [[ -z "$curcontext" ]] && curcontext=::: curcontext="incremental:${curcontext#*:}" zstyle -s ":incremental" prompt pmpt || pmpt='incremental (%c): %u%s %l' zstyle -s ":incremental" stop-keys stop zstyle -s ":incremental" break-keys brk if zstyle -t ":incremental" list; then wid=list-choices post=( icw-list-helper ) else wid=complete-word post=() fi comppostfuncs=( "$post[@]" ) zle $wid "$@" LBUFFER="$lbuf" RBUFFER="$rbuf" num=$_lastcomp[nmatches] if (( ! num )); then word='' state='-no match-' elif [[ "${LBUFFER}${RBUFFER}" = *${_lastcomp[unambiguous]}* ]]; then word='' state='-no prefix-' else word="${_lastcomp[unambiguous]}" state='' fi zformat -f pstr "$pmpt" "u:${word}" "s:$state" "n:$num" \ "l:$toolong" "c:${_lastcomp[completer]}" zle -R "$pstr" read -k key while [[ '#key' -ne '#\\r' && '#key' -ne '#\\n' && '#key' -ne '#\\C-g' ]]; do twid=$wid if [[ "$key" = ${~stop} ]]; then zle -U "$key" return elif [[ "$key" = ${~brk} ]]; then return elif [[ '#key' -eq '#\\C-h' || '#key' -eq '#\\C-?' ]]; then [[ $#LBUFFER -gt $#l ]] && LBUFFER="$LBUFFER[1,-2]" elif [[ '#key' -eq '#\\t' ]]; then zle complete-word "$@" lbuf="$LBUFFER" rbuf="$RBUFFER" elif [[ '#key' -eq '#\\C-d' ]]; then twid=list-choices else LBUFFER="$LBUFFER$key" fi if (( ! PENDING )); then lastl="$LBUFFER" lastr="$RBUFFER" [[ "$twid" = "$wid" ]] && comppostfuncs=( "$post[@]" ) toolong='' zle $twid "$@" LBUFFER="$lastl" RBUFFER="$lastr" num=$_lastcomp[nmatches] if (( ! num )); then word='' state='-no match-' elif [[ "${LBUFFER}${RBUFFER}" = *${_lastcomp[unambiguous]}* ]]; then word='' state='-no prefix-' else word="${_lastcomp[unambiguous]}" state='' fi zformat -f pstr "$pmpt" "u:${word}" "s:$state" "n:$num" \ "l:$toolong" "c:${_lastcomp[completer]}" zle -R "$pstr" else zle -R fi read -k key done if [[ '#key' -eq '#\\C-g' ]]; then LBUFFER="$lbuf" RBUFFER="$rbuf" fi zle -Rc } # Helper function used as a completion post-function used to make sure that # the list of matches in only shown if it fits on the screen. icw-list-helper() { # +1 for the status line we will add... if [[ compstate[list_lines]+BUFFERLINES+1 -gt LINES ]]; then compstate[list]='list explanations messages' [[ compstate[list_lines]+BUFFERLINES+1 -gt LINES ]] && compstate[list]='' toolong='...' fi } incremental-complete-word "$@" PK[56Kfunctions/_zfs_datasetnuW+A#autoload local -a type typearg list zparseopts -D -E -a type t+: [[ -n $type[(r)fs] ]] && typearg=( filesystem ) [[ -n $type[(r)vol] ]] && typearg=( $typearg volume ) [[ -n $type[(r)snap] ]] && typearg=( $typearg snapshot ) [[ -n $typearg ]] && typearg=( -t ${(j:,:)typearg} ) datasetlist=( ${="$(zfs list -H -o name $typearg)":#no datasets available} ) expl_type=${typearg[2,-1]//,/\/} if [[ -n $type[(r)mtpt] ]]; then mlist=( ${="$(zfs list -H -o mountpoint $typearg)":#no mountpoints available} ) datasetlist=( $datasetlist $mlist ) expl_type="$expl_type/mountpoint" fi # compadd "$@" - $list _wanted dataset expl "$expl_type" _multi_parts "$@" / datasetlist PK[`dg functions/_next_tagsnuW+A#compdef -k list-choices \C-xn # Main widget. _next_tags() { eval "$_comp_setup" local ins ops="$PREFIX$SUFFIX" unfunction _all_labels _next_label _all_labels() { local __gopt __len __tmp __pre __suf __ret=1 __descr __spec __prev if [[ "$1" = - ]]; then __prev=- shift fi __gopt=() zparseopts -D -a __gopt 1 2 V J x __tmp=${argv[(ib:4:)-]} __len=$# if [[ __tmp -lt __len ]]; then __pre=$(( __tmp-1 )) __suf=$__tmp elif [[ __tmp -eq $# ]]; then __pre=-2 __suf=$(( __len+1 )) else __pre=4 __suf=5 fi while comptags "-A$__prev" "$1" curtag __spec; do (( $#funcstack > _tags_level )) && _comp_tags="${_comp_tags% * }" _tags_level=$#funcstack [[ "$_next_tags_not" = *\ ${__spec}\ * ]] && continue _comp_tags+=" $__spec " if [[ "$curtag" = *[^\\]:* ]]; then zformat -f __descr "${curtag#*:}" "d:$3" _description "$__gopt[@]" "${curtag%:*}" "$2" "$__descr" curtag="${curtag%:*}" "$4" "${(P@)2}" "${(@)argv[5,-1]}" && __ret=0 else _description "$__gopt[@]" "$curtag" "$2" "$3" "${(@)argv[4,__pre]}" "${(P@)2}" "${(@)argv[__suf,-1]}" && __ret=0 fi done return __ret } _next_label() { local __gopt __descr __spec __gopt=() zparseopts -D -a __gopt 1 2 V J x if comptags -A "$1" curtag __spec; then (( $#funcstack > _tags_level )) && _comp_tags="${_comp_tags% * }" _tags_level=$#funcstack [[ "$_next_tags_not" = *\ ${__spec}\ * ]] && continue _comp_tags+=" $__spec " if [[ "$curtag" = *[^\\]:* ]]; then zformat -f __descr "${curtag#*:}" "d:$3" _description "$__gopt[@]" "${curtag%:*}" "$2" "$__descr" curtag="${curtag%:*}" set -A $2 "${(P@)2}" "${(@)argv[4,-1]}" else _description "$__gopt[@]" "$curtag" "$2" "$3" set -A $2 "${(@)argv[4,-1]}" "${(P@)2}" fi return 0 fi return 1 } if [[ "${LBUFFER%${PREFIX}}" = "$_next_tags_pre" ]]; then PREFIX="$_next_tags_pfx" SUFFIX="$_next_tags_sfx" else _next_tags_pre="${LBUFFER%${PREFIX}}" if [[ "$LASTWIDGET" = (_next_tags|list-*|*complete*) ]]; then PREFIX="$_lastcomp[prefix]" SUFFIX="$_lastcomp[suffix]" fi fi _next_tags_not+=" $_lastcomp[tags]" _next_tags_pfx="$PREFIX" _next_tags_sfx="$SUFFIX" ins="${compstate[old_insert]:+1}" _main_complete _complete _next_tags_completer [[ $compstate[insert] = automenu ]] && compstate[insert]=automenu-unambiguous [[ $compstate[insert] = *unambiguous && -n "$ops" && -z "$_lastcomp[unambiguous]" ]] && compadd -Uns "$SUFFIX" - "$PREFIX" compstate[insert]="$ins" compstate[list]='list force' compprefuncs+=( _next_tags_pre ) } # Completer, for wrap-around. _next_tags_completer() { _next_tags_not= _complete } # Pre-completion function. _next_tags_pre() { # Probably `remove' our label functions. A better test would be nice, but # I think one should still be able to edit the current word between # attempts to complete it. if [[ -n $compstate[old_insert] && $WIDGET != _next_tags ]]; then compstate[old_list]=keep compstate[insert]=menu:2 return 0 elif [[ ${LBUFFER%${PREFIX}} != ${_next_tags_pre}* ]]; then unfunction _all_labels _next_label autoload -Uz _all_labels _next_label else compprefuncs+=( _next_tags_pre ) fi } _next_tags "$@" PK[p6jjfunctions/zftp_chpwdnuW+A# function zftp_chpwd { # You may want to alter chpwd to call this when $ZFTP_USER is set. # If the directory really changed... if [[ $ZFTP_PWD != $zfconfig[lastdir_$ZFTP_SESSION] ]]; then # ...and also empty the stored directory listing cache. # As this function is called when we close the connection, this # is the only place we need to do these two things. local curdir=$zfconfig[curdir_$ZFTP_SESSION] [[ -n $curdir && -f $curdir ]] && rm -f $curdir zfconfig[otherargs_$ZFTP_SESSION]= zffcache -d fi if [[ -z $ZFTP_USER ]]; then # last call, after an FTP logout # delete the non-current cached directory [[ -n $zfotherdir && -f $zfotherdir ]] && rm -f $zfotherdir # don't keep lastdir between opens (do keep lastloc) zfconfig[lastdir_$ZFTP_SESSION]= # return the display to standard zstyle -t ":zftp$curcontext" chpwd && chpwd else [[ -n $ZFTP_PWD ]] && zfconfig[lastdir_$ZFTP_SESSION]=$ZFTP_PWD zfconfig[lastloc_$ZFTP_SESSION]="$ZFTP_HOST:$ZFTP_PWD" zfconfig[lastuser_$ZFTP_SESSION]="$ZFTP_USER" local args if [[ -t 1 && -t 2 ]] && zstyle -t ":zftp$curcontext" titlebar; then local str=$zfconfig[lastloc_$ZFTP_SESSION] [[ ${#str} -lt 70 ]] && str="%m: %~ $str" case $TERM in sun-cmd) print -Pn "\033]l$str\033\\" ;; *xterm*|rxvt|dtterm|Eterm|kterm) print -Pn "\033]2;$str\a" ;; esac fi fi # } PK[ Qd66functions/_listnuW+A#autoload # This completer function makes the other completer functions used # insert possible completions only after the list has been shown at # least once. [[ _matcher_num -gt 1 ]] && return 1 local pre suf expr # Get the strings to compare. if zstyle -t ":completion:${curcontext}:" word; then pre="$HISTNO$LBUFFER" suf="$RBUFFER" else pre="$PREFIX" suf="$SUFFIX" fi # Should we only show a list now? if zstyle -T ":completion:${curcontext}:" condition && [[ "$pre" != "$_list_prefix" || "$suf" != "$_list_suffix" ]]; then # Yes. Tell the completion code about it and save the new values # to compare the next time. compstate[insert]='' compstate[list]='list force' _list_prefix="$pre" _list_suffix="$suf" fi # We always return one, because we don't really do any work here. return 1 PK[o--functions/_nslookupnuW+A#compdef nslookup # This may also be called from the `nslookup' wrapper function during # `vared'iting a line. # In this case this function tries to call other user-defined functions # for certain contexts before adding completion. If these functions are # defined, they are called and the default completions from this function # are not added. The functions called are named `_nslookup_', with # `' being any of: # # command # When completing the first word on the line. # redirect # When completing after a redirection operator. # # Also, when completing after the first word, if the first word contains # only lower case letters, we try to call the function `_nslookup_', # where `' is the first word from the line. If the first word contains # other characters than lower case letters, we try to call the function # `_nslookup_host'. local state curcontext="$curcontext" expl ret=1 setopts typeset -A opt_args setopts=( 'all[print current values]' \ '(nodebug)debug[simple debugging information]' \ '(debug)nodebug[no simple debugging information]' \ '(nod2)d2[extra debugging information]' \ '(d2)nod2[no extra debugging information]' \ '(nodefname)defname[append default domain name]' \ '(defname)nodefname[don'"'"'t append default domain name]' \ '(nosearch)search[append search list]' \ '(search)nosearch[don'"'"'t append search list]' \ '(norecurse)recurse[name server may query other servers]' \ '(recurse)norecurse[name server may not query other servers]' \ '(novc)vc[use virtual circuit]' \ '(vc)novc[don'"'"'t use virtual circuit]' \ '(noignoretc)ignoretc[ignore packet truncation errors]' \ '(ignoretc)noignoretc[don'"'"'t ignore packet truncation errors]' \ 'class[change query class]:query class:((in\:Internet\ class chaos\:CHAOS\ class hesiod\:MIT\ Athena\ Hesiod\ class any\:wildcard\ \(any\ of\ the\ above\)))' "domain[change default domain]:default domain:_domains" 'srchlist[change default domain and search list]: :->srchlist' 'port[change name server port]:name server port:' {query,}type'[change type of information query]:query information type:((a\:internet\ address cname\:canonical\ name\ for\ alias hinfo\:CPU\ and\ operating\ system\ type minfo\:mailbox\ or\ mail\ list\ information mx\:mail\ exchanger ns\:name\ server\ for\ zone ptr\:host\ name\ or\ other\ information soa\:domain\'"'"'s\ \`start-of-authority\'"'"'\ information txt\:text\ information uinfo\:user\ information wks\:supported\ well-known\ services))' 'retry[change number of retries]:number of retries:' 'root[change name of root server]:root server:_hosts' 'timeout[change initial timeout interval]:timeout (seconds):' ) if [[ -n "$compcontext" ]]; then if [[ CURRENT -eq 1 ]]; then _call_function ret _nslookup_command && return ret _alternative \ 'commands:command:(server lserver root finger ls view help set exit)' \ 'hosts:: _hosts' && ret=0 return ret elif [[ "$compstate[context]" = redirect ]]; then _call_function ret _nslookup_redirect && return ret _tags -C redirection files || return 1 if [[ "$words[1]" != (finger|ls) ]]; then _message "redirection not allowed for command \`$words[1]'" return 1 elif [[ "$compstate[redirect]" = '>' ]]; then _description files expl 'write to file' elif [[ "$compstate[redirect]" = '>>' ]]; then _description files expl 'append to file' else _message "unknown redirection operator \`$compstate[redirect]'" return 1 fi _files "$expl[@]" return fi if [[ "$words[1]" = [a-z]## ]]; then _call_function ret _nslookup_$words[1] && return ret else _call_function ret _nslookup_host && return ret fi case "$words[1]" in (|l)server) _wanted hosts expl 'new default server' _hosts return ;; root|exit|help|\?) return 1 ;; finger) _message -e names 'finger name' return 1 ;; ls) _arguments -s \ '-t[records of given type]:query information type:((a\:internet\ address cname\:canonical\ name\ for\ alias hinfo\:CPU\ and\ operating\ system\ type minfo\:mailbox\ or\ mail\ list\ information mx\:mail\ exchanger ns\:name\ server\ for\ zone ptr\:host\ name\ or\ other\ information soa\:domain\'"'"'s\ \`start-of-authority\'"'"'\ information txt\:text\ information uinfo\:user\ information wks\:supported\ well-known\ services))' \ '-a[aliases of hosts in domain]' \ '-d[all records]' \ '-h[CPU and operating system information]' \ '-s[well-known services]' \ ":domain:_domains" return ;; view) _description files expl 'view file' _files "$expl[@]" return ;; set) typeset -A val_args _values 'state information' "$setopts[@]" && ret=0 [[ -z "$state" ]] && return ret ;; *) _wanted hosts expl 'server' _hosts return esac fi # Now comes the command line option completion part. if [[ -z "$state" ]]; then local line typeset -A opt_args _arguments -C \ "-${(@)^${(@M)setopts:#*\]:*}/\[/=[}" \ "-${(@)^setopts:#(\(|*\]:)*}" \ "${(@)^${(@)${(@M)setopts:#\(*}/\)/)-}/\(/(-}" \ ':host to find:_hosts' \ ':server:_hosts' && ret=0 fi # This is completion after `srchlist' for both types. if [[ -n "$state" ]]; then _tags domains || return 1 if compset -P '*/'; then _description domains expl 'search list entry' else _description domains expl 'default domain name and first search list entry' fi if [[ -n "$_vals_cache_multi" ]]; then _domains "$expl[@]" -qS/ -r "/\\- \\t\\n$_vals_cache_multi" else _domains "$expl[@]" -qS/ fi return fi return ret PK[][RRfunctions/_prefixnuW+A#autoload # Try to ignore the suffix. A bit like e-o-c-prefix. [[ _matcher_num -gt 1 || -z "$SUFFIX" ]] && return 1 local comp curcontext="$curcontext" tmp suf="$SUFFIX" \ _completer \ _matcher _c_matcher _matchers _matcher_num integer ind if ! zstyle -a ":completion:${curcontext}:" completer comp; then comp=( "${(@)_completers[1,_completer_num-1]}" ) ind=${comp[(I)_prefix(|:*)]} (( ind )) && comp=("${(@)comp[ind,-1]}") fi if zstyle -t ":completion:${curcontext}:" add-space; then ISUFFIX=" $SUFFIX" else ISUFFIX="$SUFFIX" fi SUFFIX='' local _completer_num=1 for tmp in "$comp[@]"; do if [[ "$tmp" = *:-* ]]; then _completer="${${tmp%:*}[2,-1]//_/-}${tmp#*:}" tmp="${tmp%:*}" elif [[ $tmp = *:* ]]; then _completer="${tmp#*:}" tmp="${tmp%:*}" else _completer="${tmp[2,-1]//_/-}" fi curcontext="${curcontext/:[^:]#:/:${_completer}:}" zstyle -a ":completion:${curcontext}:" matcher-list _matchers || _matchers=( '' ) _matcher_num=1 _matcher='' for _c_matcher in "$_matchers[@]"; do if [[ "$_c_matcher" == +* ]]; then _matcher="$_matcher $_c_matcher[2,-1]" else _matcher="$_c_matcher" fi if [[ "$tmp" != _prefix ]] && "$tmp"; then [[ compstate[nmatches] -gt 1 ]] && return 0 compadd -U -i "$IPREFIX" -I "$ISUFFIX" - "${compstate[unambiguous]%$suf}x" compstate[list]= if [[ -n $compstate[unambiguous] ]]; then compstate[insert]=unambiguous else compstate[insert]=0 fi return 0 fi (( _matcher_num++ )) done (( _completer_num++ )) done return 1 PK[`KKfunctions/_x_displaynuW+A#compdef -value-,DISPLAY,-default- _tags displays && _hosts -S ':0 ' -r : PK[cUkkfunctions/_canonical_pathsnuW+A#autoload # This completion function completes all paths given to it, and also tries to # offer completions which point to the same file as one of the paths given # (relative path when an absolute path is given, and vice versa; when ..'s are # present in the word to be completed, and some paths got from symlinks. # Usage: _canonical_paths [-A var] [-N] [-MJV12nfX] tag desc paths... # -A, if specified, takes the paths from the array variable specified. Paths can # also be specified on the command line as shown above. -N, if specified, # prevents canonicalizing the paths given before using them for completion, in # case they are already so. `tag' and `desc' arguments are well, obvious :) In # addition, the options -M, -J, -V, -1, -2, -n, -F, -X are passed to compadd. _canonical_paths_pwd() { # Get the canonical directory name by changing to it. integer chaselinks [[ -o chaselinks ]] && (( chaselinks = 1 )) setopt localoptions nopushdignoredups chaselinks if builtin pushd -q -- $1 2>/dev/null; then REPLY=$PWD (( chaselinks )) || unsetopt chaselinks builtin popd -q else REPLY=$1 fi } _canonical_paths_get_canonical_path() { typeset newfile nondir typeset -A seen REPLY=$1 # Canonicalise the directory path. We may not be able to # do this if we can't read all components. if [[ -d $REPLY ]]; then _canonical_paths_pwd $REPLY else # Resolve any trailing symbolic links, guarding against loops. while [[ -z ${seen[$REPLY]} ]]; do seen[$REPLY]=1 newfile=() zstat -A newfile +link $REPLY 2>/dev/null if [[ -n $newfile[1] ]]; then REPLY=$newfile[1] else break fi done if [[ $REPLY = */*[^/] && $REPLY != /[^/]# ]]; then # Don't try this if there's a trailing slash or we're in # the root directory. nondir=${REPLY##*/#} _canonical_paths_pwd ${REPLY%/#*} REPLY+="/$nondir" fi fi } _canonical_paths_add_paths () { local origpref=$1 expref rltrim curpref canpref subdir [[ $2 != add ]] && matches=() expref=${~origpref} [[ $origpref == (|*/). ]] && rltrim=. curpref=${${expref%$rltrim}:-./} if zstat $curpref >&/dev/null; then _canonical_paths_get_canonical_path $curpref canpref=$REPLY else canpref=$curpref fi [[ $curpref == */ && $canpref == *[^/] ]] && canpref+=/ canpref+=$rltrim [[ $expref == *[^/] && $canpref == */ ]] && origpref+=/ matches+=(${${(M)files:#$canpref*}/$canpref/$origpref}) for subdir in $expref?*(@); do _canonical_paths_add_paths ${subdir/$expref/$origpref} add done } _canonical_paths() { local __index typeset -a __gopts __opts zparseopts -D -a __gopts M: J: V: 1 2 n F: X: A:=__opts N=__opts : ${1:=canonical-paths} ${2:=path} __index=$__opts[(I)-A] (( $__index )) && set -- $@ ${(P)__opts[__index+1]} local expl ret=1 tag=$1 desc=$2 shift 2 if ! zmodload -F zsh/stat b:zstat 2>/dev/null; then _wanted "$tag" expl "$desc" compadd $__gopts $@ && ret=0 return ret fi typeset REPLY typeset -a matches files if (( $__opts[(I)-N] )); then files=($@) else for __index in $@; do _canonical_paths_get_canonical_path $__index files+=($REPLY) done fi local base=$PREFIX typeset -i blimit _canonical_paths_add_paths $base if [[ -z $base ]]; then _canonical_paths_add_paths / add elif [[ $base == ..(/.(|.))#(|/) ]]; then # This style controls how many parent directory links (..) to chase searching # for possible completions. The default is 8. Note that this chasing is # triggered only when the user enters atleast a .. and the path completed # contains only . or .. components. A value of 0 turns off .. link chasing # altogether. zstyle -s ":completion:${curcontext}:$tag" \ canonical-paths-back-limit blimit || blimit=8 if [[ $base != */ ]]; then [[ $base != *.. ]] && base+=. base+=/ fi until [[ $base.. -ef $base || blimit -le 0 ]]; do base+=../ _canonical_paths_add_paths $base add blimit+=-1 done fi _wanted "$tag" expl "$desc" compadd $__gopts -Q -U -a matches && ret=0 return ret } _canonical_paths "$@" PK[l*Ʃ!functions/delete-whole-word-matchnuW+A# Delete the entire word around the cursor. Does not handle # a prefix argument; either the cursor is in the word or it isn't. # The word may be just before the cursor, e.g. # print this is a line # ^ here # and then the word before (i.e. `this') will be deleted. # # If the widget has the name `kill' in, the text deleted will be # saved for future yanking in the normal way. emulate -L zsh setopt extendedglob local curcontext=:zle:$WIDGET local -a matched_words # Start and end of range of characters to remove. integer pos1 pos2 autoload -Uz match-words-by-style match-words-by-style if [[ -n "${matched_words[3]}" ]]; then # There's whitespace before the cursor, so the word we are deleting # starts at the cursor position. pos1=$CURSOR else # No whitespace before us, so delete any wordcharacters there. pos1="${#matched_words[1]}" fi if [[ -n "${matched_words[4]}" ]]; then # There's whitespace at the cursor position, so only delete # up to the cursor position. (( pos2 = CURSOR + 1 )) else # No whitespace at the cursor position, so delete the # current character and any following wordcharacters. (( pos2 = CURSOR + ${#matched_words[5]} + 1 )) fi # Move the cursor then delete the block in one go for the # purpose of undoing (and yanking, if appropriate). (( CURSOR = pos1 )) # If the widget name includes the word `kill', the removed # text goes into the cutbuffer in the standard way. if [[ $WIDGET = *kill* ]]; then local word="${BUFFER[pos1+1,pos2-1]}" if [[ $LASTWIDGET = *kill* ]]; then CUTBUFFER="$CUTBUFFER$word" else zle copy-region-as-kill -- "$word" fi fi BUFFER="${BUFFER[1,pos1]}${BUFFER[pos2,-1]}" PK[9WWfunctions/_valuenuW+A#compdef -value- -array-value- -value-,-default-,-default- # You can customize completion for different parameters by writing # functions with the tag-line `#compdef -value-,,' where # is the name of the parameter (or name-key when completing an # associative array value) and is either `-default-' or the # name of the command from the command-line. if [[ "$service" != -value-,* ]]; then local strs ctx= strs=( -default- ) if [[ "$compstate[context]" != *value && -n "$_comp_command1" ]]; then ctx="${_comp_command}" strs=( "${_comp_command1}" "$strs[@]" ) [[ -n "$_comp_command2" ]] && strs=( "${_comp_command2}" "$strs[@]" ) fi _dispatch -value-,${compstate[parameter]},$ctx \ -value-,{${compstate[parameter]},-default-},${^strs} else if [[ "$compstate[parameter]" != *-* && "$compstate[context]" = *value && "${(Pt)${compstate[parameter]}}" = assoc* ]]; then if (( CURRENT & 1 )); then _wanted association-keys expl 'association key' \ compadd -k "$compstate[parameter]" else compstate[parameter]="${compstate[parameter]}-${words[CURRENT-1]}" _dispatch -value-,${compstate[parameter]}, \ -value-,{${compstate[parameter]},-default-},-default- fi else local pats if { zstyle -a ":completion:${curcontext}:" assign-list pats && [[ "$compstate[parameter]" = (${(j:|:)~pats}) ]] } || [[ "$PREFIX$SUFFIX" = *:* ]]; then compset -P '*:' compset -S ':*' _default -r '\-\n\t /:' "$@" else _default "$@" fi fi fi PK[functions/_antnuW+A#compdef ant -value-,ANT_ARGS,-default- # Apache Ant version 1.7.1 local curcontext="$curcontext" state line expl ret=1 typeset -A opt_args local buildfile classpath cp userjars importedfiles target='*:target:->target' targets tmp find_targets() { importedfiles=( $(sed -n "s/ *]* file=[\"']\([^\"']*\)[\"'].*/\1/p" < $1) ) # Tweaked to omit targets beginning with "-" that can't # be invoked from the command line; see zsh-workers/24129. sed -n "s/ *]* name=[\"']\([^-][^\"']*\)[\"'].*/\1/p" $1 if (( $#importedfiles )) ; then ( cd $1:h for file in $importedfiles ; do expanded=( $(echo $file | sed -n "s|\${ant.home}|$ANT_HOME|p") ) if [[ ! "bla$expanded" = "bla" ]]; then file=$expanded fi if [[ -f $file ]]; then find_targets $file fi done ) fi } if [[ $service = *ANT_ARGS* ]]; then compset -q words=( fake "$words[@]" ) (( CURRENT++ )) unset target fi _arguments -C \ '(- *)'{-h,-help,--h,--help}'[display help information]' \ '--noconfig[suppress sourcing of configuration files]' \ '--usejikes[enable use of jikes by default, unless set explicitly in configuration files]' \ '--execdebug[print ant exec line generated by this launch script]' \ '(-p -projecthelp *)'{-p,-projecthelp}'[print project help information]' \ '(- *)-version[display version information]' \ '(- *)-diagnostics[print information helpful to diagnosis or report problems]' \ '(-q -quiet)'{-q,-quiet}'[be extra quiet]' \ '(-v -verbose)'{-v,-verbose}'[be extra verbose]' \ '(-d -debug)'{-d,-debug}'[print debugging information]' \ '(-e -emacs)'{-e,-emacs}'[produce logging information without adornments]' \ '*-lib[specify a path to search for jars and classes]:class path:->classpath' \ '(-l -logfile)'{-l,-logfile}'[use specified file for log]:logfile:_files' \ '-logger[specify the class which is to perform logging]:class:->class' \ '*-listener[add an instance of specified class as a project listener]:class:->class' \ '-noinput[do not allow interactive input]' \ '(-f -file -buildfile -s -find)'{-f,-file,-buildfile}'[use specified build file]:build file:_files -g "*.xml(-.)"' \ '*-D[specify property with value to use]:property:->property' \ '(-k -keep-going)'{-keep-going,-k}'[execute all targets that do not depend on failed target(s)]' \ '-propertyfile[load all properties from specified file with -D properties taking precedence]:property file:_files -g "*.properties(-.)"' \ '-inputhandler[specify class which will handle input requests]:class:->class' \ '(-s -find -f -file -buildfile)'{-s,-find}'[search for specified build file towards the root of filesystem]:build file:(build.xml)' \ '-nice[specify a niceness value for the main thread]:niceness value (default 5):({1..10})' \ '-nouserlib[run ant without using the jar files from ${user.home}/.ant/lib]' \ '-noclasspath[run ant without using CLASSPATH]' \ '-autoproxy[Java1.5+: use the OS proxy settings]' \ "-main[override Ant's normal entry point]:class:->class" \ $target && ret=0 case $state in class) if (( ! $+opt_args[-nouserlib] )); then userjars=( $HOME/.ant/lib/*.jar ) fi if (( ! $+opt_args[-noclasspath] )); then classpath=$CLASSPATH fi cp=( $opt_args[-lib] $userjars $ANT_HOME/lib/*.jar $classpath ) cp=${(j.:.)cp:-' '} _java_class -classpath $cp && ret=0 ;; classpath) compset -P '*:' compset -S ':*' _alternative \ "classpath:$state:_path_files -qS: -g '*.(jar|zip)(-.)'" \ "classpath:$state:_path_files -r': ' -/" && ret=0 ;; property) if compset -P '*='; then _default && ret=0 else _message -e properties 'property name' fi ;; target) if [[ -n $opt_args[(I)(-s|-find)] ]]; then buildfile=( (../)#${(v)opt_args[(I)(-s|-find)]:-build.xml}(N[-1]) ) else buildfile=${(v)opt_args[(I)(-f|-file|-buildfile)]:-build.xml} fi if [[ -f $buildfile ]]; then if zstyle -t ":completion:${curcontext}:targets" call-command; then # Run ant -projecthelp also passing any of -find, -s, -buildfile, -file # or -f options. # Parse output into an array of the format "target:description". # For the array to be set with correct argument boundaries, the entire # set statement needs to be eval'd. On Cygwin, need to kill \r's output # from Java or parsing will fail. eval set -A tmp "${$(_call_program targets "$words[1]" -buildfile $buildfile -projecthelp | while read target desc do # This loop reads ant -projecthelp output from versions 1.3 to 1.6 ln="${target}${desc:+:$desc}" [[ $target = "" ]] && continue # skip blank lines case $ln in (Buildfile:*) buildfile=$desc ;; (Default:target:*) # with version 1.5, target is on the same line default_target="${${desc/target:/}# }" # versions 1.3 and 1.4 with default target on a separate line if [[ -z $default_target ]]; then read junk read default_target junk fi # Output target again indicating its the default one. print -n "'${default_target}:(Default target) ' " ;; (Searching:*|Main:targets:|Subtargets:|BUILD:SUCCESSFUL|Total:time: *) ;; (*) # Return target and description print -n "'$ln' " ;; esac done )//$'\015'}" _describe 'target' tmp && ret=0 else targets=( $(find_targets $buildfile) ) _wanted targets expl target compadd -a targets && ret=0 fi else _message -e targets target fi ;; esac return ret PK[Tk  functions/_init_dnuW+A#compdef -p */(init|rc[0-9S]#).d/* local cmds script _compskip=all if [[ $OSTYPE = freebsd* ]]; then (( $+functions[_init_d_fullpath] )) || _init_d_fullpath() { local -a scriptpath local name=$1 dir # Known locations of init scripts # C.f. Unix/Type/_services scriptpath=(/etc/rc.d $(/bin/sh -c '. /etc/rc.subr; load_rc_config XXX; echo $local_startup' 2>/dev/null)) for dir in $scriptpath; do if [[ -f $dir/$name ]]; then echo $dir/$name return 0 fi done return 1 } (( $+functions[_init_d_get_cmds] )) || _init_d_get_cmds() { local magic cmds cmd_prefix [[ -x $script ]] || return 1 [[ $(read -u0 -k2 magic < $script && echo $magic) = '#!' ]] || return 0 [[ -f /etc/rc.subr ]] && [[ -x /sbin/rcorder ]] || return 0 grep -q '^ *\. */etc/rc\.subr *$' $script || return 0 cmds=( start stop restart rcvar status poll $(/bin/sh -c "set -- rcvar; . $script >/dev/null; echo \$extra_commands" 2>/dev/null) ) for cmd_prefix in {,one,fast,force,quiet}; do echo ${cmds/#/$cmd_prefix} done return 0 } else (( $+functions[_init_d_fullpath] )) || _init_d_fullpath() { local -a scriptpath local name=$1 dir # Known locations of init scripts # C.f. Unix/Type/_services scriptpath=(/etc/init.d /etc/rc.d /etc/rc.d/init.d) for dir in $scriptpath; do if [[ -f $dir/$name ]]; then echo $dir/$name return 0 fi done return 1 } (( $+functions[_init_d_get_cmds] )) || _init_d_get_cmds() { local what magic cmds # If the file starts with `#!' we hope that this is a shell script # and get lines looking like foo|bar) with the words in $what. what='(st(art|op|atus)|(force-|)re(start|load)|debug_(up|down)|dump(|_stats)|add|delete|clean|list)' read -u0 -k2 magic < $script && [[ $magic = '#!' ]] && cmds=( ${${(j:|:s:|:)${(M)${(f)"$(< $script)"}:#[[:blank:]]#(\'|)${~what}([[:blank:]]#\|[[:blank:]]#${~what})#(\'|)\)}}//[^-a-z_]} ) # This would be the pattern to use every line of the form foo). # Some people say this might match too many lines... # # cmds=( ${${(j:|:s:|:)${(M)${(f)"$(< $script)"}:#[[:blank:]]#(\'|)[a-z_|]##\'|)\)}}//[^a-z_]} ) echo $cmds return 0 } fi script=$words[1] [[ $script = */* ]] || script="$(_init_d_fullpath "$script")" cmds=( $(_init_d_get_cmds) ) || return (( $#cmds )) || zstyle -a ":completion:${curcontext}:commands" commands cmds || cmds=(start stop) _sub_commands $cmds PK[%functions/_ponnuW+A#compdef pon poff case "$service" in (pon) _arguments \ '(-q --quick)'{-q,--quick}'[hangs up after all ip-up scripts are run]' \ '1:provider to call:_files -W /etc/ppp/peers' ;; (poff) _arguments \ '-r[drop the line and redial]' \ '-d[toggle state of debug option]' \ '-c[renegotiate compression]' \ '-a[stop all pppds]' \ '-h[help]' \ '-v[version]' \ '1:provider to disconnect:_files -W /etc/ppp/peers' ;; esac PK[Y11functions/checkmailnuW+A#!/bin/zsh # # This autoloadable function checks the folders specified as arguments # for new mails. The arguments are interpreted in exactly the same way # as the mailpath special zsh parameter (see zshparam(1)). # # If no arguments are given mailpath is used. If mailpath is empty, $MAIL # is used and if that is also empty, /var/spool/mail/$LOGNAME is used. # This function requires zsh-3.0.1 or newer. # emulate -L zsh local file message for file in "${@:-${mailpath[@]:-${MAIL:-/var/spool/mail/$LOGNAME}}}" do message="${${(M)file%%\?*}#\?}" file="${file%%\?*}" if [[ -d "$file" ]] then file=( "$file"/**/*(.ND) ) if (($#file)) then checkmail ${^file}\?$message fi elif test -s "$file" -a -N "$file"; then # this also sets $_ to $file print -r -- "${(e)message:-You have new mail.}" fi done PK[Tfunctions/_cygservernuW+A#compdef cygserver cygserver.exe # cygwin 1.5.25 _arguments -s -S \ '(--config-file -f)'{-f,--config-file}'[use specified file as config file (default /etc/cygserver.conf)]:config file:_files -g "*.conf(-.)"' \ '(--cleanup-threads -c)'{-c,--cleanup-threads}'[number of cleanup threads to use (default 2)]:number of threads:' \ '(--process-cache -p)'{-p,--process-cache}'[size of process cache]:cache size:' \ '(--request-threads -r)'{-r,--request-threads}'[number of request threads to use (default 10)]:number of threads:' \ '(--debug -d)'{-d,--debug}'[log debug messages to stderr]' \ '(--stderr -e --no-stderr -E)'{-e,--stderr}'[log to stderr (default if stderr is a tty)]' \ '(--stderr -e --no-stderr -E)'{-E,--no-stderr}"[don't log to stderr (see -y, -Y options)]" \ '(--log-level -l)'{-l,--log-level}'[verbosity of logging (1..7) (default 6)]:verbosity level:({1..7})' \ '(--syslog -y --no-syslog -Y)'{-y,--syslog}'[log to syslog (default if stderr is no tty)]' \ '(--syslog -y --no-syslog -Y)'{-Y,--no-syslog}"[don't log to syslog (see -e, -E options)]" \ '(--no-sharedmem -m)'{-m,--no-sharedmem}"[don't start XSI Shared Memory support]" \ '(--no-msgqueues -q)'{-q,--no-msgqueues}"[don't start XSI Message Queue support]" \ '(--no-semaphores -s)'{-s,--no-semaphores}"[don't start XSI Semaphore support]" \ '(--shutdown -S)'{-S,--shutdown}'[shutdown the daemon]' \ '(--help -h)'{-h,--help}'[output usage information and exit]' \ '(--version -v)'{-v,--version}'[output version information and exit]' PK[Ԇ..functions/_menunuW+A#autoload [[ _matcher_num -gt 1 ]] && return 1 # This completer is an example showing how menu completion can be # implemented with the new completion system. # Use this one before the normal _complete completer, as in: # # zstyle ":completion:::::" completer _menu _complete if [[ -n "$compstate[old_list]" ]]; then # We have an old list, keep it and insert the next match. compstate[old_list]=keep compstate[insert]=$((compstate[old_insert]+1)) else # No old list, make completion insert the first match. compstate[insert]=1 fi return 1 PK[Pfunctions/VCS_INFO_maxexportsnuW+A## vim:ft=zsh ## Written by Frank Terbeck ## Distributed under the same BSD-ish license as zsh itself. setopt localoptions NO_shwordsplit zstyle -s ":vcs_info:${vcs}:${usercontext}:${rrn}" "max-exports" maxexports || maxexports=2 if [[ ${maxexports} != <-> ]] || (( maxexports < 1 )); then printf 'vcs_info(): expecting numeric arg >= 1 for max-exports (got %s).\n' ${maxexports} printf 'Defaulting to 2.\n' maxexports=2 fi return 0 PK[WE*"$"$functions/_subversionnuW+A#compdef svn svnadmin svnadmin-static=svnadmin _svn () { local curcontext="$curcontext" state line expl ret=1 typeset -A opt_args _arguments -C \ '(-)--help[print help information]' \ '(- *)--version[print client version information]' \ '1: :->cmds' \ '*:: :->args' && ret=0 if [[ -n $state ]] && (( ! $+_svn_cmds )); then typeset -gHA _svn_cmds _svn_cmds=( ${=${(f)${${"$(LC_ALL=C _call_program commands svn help)"#l#*Available subcommands:}%%Subversion is a tool*}}/(#s)[[:space:]]#(#b)([a-z]##)[[:space:]]#(\([a-z, ?]##\))#/$match[1] :$match[1]${match[2]:+:${${match[2]//[(),]}// /:}}:} ) fi case $state in cmds) _wanted commands expl 'svn command' _svn_commands && ret=0 ;; args) local cmd args usage typeset -gHA _cache_svn_status _cache_svn_mtime cmd="${${(k)_svn_cmds[(R)*:$words[1]:*]}:-${(k)_svn_cmds[(i):$words[1]:]}}" if (( $#cmd )); then curcontext="${curcontext%:*:*}:svn-${cmd}:" usage=${${(M)${(f)"$(LC_ALL=C _call_program options svn help $cmd)"}:#usage:*}#usage:*$cmd] } args=( ${=${${${(M)${(f)"$(LC_ALL=C _call_program options svn help $cmd)"#(*Valid options:|(#e))}:#* :*}%% #:*}/ (arg|ARG)/:arg:}/(#b)-([[:alpha:]]) \[--([a-z-]##)\](:arg:)#/(--$match[2])-$match[1]$match[3] (-$match[1])--$match[2]$match[3]} ) case $cmd in; (add) args+=( '*:file:_files -g "*(^e:_svn_controlled:)"' ) ;; (commit) args=( ${args/(#b)(*--file*):arg:/$match[1]:file:_files} '*:file:_files -g "*(e:_svn_status:)"' ) ;; (delete) args+=( '*:file:_files -g ".svn(/e:_svn_deletedfiles:)"' ) ;; (diff) args+=( '*: : _alternative "files:file:_files -g \*\(e:_svn_status:\)" "urls:URL:_svn_urls"' ) ;; (help) args+=( '*::sub command:_svn_commands' ) ;; (import) args+=( '1:project directory or import location: _alternative "files:file:_files" "urls:URL:_svn_urls"' '2:import location: _alternative "files:file:_files" "urls:URL:_svn_urls"' ) ;; (log) args+=( '1: : _alternative "files:file:_files -g \*\(e:_svn_controlled:\)" "urls:URL:_svn_urls"' '*:file:_files -g "*(e:_svn_controlled:)"' ) ;; (propget|propedit) args+=( '1:property name:_svn_props' '2:target: _alternative "files:file:_files" "urls:URL:_svn_urls"' ) ;; (propset) args=( ':propname:(svn:ignore svn:keywords svn:executable svn:eol-style svn:mime-type svn:externals svn:needs-lock)' ${args/(#b)(*--file*):arg:/$match[1]:file:_files} '*:path or url: _alternative "files:file:_files" "urls:URL:_svn_urls"' ) ;; (resolved) args+=( '*:file:_files -g "*(e:_svn_conflicts:)"' ) ;; (revert) args+=( '*:file:_files -g "(.svn|*)(/e:_svn_deletedfiles:,e:_svn_status:)"' ) ;; (*) case $usage in *(SRC|DST|TARGET|URL*PATH)*) args+=( '*: : _alternative "files:file:_files" "urls:URL:_svn_urls"' ) ;; *URL*) args+=( ':URL:_svn_urls' ) ;; *PATH*) args+=( '*:file:_files' ) ;; esac ;; esac _arguments "$args[@]" && ret=0 else _message "unknown svn command: $words[1]" fi ;; esac return ret } _svnadmin () { local curcontext="$curcontext" state line ret=1 _arguments -C \ '(-)--help[print help information]' \ '(- *)--version[print client version information]' \ '1: :->cmds' \ '*:: :->args' && ret=0 if [[ -n $state ]] && (( ! $+_svnadmin_cmds )); then typeset -gHA _svnadmin_cmds _svnadmin_cmds=( ${=${(f)${${"$(LC_ALL=C _call_program commands svnadmin help)"#l#*Available subcommands:}}}/(#s)[[:space:]]#(#b)([-a-z]##)[[:space:]]#(\([a-z, ?]##\))#/$match[1] :$match[1]${match[2]:+:${${match[2]//[(),]}// /:}}:} ) fi case $state in cmds) _wanted commands expl 'svnadmin command' _svnadmin_commands && ret=0 ;; args) local cmd args usage cmd="${${(k)_svnadmin_cmds[(R)*:$words[1]:*]}:-${(k)_svnadmin_cmds[(i):$words[1]:]}}" if (( $#cmd )); then curcontext="${curcontext%:*:*}:svnadmin-${cmd}:" usage=${${(M)${(f)"$(LC_ALL=C _call_program options svnadmin help $cmd)"}:#$cmd: usage:*}#$cmd: usage: svnadmin $cmd } args=( ${=${${${(M)${(f)"$(LC_ALL=C _call_program options svnadmin help $cmd)"#(*Valid options:|(#e))}:#* :*}%% #:*}/ (arg|ARG)/:arg:}/(#b)-([[:alpha:]]) \[--([a-z-]##)\](:arg:)#/(--$match[2])-$match[1]$match[3] (-$match[1])--$match[2]$match[3]} ) if [[ $usage == *REPOS_PATH* ]]; then args+=( ":path:_files -/" ) elif [[ $cmd = help ]]; then args+=( "*:subcommand:_svnadmin_commands" ) fi _arguments "$args[@]" && ret=0 else _message "unknown svnadmin command: $words[1]" fi ;; esac return ret } (( $+functions[_svn_controlled] )) || _svn_controlled() { [[ -f ${(M)REPLY##*/}.svn/text-base/${REPLY##*/}.svn-base ]] } (( $+functions[_svn_conflicts] )) || _svn_conflicts() { [ -n $REPLY.(mine|r<->)(N[1]) ] } (( $+functions[_svn_deletedfiles] )) || _svn_deletedfiles() { # Typical usage would be _files -g '.svn(/e:_svn_deletedfiles:)' local cont controlled reply=( ) [[ $REPLY = (*/|).svn ]] || return controlled=( $REPLY/text-base/*.svn-base(N:r:t) ) for cont in ${controlled}; do [[ -e $REPLY:h/$cont ]] || reply+=( ${REPLY%.svn}$cont ) done } (( $+functions[_svn_status] )) || _svn_status() { local dir=$REPLY:h local pat="${1:-([ADMR~]|?M)}" zmodload -F zsh/stat b:zstat 2>/dev/null local key="$(zstat +device $dir):$(zstat +inode $dir)" local mtime="$(zstat +mtime $dir/.svn/entries)" if (( ! $+_cache_svn_status[$key] || _cache_svn_mtime[$key] != mtime )); then _cache_svn_status[$key]="$(_call_program files svn status -N $dir)" _cache_svn_mtime[$key]="$mtime" fi (( ${(M)#${(f)_cache_svn_status[$key]}:#(#s)${~pat}*$REPLY} )) } (( $+functions[_svn_remote_paths] )) || _svn_remote_paths() { local expl remfiles remdispf remdispd suf ret=1 pfx='\^/' sub='^/' # prefix must match a valid repository path format, either standard style # schema://host/path/.. or ^/path/.. specifying a path relative to the # root of the working directory repository. In the second form, allow the # leading '^' be escaped in case the user has the extendedglob option set. [[ -prefix *://*/ ]] || [[ -f .svn/entries && ( -prefix '^/' || -prefix '\^/' ) ]] || return 1 # return if remote access is not permitted zstyle -T ":completion:${curcontext}:" remote-access || return 1 remfiles=( ${(f)"$(svn list $IPREFIX${${PREFIX%%[^/]#}/#$pfx/$sub} 2>/dev/null)"} ) (( $? == 0 )) || return 1 # you might consider trying to return early if $#remfiles is zero, # but for whatever reason remfiles will always contain at least a # single empty string; that case is handled correctly below. compset -P '*/' compset -S '/*' || suf=file remdispf=(${remfiles:#*/}) remdispd=(${(M)remfiles:#*/}) _tags files while _tags; do while _next_label files expl ${suf:-directory}; do # add files, unless there is a '/' immediately to the right [[ -n $suf ]] && compadd -S ' ' -q "$@" "$expl[@]" -d remdispf $remdispf && ret=0 # add directories; use empty suffix if there is a '/' immediately to the right compadd -S "${suf:+/}" -q "$@" "$expl[@]" -d remdispd ${remdispd%/} && ret=0 done (( ret )) || return 0 done return 1 } (( $+functions[_svn_urls] )) || _svn_urls() { local urlsch expl ret=1 # first try completing a remote path; if successful, we are all done.. _svn_remote_paths && return 0 # allow configuring svn repository locations using the 'urls' zstyle. # always attempt completion of these because then matcher-list styles # which do substring matching will work correctly. _urls -S/ && ret=0 if [[ ! -prefix *://? ]] ; then zstyle -a ":completion:${curcontext}:" url-schemas urlsch \ || urlsch=( file:// http:// https:// svn:// svn+ssh:// ) if (( $#urlsch )) ; then compset -S '[^:]*' _wanted url-schemas expl 'URL schema' compadd -S '' - $urlsch[@] && ret=0 fi fi return ret } (( $+functions[_svn_commands] )) || _svn_commands() { compadd "$@" -k _svn_cmds || compadd "$@" ${(s.:.)_svn_cmds} } (( $+functions[_svnadmin_command] )) || _svnadmin_commands() { compadd "$@" -k _svnadmin_cmds || compadd "$@" ${(s.:.)_svnadmin_cmds} } (( $+functions[_svn_props] )) || _svn_props() { local properties properties=( ${${(M)${(f)"$(svn proplist 2>/dev/null)"}:# [^ ]*}# } ) compadd "$@" -a properties && return 0 } _subversion () { case $service in (svn) _svn "$@" ;; (svnadmin) _svnadmin "$@" ;; esac } _subversion "$@" PK[mȿ!!functions/zftp_progressnuW+A# function zftp_progress { # Basic progress metre, showing the percent of the file transferred. # You want growing bars? You gottem. # styles used (context :zftp:zfparent_function:): # progress # empty or `none' no progress meter # `bar' use a growing bar of inverse video # `percent' or other non-blank show the percentage transferred # If size of remote file is not available, `bar' or `percent' just show # bytes. # update # Minimum time in seconds between updates of the progress display. local style update=1 # What style: either bar for growing bars, or anything else for simple # percentage. For bar we need to have the terminal width in COLUMNS, # which is often set automatically, but you never know. zstyle -s ":zftp$curcontext" progress style # How many seconds to wait before printing an updated progress report. zstyle -s ":zftp$curcontext" update update # Don't show progress unless stderr is a terminal [[ ! -t 2 || $style = (|none) ]] && return 0 if [[ -n $ZFTP_TRANSFER ]]; then # avoid a `parameter unset' message [[ $ZFTP_TRANSFER != *F ]] && (( ${+zftpseconds} )) && (( SECONDS - zftpseconds < update )) && return # size is usually ZFTP_SIZE, but zftransfer may set ZFTP_TSIZE local size=${ZFTP_TSIZE:-$ZFTP_SIZE} if [[ ${size:-0} -ne 0 ]]; then local frac="$(( ZFTP_COUNT * 100 / size ))%" if [[ $style = bar && ${+COLUMNS} = 1 && $COLUMNS -gt 0 ]]; then if (( ! ${+zftpseconds} )); then print "$ZFTP_FILE ($size bytes): $ZFTP_TRANSFER" 1>&2 fi integer maxwidth=$(( COLUMNS - 7 )) local width="$(( ZFTP_COUNT * maxwidth / size ))" print -nP "\r%S${(l:width:):-}%s${(l:maxwidth-width:):-}: ${frac}%%" 1>&2 else print -n "\r$ZFTP_FILE ($size bytes): $ZFTP_TRANSFER $frac" 1>&2 fi else print -n "\r$ZFTP_FILE: $ZFTP_TRANSFER $ZFTP_COUNT" 1>&2 fi if [[ $ZFTP_TRANSFER = *F && ${+zftpseconds} = 1 ]]; then unset zftpseconds print 1>&2 else typeset -g zftpseconds=$SECONDS fi fi # } PK[C[``functions/add-zsh-hooknuW+A# Add to HOOK the given FUNCTION. # HOOK is one of chpwd, precmd, preexec, periodic, zshaddhistory, # zshexit (the _functions subscript is not required). # # With -d, remove the function from the hook instead; delete the hook # variable if it is empty. # # -D behaves like -d, but pattern characters are active in the # function name, so any matching function will be deleted from the hook. # # Without -d, the FUNCTION is marked for autoload; -U is passed down to # autoload if that is given, as are -z and -k. (This is harmless if the # function is actually defined inline.) emulate -L zsh local -a hooktypes hooktypes=(chpwd precmd preexec periodic zshaddhistory zshexit) local opt local -a autoopts integer del while getopts "dDUzk" opt; do case $opt in (d) del=1 ;; (D) del=2 ;; ([Uzk]) autoopts+=(-$opt) ;; (*) return 1 ;; esac done shift $(( OPTIND - 1 )) if (( $# != 2 || ${hooktypes[(I)$1]} == 0 )); then print "Usage: $0 hook function\nValid hooks are:\n $hooktypes" return 1 fi local hook="${1}_functions" local fn="$2" if (( del )); then # delete, if hook is set if (( ${(P)+hook} )); then if (( del == 2 )); then set -A $hook ${(P)hook:#${~fn}} else set -A $hook ${(P)hook:#$fn} fi # unset if no remaining entries --- this can give better # performance in some cases if (( ! ${(P)#hook} )); then unset $hook fi fi else if (( ${(P)+hook} )); then if (( ${${(P)hook}[(I)$fn]} == 0 )); then set -A $hook ${(P)hook} $fn fi else set -A $hook $fn fi autoload $autoopts -- $fn fi PK[*֤ functions/agenuW+A# Match the age of a file, for use as a glob qualifer. Can # take one or two arguments, which can be supplied by one of two # ways (always the same for both arguments): # # print *(e:age 2006/10/04 2006/10/09:) # # Match all files modified between the start of those dates. # # print *(e:age 2006/10/04:) # # Match all files modified on that date. If the second argument is # omitted it is taken to be exactly 24 hours after the first argument # (even if the first argument contains a time). # # print *(e-age 2006/10/04:10:15 2006/10/04:10:45-) # # Supply times. All the time and formats handled by calendar_scandate # are allowed, but whitespace must be quoted to ensure age receives # the correct arguments. # # AGEREF1=2006/10/04:10:15 # AGEREF2=2006/10/04:10:45 # print *(+age) # # The same example using the other form of argument passing. The # dates stay in effect until unset, but will be overridden if # any argument is passed in the first format. emulate -L zsh zmodload -F zsh/stat b:zstat zmodload -i zsh/parameter autoload -Uz calendar_scandate local -a vals tmp [[ -e $REPLY ]] || return 1 zstat -A vals +mtime $REPLY || return 1 if (( $# >= 1 )); then if [[ $1 = :* ]]; then zstat -A tmp -F "%Y/%m/%d" +mtime ${1[2,-1]} || return 1 local AGEREF=$tmp[1] else local AGEREF=$1 fi # if 1 argument given, never use globally defined AGEREF2 if [[ $2 = :* ]]; then zstat -A tmp -F "%Y/%m/%d" +mtime ${2[2,-1]} || return 1 local AGEREF2=$tmp[1] else local AGEREF2=$2 fi fi integer mtime=$vals[1] date1 date2 local REPLY REPLY2 # allow a time only (meaning today) if calendar_scandate -t $AGEREF; then date1=$REPLY if [[ -n $AGEREF2 ]]; then if [[ $AGEREF2 = +* ]]; then calendar_scandate -rt $AGEREF2[2,-1] || return 1 (( date2 = date1 + REPLY )) else calendar_scandate -t $AGEREF2 || return 1 date2=$REPLY fi else (( date2 = date1 + 24 * 60 * 60 )) fi (( date1 <= mtime && mtime <= date2 )) else return 1 fi PK[mfunctions/_dirsnuW+A#compdef dirs _arguments -s \ '(-)-c[clear the directory stack]' \ '(* -c)-l[display directory names in full]' \ '(* -c)-v[display numbered list of directory stack]' \ '(* -c)-p[display directory entries one per line]' \ '(-)*:directory:_directories' PK[hhfunctions/_portlintnuW+A#compdef portlint _arguments -s \ '-a[additional check for scripts/* and pkg-*]' \ '-A[turn on all additional checks (equivalent to -abcNt)]' \ '-b[warn $(VARIABLE)]' \ '-c[committer mode]' \ '-C[pedantic committer mode (equivalent to -abct)]' \ '-g[group errors together to avoid duplication (disabled if -v is specified)]' \ '-h[show summary of command line options]' \ '-v[verbose mode]' \ '-t[nit pick about use of spaces]' \ '-N[writing a new port]' \ '-V[print the version and exit]' \ '-M[set make variables to ENV (ex. PORTSDIR=/usr/ports.work)]: :_guard ".#" "environment vars"' \ '-B[allow # contiguous blank lines]: :_guard "[0-9]#" "numeric value"' \ ':port directory:_files -/' PK[@sHHfunctions/_globqualsnuW+A#autoload local state=qual expl char delim local -a alts while [[ -n $PREFIX ]]; do char=$PREFIX[1] compset -p 1 case $char in ([-/F.@=p*rwxAIERWXsStUG^MTNDn,]) # no argument ;; (%) # optional b, c if [[ $PREFIX[1] = [bc] ]]; then compset -p 1 fi ;; (f) if ! compset -P "[-=+][0-7?]##"; then if [[ -z $PREFIX ]]; then _delimiters qualifier-f return elif ! _globqual_delims; then # still completing mode spec _message -e modes "mode spec" return fi fi ;; (P) # skip delimited prefix if [[ -z $PREFIX ]]; then _delimiters qualifier-P return elif ! _globqual_delims; then # can't suggest anything here _message -e prefix prefix return fi ;; (e) # complete/skip delimited command line if [[ -z $PREFIX ]]; then _delimiters qualifer-e return elif ! _globqual_delims; then # still completing command to eval compset -q _normal return fi ;; (+) # complete/skip command name (no delimiters) if [[ $PREFIX = [[:IDENT:]]# ]]; then # either nothing there yet, or still on name _command_names return fi compset -P '[[:IDENT:]]##' ;; (d) # complete/skip device if ! compset -p '[[:digit:]]##'; then _message -e device-ids "device ID" return fi ;; (l) # complete/skip link count if ! compset -P '([-+]|)[[:digit:]]##'; then _message -e numbers "link count" return fi ;; (u) # complete/skip UID or delimited user if ! compset -P '[[:digit:]]##'; then if [[ -z $PREFIX ]]; then _delimiters qualifier-u return elif ! _globqual_delims; then # still completing user _users -S $delim return fi fi ;; (g) # complete/skip GID or delimited group if ! compset -P '[[:digit:]]##'; then if [[ -z $PREFIX ]]; then _delimiters qualifier-g return elif ! _globqual_delims; then # still completing group _groups -S $delim return fi fi ;; ([amc]) if ! compset -P '([Mwhms]|)([-+]|)<->'; then # complete/skip relative time spec alts=() if ! compset -P '[Mwhms]' && [[ -z $PREFIX ]]; then alts+=( "time-specifiers:time specifier:\ ((M\:months w\:weeks h\:hours m:\minutes s\:seconds))") fi if ! compset -P '[-+]' && [[ -z $PREFIX ]]; then alts+=("senses:sense:((-\:less\ than +\:more\ than))") fi alts+=('digits:digit: ') _alternative $alts return fi ;; (L) # complete/skip file size if ! compset -P '([kKmMpP]|)([-+]|)<->'; then # complete/skip size spec alts=() if ! compset -P '[kKmMpP]' && [[ -z $PREFIX ]]; then alts+=( "size-specifiers:size specifier:\ ((k\:kb m\:mb p\:512-byte\ blocks))") fi if ! compset -P '[-+]' && [[ -z $PREFIX ]]; then alts+=("senses:sense:((-\:less\ than +\:more\ than))") fi alts+=('digits:digit: ') _alternative $alts return fi ;; ([oO]) # complete/skip sort spec if ! compset -P "?"; then alts=( "n:lexical order of name" "L:size of file" "l:number of hard links" "a:last access time" "m:last modification time" "c:last inode change time" "d:directory depth" "N:no sorting" "e:execute code" "+:+ command name" ) _describe -t sort-specifiers "sort specifier" alts -Q -S '' return elif [[ $IPREFIX[-1] = e ]]; then if [[ -z $PREFIX ]]; then _delimiters qualifier-oe return elif ! _globqual_delims; then compset -q _normal return fi elif [[ $IPREFIX[-1] = + ]]; then if [[ $PREFIX = [[:IDENT:]]# ]]; then # either nothing there yet, or still on name _command_names return fi fi ;; (\[) # complete/skip range: check for closing bracket if ! compset -P "(-|)[[:digit:]]##(,(-|)[[:digit:]]##|)]"; then if compset -P "(-|)[[:digit:]]##,"; then _message "end of range" else _message "start of range" fi return fi ;; (:) # complete modifiers and don't stop completing them _history_modifiers q return ;; esac done case $state in (qual) local -a quals quals=( "/:directories" "F:non-empty directories" ".:plain files" "@:symbolic links" "=:sockets" "p:name pipes (FIFOS)" "*:executable plain files" "%:device files" "r:owner-readable" "w:owner-writeable" "x:owner-executable" "A:group-readable" "I:group-writeable" "E:group-executable" "R:world-readable" "W:world-writeable" "X:world-executable" "s:setuid" "S:setgid" "t:sticky bit set" "f:+ access rights" "e:execute code" "+:+ command name" "d:+ device" "l:+ link count" "U:owned by EUID" "G:owned by EGID" "u:+ owning user" "g:+ owning group" "a:+ access time" "m:+ modification time" "c:+ inode change time" "L:+ size" "^:negate qualifiers" "-:follow symlinks toggle" "M:mark directories" "T:mark types" "N:use NULL_GLOB" "D:glob dots" "n:numeric glob sort" "o:+ sort order, up" "O:+ sort order, down" "P:prepend word" "[:+ range of files" "):end of qualifiers" "\::modifier" ) _describe -t globquals "glob qualifier" quals -Q -S '' ;; esac PK[YJQQfunctions/_ionicenuW+A#compdef ionice _arguments \ '(* -)-h[display usage information]' \ '(*)-p[interpret args as process ID]:pid:_pids' \ '-c+[scheduling class]:class:(( 1\:realtime 2\:best-effort 3\:idle ))' \ '-n+[scheduling class priority]:class-priority:(( 0\:high\ priority {6..1}\: 7\:low\ priority ))' \ '*::command:_normal' PK[evfunctions/_webbrowsernuW+A#compdef amaya arena chimera dillo express galeon grail gzilla hotjava konqueror light mmm Mosaic netrik opera phoenix retawq skipstone www xmosaic zen _alternative 'files:file:_files' 'urls:URL:_urls' PK[} functions/_combinationnuW+A#autoload # Usage: # _combination [-s S] TAG STYLE \ # Ki1[:Ni1]=Pi1 Ki2[:Ni2]=Pi2 ... Kim[:Nim]=Pim Kj[:Nj] EXPL... # # STYLE should be of the form K1-K2-...-Kn. # # Example: telnet # # Assume a user sets the style `users-hosts-ports' as for the my-accounts # tag: # # zstyle ':completion:*:*:telnet:*:my-accounts' users-hosts-ports \ # @host0: user1@host1: user2@host2: # @mail-server:{smtp,pop3} # @news-server:nntp # @proxy-server:8000 # # # `_telnet' completes hosts as: # # _combination my-accounts users-hosts-ports \ # ${opt_args[-l]:+users=${opt_args[-l]:q}} \ # hosts "$expl[@]" # # This completes `host1', `host2', `mail-server', `news-server' and # `proxy-server' according to the user given with `-l' if it is exists. # And if it is failed, `_hosts' is called. # # `_telnet' completes ports as: # # _combination my-accounts users-hosts-ports \ # ${opt_args[-l]:+users=${opt_args[-l]:q}} \ # hosts="${line[2]:q}" \ # ports "$expl[@]" # # This completes `smtp', `pop3', `nntp' and `8000' according to the # host argument --- $line[2] and the user option argument if it is # exists. And if it is failed, `_ports' is called. # # `_telnet' completes users for an argument of option `-l' as: # # _combination my-accounts users-hosts-ports \ # ${line[2]:+hosts="${line[2]:q}"} \ # ${line[3]:+ports="${line[3]:q}"} \ # users "$expl[@]" # # This completes `user1' and `user2' according to the host argument and # the port argument if they are exist. And if it is failed, `_users' is # called. local sep tag style keys pats key num tmp if [[ "$1" = -s ]]; then sep="$2" shift 2 elif [[ "$1" = -s* ]]; then sep="${1[3,-1]}" shift else sep=: fi tag="$1" style="$2" shift 2 keys=( ${(s/-/)style} ) pats=( "${(@)keys/*/*}" ) while [[ "$1" = *=* ]]; do tmp="${1%%\=*}" key="${tmp%:*}" if [[ $1 = *:* ]]; then num=${tmp##*:} else num=1 fi pats[$keys[(in:num:)$key]]="${1#*\=}" shift done key="${1%:*}" if [[ $1 = *:* ]]; then num=${1##*:} else num=1 fi shift if zstyle -a ":completion:${curcontext}:$tag" "$style" tmp; then eval "tmp=( \"\${(@M)tmp:#\${(j($sep))~pats}}\" )" if (( keys[(in:num:)$key] != 1 )); then eval "tmp=( \${tmp#\${(j(${sep}))~\${(@)\${(@)keys[2,(rn:num:)\$key]}/*/*}}${~sep}} )" fi tmp=( ${tmp%%${~sep}*} ) compadd "$@" -a tmp || { (( $+functions[_$key] )) && "_$key" "$@" } else (( $+functions[_$key] )) && "_$key" "$@" fi PK[9o--functions/_in_varednuW+A#compdef -vared- local also # Completion inside vared. if [[ $compstate[vared] = *\[* ]]; then if [[ $compstate[vared] = *\]* ]]; then # vared on an array-element compstate[parameter]=${${compstate[vared]%%\]*}//\[/-} compstate[context]=value also=-value- else # vared on an array-value compstate[parameter]=${compstate[vared]%%\[*} compstate[context]=value also=-value- fi else # vared on a parameter, let's see if it is an array compstate[parameter]=$compstate[vared] if [[ ${(tP)compstate[vared]} = *(array|assoc)* ]]; then compstate[context]=array_value also=-array-value- else compstate[context]=value also=-value- fi fi # Don't insert TAB in first column. Never. compstate[insert]="${compstate[insert]//tab /}" _dispatch "$also" "$also" PK[+{"k  functions/_perlnuW+A#compdef perl # # zsh completion code for the Perl interpreter # Adam Spiers # _perl () { _arguments -s \ '-0-:input record separator in octal (\0, if no argument): ' \ '-a[autosplit mode with -n or -p (splits $_ into @F)]' \ "-c[check syntax only (runs BEGIN and END blocks)]" \ '-d[run scripts under debugger]' \ '-d\:-[run under control of a debugging/tracing module]:debugging/tracing module:_perl_modules --strip-prefix --perl-hierarchy=Devel' \ '-D-:set debugging flags (argument is a bit mask or flags): ' \ "*-e+:one line of script. Several -e's allowed. Omit [programfile]." \ "-F-:split() pattern for autosplit (-a). The //'s are optional.: " \ '-h[list help summary]' \ '-i-[edit <> files in place (make backup if extension supplied)]:backup file extension: ' \ '*-I-[specify @INC/#include directory (may be used more than once)]:include path:_files -/' \ '-l-[enable line ending processing, specifies line terminator]:output record separator in octal: ' \ \*{-m,-M}"-[module.. executes \`use/no module...' before executing your script]:module:_perl_m_opt" \ "-n[assume 'while (<>) { ... }' loop around your script]" \ "-p[assume loop like -n but print line also like sed]" \ "-P[run script through C preprocessor before compilation]" \ "-s[enable some switch parsing for switches after script name]" \ "-S[look for the script using PATH environment variable]" \ "-T[turn on tainted checks]" \ "-u[dump core after parsing script]" \ "-U[allow unsafe operations]" \ "-v[print version number, patchlevel plus VERY IMPORTANT perl info]" \ "-V-[print perl configuration information]:configuration keys:_perl_config_vars" \ '-w[turn warnings on for compilation of your script. Recommended]' \ '-x-[strip off text before #!perl line and perhaps cd to directory]:directory to cd to:_files -/' \ '1:Perl script:_files -/ -g "*.(p[ml]|PL|t)(-.)"' \ '*::args: _normal' } _perl_m_opt () { compset -P '-' if compset -P '*='; then _message -e module-arguments 'module arguments, comma separated' else _perl_modules -S= -q fi } _perl_config_vars () { if (( ! $+_perl_config_vars )); then _perl_config_vars=( $(perl -MConfig -e 'print join("\n", keys %Config);') ) fi local add_colon='-P:' compset -P '*:' && add_colon='' local delimiter='\ ' (( compstate[quoting] )) && delimiter=' ' compset -P '* ' && compset -q compadd "$expl[@]" $add_colon -S$delimiter -q -a _perl_config_vars } _perl "$@" PK[r`FFfunctions/_varednuW+A#compdef vared _arguments -s -A "-*" \ '(-a)-A[edit associative array]' \ '(-A)-a[edit array parameter]' \ "-c[create parameter or change type]" \ '-p+[specify left prompt]:prompt' \ '-r+[specify right prompt]:right prompt' \ '-h[allow access to history]' \ '-e[exit on EOF (^D)]' \ '1:parameter spec:_vars' PK[Eoqqfunctions/_ttyctlnuW+A#compdef ttyctl _arguments '(-u)-f[freeze terminal settings]' \ '(-f)-u[unfreeze terminal settings]' PK[u3&BBfunctions/VCS_INFO_check_comnuW+A## vim:ft=zsh ## Written by Frank Terbeck ## Distributed under the same BSD-ish license as zsh itself. setopt localoptions NO_shwordsplit case $1 in (/*) [[ -x $1 ]] && return 0 ;; (*) (( ${+commands[$1]} )) && [[ -x ${commands[$1]} ]] && return 0 esac return 1 PK[0c& functions/_complete_helpnuW+A#compdef -k complete-word \C-xh _complete_help() { eval "$_comp_setup" local _sort_tags=_help_sort_tags text i j k tmp typeset -A help_funcs help_tags help_sfuncs help_styles compadd() { return 1 } zstyle() { local _f="${${(@)${(@)funcstack[2,(i)_(main_complete|complete|approximate|normal)]}:#_(dispatch|wanted|requested|all_labels|next_label)}% *}" [[ -z "$_f" ]] && _f="${${(@)funcstack[2,(i)_(main_complete|complete|approximate|normal)]}:#_(dispatch|wanted|requested|all_labels|next_label)}" if [[ "$help_sfuncs[$2]" != *${_f}* || "$help_styles[${2}${_f}]" != *${3}* ]]; then [[ "$help_sfuncs[$2]" != *${_f}* ]] && help_sfuncs[$2]+=$'\0'"${_f}" local _t case "$1" in -s) _t='[string] ';; -a) _t='[array] ';; -h) _t='[assoc] ';; *) _t='[boolean]';; esac help_styles[${2}${_f}]+=",${_t} ${3}:${_f}" fi # No need to call the completers more than once with different match specs. if [[ "$3" = matcher-list ]]; then set -A "$4" '' else builtin zstyle "$@" fi } trap 'unfunction compadd zstyle' EXIT INT ${1:-_main_complete} unfunction compadd zstyle trap - EXIT INT for i in "${(@ok)help_funcs}"; do text+=$'\n'"tags in context :completion:${i}:" tmp=() for j in "${(@ps.\0.)help_funcs[$i][2,-1]}"; do tmp+=( "${(@s.,.)help_tags[${i}${j}][2,-1]}" ) done zformat -a tmp ' (' "$tmp[@]" tmp=( $'\n '${^tmp}')' ) text+="${tmp}" done if [[ ${NUMERIC:-1} -ne 1 ]]; then text+=$'\n' for i in "${(@ok)help_sfuncs}"; do text+=$'\n'"styles in context ${i}" tmp=() for j in "${(@ps.\0.)help_sfuncs[$i][2,-1]}"; do tmp+=( "${(@s.,.)help_styles[${i}${j}][2,-1]}" ) done zformat -a tmp ' (' "$tmp[@]" tmp=( $'\n '${^tmp}')' ) text+="${tmp}" done fi compstate[list]='list force' compstate[insert]='' compadd -UX "$text[2,-1]" -n '' } _help_sort_tags() { local f="${${(@)${(@)funcstack[3,(i)_(main_complete|complete|approximate|normal)]}:#_(dispatch|wanted|requested|all_labels|next_label)}% *}" if [[ "$help_funcs[$curcontext]" != *${f}* || "$help_tags[${curcontext}${f}]" != *(${(j:|:)~argv})* ]]; then [[ "$help_funcs[$curcontext]" != *${f}* ]] && help_funcs[$curcontext]+=$'\0'"${f}" help_tags[${curcontext}${f}]+=",${argv}:${f}" comptry "$@" fi } _complete_help "$@" PK[ȧH]  functions/_twistednuW+A#compdef trial conch mktap cftp tapconvert twistd ckeygen lore pyhtmlizer websetroot tap2deb tkmktap tkconch manhole tap2rpm # Copyright (c) 2005 Eric Mangold # Maintainer: Eric Mangold # This file is meant to be in your zsh function path. i.e. in one of those # directories listed in your $fpath variable. # # e.g. /usr/local/share/zsh/site-functions/ # # It is responsible for passing completion control to the correct # completion function for the version of Twisted that is # currently in use. # # Goals: # # We want to detect any changes to PYTHONPATH since the last time we ran. # That way we can re-locate the completion functions so that we are sure # to be completing for the right version of Twisted. local dir old_fpath python_code run shebang function debug () { echo $@ >> /tmp/twisted_stub_debug } #debug "START _twisted_stub" function load_twisted_completions() { [[ -z $commands[twistd] ]] && echo 'ERROR: test command "twistd" not found in path' && return 1 shebang=$(head -1 $commands[twistd]) [[ $shebang != \#\!* ]] && echo 'ERROR: invalid shebang line for test script "twistd"' && return 1 PYTHON=$shebang[3,-1] # strip #! off the shebang PYTHON=${PYTHON# *} # remove any spaces between #! and command #debug PYTHON $PYTHON:q python_code=' import twisted, os.path dir = os.path.dirname(twisted.__file__) print os.path.join(dir, "python", "zsh") ' dir=$(${=PYTHON} -c "$python_code") #debug "Trying to load twisted functions from $dir:q" if [[ -r $dir/_twistd ]]; then old_fpath=($fpath) fpath=( $dir $fpath ) autoload +X _trial _conch _mktap _cftp _tapconvert _twistd _ckeygen autoload +X _lore _pyhtmlizer _websetroot _tap2deb _tkmktap _tkconch autoload +X _manhole _tap2rpm fpath=($old_fpath) else echo 'ERROR: Cannot find twisted completion function files in $dir:q' return 1 fi } function twisted_run () { # run completion function for current command # the :t modifier strips off any leading pathname components eval _$words[1]:t } function twisted_save_load_run () { # save PYTHONPATH, load twisted completions, and run the completion # function for the current command load_twisted_completions && twisted_run && PYTHONPATH_last=$PYTHONPATH } if [[ -n $PYTHONPATH_last ]]; then #debug "PYTHONPATH_last is set to $PYTHONPATH_last" #check if it's the same as the last time we ran if [[ $PYTHONPATH == $PYTHONPATH_last ]]; then #debug "PYTHONPATH == PYTHONPATH_last" # it's the same, which means we've already loaded completion # functions and nothing has changed. twisted_run else twisted_save_load_run fi else twisted_save_load_run fi #debug "END _twisted_stub" # PK[vrrfunctions/prompt_adam1_setupnuW+A# adam1 prompt theme prompt_adam1_help () { cat <<'EOF' This prompt is color-scheme-able. You can invoke it thus: prompt adam1 [ [ []]] where the colors are for the user@host background, current working directory, and current working directory if the prompt is split over two lines respectively. The default colors are blue, cyan and green. This theme works best with a dark background. Recommended fonts for this theme: nexus or vga or similar. If you don't have any of these, then specify the `plain' option to use 7-bit replacements for the 8-bit characters. And you probably thought adam1 was overkill. EOF } prompt_adam1_setup () { prompt_adam1_color1=${1:-'blue'} prompt_adam1_color2=${2:-'cyan'} prompt_adam1_color3=${3:-'green'} base_prompt="%K{$prompt_adam1_color1}%n@%m%k " post_prompt="%b%f%k" base_prompt_no_color=$(echo "$base_prompt" | perl -pe "s/%(K{.*?}|k)//g") post_prompt_no_color=$(echo "$post_prompt" | perl -pe "s/%(K{.*?}|k)//g") add-zsh-hook precmd prompt_adam1_precmd } prompt_adam1_precmd () { setopt noxtrace localoptions local base_prompt_expanded_no_color base_prompt_etc local prompt_length space_left base_prompt_expanded_no_color=$(print -P "$base_prompt_no_color") base_prompt_etc=$(print -P "$base_prompt%(4~|...|)%3~") prompt_length=${#base_prompt_etc} if [[ $prompt_length -lt 40 ]]; then path_prompt="%B%F{$prompt_adam1_color2}%(4~|...|)%3~%F{white}" else space_left=$(( $COLUMNS - $#base_prompt_expanded_no_color - 2 )) path_prompt="%B%F{$prompt_adam1_color3}%${space_left}<...<%~$prompt_newline%F{white}" fi PS1="$base_prompt$path_prompt %# $post_prompt" PS2="$base_prompt$path_prompt %_> $post_prompt" PS3="$base_prompt$path_prompt ?# $post_prompt" } prompt_adam1_setup "$@" PK["tfunctions/_guiltnuW+A#compdef guilt guilt-add guilt-applied guilt-delete guilt-files guilt-fold guilt-fork guilt-header guilt-help guilt-import-commit guilt-import guilt-init guilt-new guilt-next guilt-patchbomb guilt-pop guilt-prev guilt-push guilt-rebase guilt-refresh guilt-rm guilt-series guilt-status guilt-top guilt-unapplied local -a _guilt_commands _guilt_commands=( 'add:add a file to git and guilt' 'applied:list applied patches' 'delete:delete a patch' 'files:print the list of files that the topmost patch changes' 'fold:fold a specified patch into the topmost applied patch' 'fork:fork the topmost applied patch' 'header:print a patch header' 'help:open man page of a guilt command' 'import-commit:import one or more commits as patches' 'import:import specified patch file' 'init:initialize guilt for use in a git repository' 'new:create a new patch' 'next:output the name of next patch to be pushed' 'patchbomb:email a series of commits interactively' 'pop:pop patches from the tree' 'prev:output name of second topmost applied patch' 'push:push patches onto the tree' 'rebase:rebase pushed patches' 'refresh:refresh topmost applied patch' 'rm:remove a file from the git tree and guilt' 'series:print the stack of patches' 'status:print the status of files since the last refresh' 'top:output name of topmost applied patch' 'unapplied:list all unapplied patches' ) case "$service" in (guilt) if (( CURRENT == 2 )); then _describe -t commands 'guilt command' _guilt_commands && ret=0 else _files fi ;; (*) _files ;; esac PK[݅_afunctions/_yumnuW+A#compdef yum # Main dispatcher _yum() { local curcontext="$curcontext" state lstate line _arguments -s \ {-h,--help}'[show the help message]' \ {-t,--tolerant}'[be tolerant of errors]' \ '-C[run entirely from cache]' \ '-c[config file location]:Yum conf file:_files' \ '-R[maximum command wait time (in minutes)]:max wait time' \ '-d[debug level (0-10)]:debug level' \ '-e[error level (0-10)]:error level' \ '-y[answer yes for all questions]' \ '--installroot=[set install root]:install root:_files -/' \ '*--enablerepo=[enable or or more repositories]:repos to enable:_yum_disabled_repos_list' \ '*--disablerepo=[disable one or more repositories]:disable repos:_yum_enabled_repos_list' \ '--exclude=[exclude package(s) by name or glob]:exclude packages' \ '--version[show yum version]' \ '--obseletes[enable obsoletes processing during updates]' \ '--noplugins[disable yum plugins]' \ '*::yum command:_yum_command' } (( $+functions[_yum_command] )) || _yum_command() { local -a _yum_cmds _yum_cmds=( "install:install the latest version of a package or group of packages" "erase:remove an installed package (with its dependencies)" "remove:remove an installed package (with its dependencies)" "clean:clean local yum cache" "deplist:gives a list of all dependencies for a package" "check-update:check if any updates are available" "info:get description of available packages" "list:is used to list various information about packages" "groupinfo:get info on package groups" "groupinstall:install a package group or groups" "groupremove:remove a package group or groups" "grouplist:list package groups" "groupupdate:update a package group or groups" "localinstall:install packages with local rpm files" "localupdate:update packages with local rpm files" "makecache:makes a local yum cache" "provides:find out which package provides some feature or file" "whatprovides:find out which package provides some feature or file" "resolvedep:list packages providing the specified dependencies" "search:find any packages matching pattern" "shell:enter the 'yum shell'" "update:update one or more packages" "upgrade:upgrade one or more packages" ) if (( CURRENT == 1 )); then _describe -t commands 'yum command' _yum_cmds || compadd "$@" else local curcontext="$curcontext" cmd="${${_yum_cmds[(r)$words[1]:*]%%:*}}" # Deal with any aliases case $cmd in remove) cmd="erase";; whatprovides) cmd="provides";; upgrade) cmd="update";; esac if (( $#cmd )); then curcontext="${curcontext%:*:*}:yum-${cmd}:" local update_policy zstyle -s ":completion:${curcontext}:" cache-policy update_policy if [[ -z "$update_policy" ]]; then zstyle ":completion:${curcontext}:" cache-policy _yum_caching_policy fi _call_function ret _yum_$cmd || _message 'no more arguments' else _message "unknown yum command: $words[1]" fi return ret fi } # Fills the installed pkg cache _yum_all_pkgs() { if ( [[ ${+_all_pkgs} -eq 0 ]] || _cache_invalid ALL ) && ! _retrieve_cache ALL; then local prog="yum -C list all | sed 's/\s.*//' | grep '\.'" _all_pkgs=( $(kages $prog 2>/dev/null) ) _store_cache ALL _all_pkg fi } # Fills the installed pkg cache _yum_installed_pkgs() { if ( [[ ${+_installed_pkgs} -eq 0 ]] || _cache_invalid INSTALLED ) && ! _retrieve_cache INSTALLED; then _installed_pkgs=( $(yum -C list installed | sed 's/\s.*//' | grep '\.' 2>/dev/null) ) _store_cache INSTALLED _installed_pkgs fi } # Fills the available pkg cache _yum_available_pkgs() { if ( [[ ${+_available_pkgs} -eq 0 ]] || _cache_invalid AVAILABLE ) && ! _retrieve_cache AVAILABLE; then _available_pkgs=( $(yum -C list available | sed 's/\s.*//' | grep '\.' 2>/dev/null) ) _store_cache AVAILABLE _available_pkgs fi } # Fills the upgrade pkg cache _yum_upgrade_pkgs() { if ( [[ ${+_upgrade_pkgs} -eq 0 ]] || _cache_invalid UPGRADE ) && ! _retrieve_cache UPGRADE; then _upgrade_pkgs=( $(yum -C list upgrade | sed 's/\s.*//' | grep '\.' 2>/dev/null) ) _store_cache UPGRADE _upgrade_pkgs fi } # Gets the list of defined repos yum_repos() { local trepo local -a tarray tarray=( $(egrep -h '(^\[.*\]|^enabled.*=)' /etc/yum.repos.d/*.repo /etc/yum.conf | sed -e 's/ //g' | sed -e 's/\[//g' | sed -e 's/\].*$//g' 2>/dev/null) ) local -i eindex=0 local -i dindex=0 for line in $tarray; do if [[ "$line" = "enabled=1" ]]; then enabled_yum_repos=($enabled_yum_repos $trepo) elif [[ "$line" = "enabled=0" ]]; then disabled_yum_repos=($disabled_yum_repos $trepo) elif [[ "$line" != "main" ]]; then trepo=$line fi done } (( $+functions[_yum_disabled_repos_list] )) || _yum_disabled_repos_list() { yum_repos compadd "$@" -a -- disabled_yum_repos } (( $+functions[_yum_enabled_repos_list] )) || _yum_enabled_repos_list() { yum_repos compadd "$@" -a -- enabled_yum_repos } # Completion function for erase|remove (( $+functions[_yum_erase] )) || _yum_erase() { _yum_installed_pkgs compadd "$@" -a -- _installed_pkgs } # Completion function for install (( $+functions[_yum_install] )) || _yum_install() { _yum_available_pkgs compadd "$@" -a -- _available_pkgs } # Completion function for localinstall (( $+functions[_yum_localinstall] )) || _yum_localinstall() { _files -g '(#i)*.rpm(-.)' } # Completion function for localupdate (( $+functions[_yum_localupdate] )) || _yum_localupdate() { _files -g '(#i)*.rpm(-.)' } # Completion function for update/upgrade (( $+functions[_yum_update] )) || _yum_update() { _yum_upgrade_pkgs compadd "$@" -a -- _upgrade_pkgs } # Completion function for deplist (( $+functions[_yum_deplist] )) || _yum_deplist() { _yum_available_pkgs compadd "$@" -a -- _available_pkgs } _yum_all() { _yum_all_pkgs compadd "$@" -a -- _all_pkgs } _yum_list_or_info() { local -a listlist listlist=( "all:all packages in repositories" "available:packages available in repositories" "updates:packages with updates available" "installed:installed packages" "extras:packages installed that are not available in any yum repository" "obsoletes:packages installed that are obsoleted" "recent:packages recently added to repositories" ) if (( CURRENT == 2 )); then _describe -t yum-list-subcmds "Yum info/list sub-commands" listlist || _yum_all else local subcmd subcmd="${${listlist[(r)$words[2]:*]%%:*}}" # Deal with any aliases case $subcmd in installed) _yum_erase;; available) _yum_install;; updates) _yum_update;; esac fi } # Completion function for list (( $+functions[_yum_list] )) || _yum_list() { _yum_list_or_info } # Completion function for info (( $+functions[_yum_info] )) || _yum_info() { _yum_list_or_info } # Completion function for provides|whatprovides (( $+functions[_yum_provides] )) || _yum_provides() { _files } # Completion function for resolvedep (( $+functions[_yum_resolvedep] )) || _yum_resolvedep() { _files } # Completion function for clean (( $+functions[_yum_clean] )) || _yum_clean() { local -a cleanlist cleanlist=( "all:all cache" "cache:all cache" "dbcache:DB cache" "headers:cache headers" "packages:cache packages" "metadata:cache meta-data" ) if (( CURRENT == 2 )); then _describe -t yum-clean-subcmds "Yum clean sub-commands" cleanlist fi } _yum_caching_policy() { local _yumrepomds local -a oldp # rebuild if cache is more than a week old oldp=( "$1"(mw+1) ) (( $#oldp )) && return 0 _yumrepomds=( /var/cache/yum/**/repomd.xml ) if (( $#_yumrepomds )); then for repo in $_yumrepomds; do [[ "$repo" -nt "$1" ]] && return 0 done fi return 1 } _yum "$@" PK["::functions/_file_descriptorsnuW+A#autoload local i fds expl list link sep fds=( /dev/fd/<0-9>(N:t) ) if zstyle -T ":completion:${curcontext}:" verbose && [[ -h /proc/$$/fd/$fds[1] ]]; then zstyle -s ":completion:${curcontext}:" list-separator sep || sep=-- if zmodload -F zsh/stat b:zstat; then for i in "${fds[@]}"; do zstat +link -A link /proc/$$/fd/$i list+=( "$i $sep ${link[1]}" ) done elif (( $+commands[readlink] )); then for i in "${fds[@]}"; list+=( "$i $sep $(readlink /proc/$$/fd/$i)" ) else for i in "${fds[@]}"; do list+=( "$i $sep $(ls -l /proc/$$/fd/$i|sed 's/.*-> //' )" ) done fi if (( $list[(I)* $sep ?*] )); then _wanted file-descriptors expl 'file descriptor' compadd "$@" -d list -a - fds return fi fi _wanted file-descriptors expl 'file descriptor' compadd -a "$@" - fds PK[64   functions/_mhnuW+A#compdef ali anno burst comp dist flist flists folder folders forw inc mark mhlist mhmail mhn mhparam mhpath mhshow mhstore msgchk next packf pick prev refile repl rmf rmm scan show sortm whom if [[ -z $commands[mhpath] ]]; then _message "MH commands are not available" return 1 fi # Completion for all possible MH commands. local mymhdir=${$(_call_program mhpath mhpath + 2>/dev/null):-~/Mail} local mhlib=/usr/lib/mh local prev="$words[CURRENT-1]" expl if compset -P 1 -; then # get list of options, which MH commands can generate themselves # awk is just too icky to use for this, sorry. send me one if # you come up with it. local -a options disp options=( $($words[1] -help | perl -ne 'if (/^\s*-\(?(\S+)/) { $n = $1; $n =~ s/\)//g; print $n =~ s/^\[([a-z]+)\]// ? "$n\n$1$n\n" : "$n\n"; }') ) if zstyle -t ":completion:${curcontext}:options" prefix-hidden; then _wanted options expl option compadd -d disp - "$options[@]" else disp=( -${options} ) _wanted options expl option compadd -d disp - "$options[@]" fi return elif compset -P 1 '[+@]' || [[ "$prev" = -draftfolder ]]; then # Complete folder names. local mhpath if [[ $IPREFIX != '@' ]]; then [[ $IPREFIX = '+' ]] || IPREFIX=+ mhpath=$mymhdir else mhpath=$(mhpath) fi _wanted files expl 'MH folder' _path_files -W mhpath -/ elif [[ "$prev" = -(editor|(whatnow|rmm|show|more)proc) ]]; then _command_names -e elif [[ "$prev" = -file ]]; then _files elif [[ "$prev" = -(form|audit|filter) ]]; then # Need some MH template file, which may be in our own MH directory # or with the standard library. local mhfpath # This is the only place we need mhlib, so leave the test till here. mhlib=${${$(mhparam mhlproc 2>/dev/null):h}:-/usr/lib/mh} mhfpath=($mymhdir $mhlib) _wanted files expl 'MH template file' _files -W mhfpath -g '*(-.)' elif [[ $service = mhmail ]]; then _email_addresses elif [[ "$prev" = -(no|)cc ]]; then _wanted -C "$prev" values expl 'CC address' compadd all to cc me elif [[ "$prev" = -[rw]cache ]]; then _wanted -C "$prev" values expl cache compadd public private never ask elif [[ "$prev" = -textfield ]]; then _wanted -C "$prev" -x headers expl header compadd -M 'm:{a-zA-Z}={A-Za-z}' \ Subject From To cc elif [[ "$prev" = -datefield ]]; then _wanted -C "$prev" -x headers expl header compadd -M 'm:{a-zA-Z}={A-Za-z}' \ Delivery-Date elif [[ $service = mhparam ]]; then _wanted parameters expl 'MH parameter' compadd - \ ${${(f)"$(mhparam -all)"}%%:*} elif [[ $service = ali ]]; then _email_addresses -n MH elif compset -P '*:'; then _message -e number 'number of messages' else # Generate sequences. local foldnam folddir f sequences mhneg ret=1 compset -P '*-' # ignore start of message range for f in $words; do [[ $f = [@+]* ]] && foldnam=$f done if [[ $foldnam = '+'* ]]; then folddir=$mymhdir/${foldnam#+} elif [[ $foldnam = '@'* ]]; then folddir=$(mhpath)/${foldnam#@} else folddir=$(mhpath) # leaving foldnam empty works here fi sequences=( ${${(f)"$(mark $foldnam 2>/dev/null)"}%%:*} ) mhneg="$(mhparam Sequence-Negation)" && sequences=( {,$mhneg}$^sequences ) sequences+=( all first last prev next ) _tags sequences while _tags; do while _next_label sequences expl sequence; do compadd -S ' ' -r '-: \t\n\-' "$expl[@]" -a sequences && ret=0 _path_files -S ' ' -r '-: \t\n\-' "$expl[@]" -W folddir -g '<->(-.)' && ret=0 done (( ret )) || return 0 done return ret fi PK[. ACCfunctions/_gnupodnuW+A#compdef gnupod_addsong gnupod_addsong.pl=gnupod_addsong gnupod_check gnupod_check.pl=gnupod_check gnupod_INIT gnupod_INIT.pl=gnupod_INIT gnupod_search gnupod_search.pl=gnupod_search mktunes mktunes.pl=mktunes tunes2pod tunes2pod.pl=tunes2pod local arguments case "$service" in (gnupod_addsong) arguments=( '(-h --help)'{-h,--help}'[display help and exit]' --version'[output version information and exit]' '(-m --mount)'{-m,--mount=}'[iPod mountpoint, default is $IPOD_MOUNTPOINT]:mount point:_files' '(-r --restore)'{-r,--restore}'[restore the iPod (create a new GNUtunesDB from scratch)]' '(-d --duplicate)'{-d,--duplicate}'[allow duplicate files]' '(-p --playlist)'{-p,--playlist=}'[add songs to this playlist]:playlist:' --playlist-is-podcast'[set podcast flag for playlist(s) created using --playlist]' --podcast-artwork'[download and install artwork for podcasts from their channel]' --podcast-cache-dir='[set a directory in which podcast media files will be cached]:podcast cache dir:' --podcast-files-limit='[limit files to download (0 = all (default), -X = X oldest, X = X newest)]:podcast files limit:'. --disable-v1'[do not read ID3v1 Tags (MP3 Only)]' --disable-v2'[do not read ID3v2 Tags (MP3 Only)]' '(-x --decode)'{-x,--decode=}'[convert FLAC Files to WAVE/MP3 or AAC on-the-fly]:encoding:(pcm mp3 aac aacbm)' --decode=video'[convert .avi Files into iPod video on-the-fly]' '(-e --reencode)'{-e,--reencode=}'[reencode MP3/AAC files with new quality on-the-fly]:quality number (0 = Good 9 = Bad):(1 2 3 4 5 6 7 8 9)' '(-t --set-title)'{-t,--set-title=}'[set Title (Override ID3 Tag)]:title:' '(-a --set-artist)'{-a,--set-artist=}'[set Artist (Override ID3 Tag)]:artist:' '(-l --set-album)'{-l,--set-album=}'[set Album (Override ID3 Tag)]:album:' '(-g --set-genre)'{-g,--set-genre=}'[set Genre (Override ID3 Tag)]:genre:' --set-rating='[set Rating (0=-/20=*/40=**/60=***/80=****/100=*****)]:rating:(0 20 40 60 80 100)' --set-playcount='[set Playcount]:play count:' --set-songnum='[override Songnum/Tracknum field]:song number:' '(-b --set-bookmarkable)'{-b,--set-bookmarkable}'[set this song as bookmarkable (= Remember position)]' --set-shuffleskip'[exclude this file in shuffle-mode]' --set-compilation'[mark songs as being part of a compilation]' --min-vol-adj='[minimum volume adjustment allowed by ID3v2.4 RVA2 tag (range -100 to 100, default 0)]' --max-vol-adj='[maximum volume adjustment allowed by ID3v2.4 RVA2 tag (range -100 to 100, default 0)]' --artwork='[use FILE as album cover]:artwork:_files' '*:file to add:_files' ) ;; (gnupod_check) arguments=( '(-h --help)'{-h,--help}'[display help and exit]' --version'[output version information and exit]' '(-m --mount)'{-m,--mount=}'[iPod mountpoint (default is $IPOD_MOUNTPOINT)]:mount point:_files' --fixit'[try to fixup some errors (may delete lost files)]' ) ;; (gnupod_INIT) arguments=( '(-h --help)'{-h,--help}'[display help and exit]' --version'[output version information and exit]' '(-m --mount)'{-m,--mount=}'[iPod mountpoint (default is $IPOD_MOUNTPOINT)]:mount point:_files' '(-d --disable-convert)'{-d,--disable-convert}'[do not try to convert an existing iTunesDB]' '(-f --france)'{-f,--france}'[limit volume to 100dB, works only on very old iPods]' --noask'[do not wait for any user input]' ) ;; (gnupod_search) arguments=( --help'[display help and exit]' --version'[display version information and exit]' '(-m --mount)'{-m,--mount=}'[iPod mountpoint (default is $IPOD_MOUNTPOINT)]:mount point:_files' '(-t --title)'{-t,--title=}'[search songs by title]:title string:' '(-a --artist)'{-a,--artist=}'[search songs by artist]:artist string:' '(-l --album)'{-l,--album=}'[search songs by album]:album string:' '(-i --id)'{-i,--id=}'[search songs by ID]:ID integer:' '(-g --genre)'{-g,--genre=}'[search songs by genre]:genre string:' '(-c --playcount)'{-c,--playcount=}'[search songs by playcount]:playcount:' '(-s --rating)'{-s,--rating=}'[search songs by Rating (20 is one star, 40 two, etc.)]:playcount:(0 20 40 60 80 100)' '(-R --podcastrss)'{-R,--podcastrss=}'[search songs by RSS]:RSS:' '(-G --podcastguid)'{-G,--podcastguid=}'[search songs by GUID]:GUID:' '(-b --bitrate)'{-b,--bitrate=}'[search songs by Bitrate]:bitrate:' '(-o --match-once)'{-o,--match-once}'[search does not need to match multiple times (eg. -a & -l)]' --delete'[remove matched songs from the iPod]' --view='[modify output (default is ialt, see --help)]:output string:' --rename='[rename key into value for matched songs]:KEY=VALUE:' --artwork='[use FILE as Cover for found files]:artwork:_files' ) ;; (mktunes) arguments=( '(-h --help)'{-h,--help}'[display help and exit]' --version'[output version information and exit]' '(-m --mount)'{-m,--mount=}'[iPod mountpoint (default is $IPOD_MOUNTPOINT)]:mount point:_files' '(-n --ipod-name)'{-n,--ipod-name=}'[iPod Name (For unlabeled iPods)]:name:' '(-v --volume)'{-v,--volume=}'[adjust volume +-VALUE%]:volume percent:' '(-e --energy)'{-e,--energy}'[save energy (disable scrolling title)]' '(-g --fwguid)'{-g,--fwguid=}'[FirewireGuid / Serial of connected iPod]' ) ;; (tunes2pod) arguments=( '(-h --help)'{-h,--help}'[display help and exit]' --version'[output version information and exit]' '(-m --mount)'{-m,--mount=}'[iPod mountpoint (default is $IPOD_MOUNTPOINT)]:mount point:_files' --force'[disable sync checking]' ) ;; (*) return 1 ;; esac _arguments : $arguments PK[z.DIIfunctions/_domainsnuW+A#autoload local expl domains tmp if ! zstyle -a ":completion:${curcontext}:domains" domains domains; then if (( ! $+_cache_domains )); then _cache_domains=() if [[ -f /etc/resolv.conf ]]; then while read tmp; do [[ "$tmp" = (domain|search)* ]] && _cache_domains=( "$_cache_domains[@]" "${=${tmp%%[ ]#}#*[ ]}" ) done < /etc/resolv.conf _cache_domains=( "${(@)_cache_domains:#[ ]#}" ) fi fi domains=( "$_cache_domains[@]" ) fi _wanted domains expl domain \ compadd -M 'm:{a-zA-Z}={A-Za-z} r:|.=* r:|=*' -a "$@" - domains PK[Lܫfunctions/_jobs_fgnuW+A#compdef disown fg _jobs "$@" PK[n2functions/_putclipnuW+A#compdef putclip putclip.exe # cygutils 1.3.2 _arguments -s -S \ '(--dos -d --unix -u --no-conv -n)'{-d,--dos}'[clipboard text will have DOS line endings]' \ '(--dos -d --unix -u --no-conv -n)'{-u,--unix}'[clipboard text will have UNIX line endings]' \ '(--dos -d --unix -u --no-conv -n)'{-n,--no-conv}'[do not translate line endings]' \ '(-)'{-\?,--help}'[display help information]' \ '(-)--usage[display brief usage message]' \ '(-)--version[display version information]' \ '(-)--license[display licensing information]' PK[9Cfunctions/_schednuW+A#compdef sched local expl lines disp if [[ CURRENT -eq 2 ]]; then if compset -P -; then lines=(${(f)"$(sched)"}) if zstyle -T ":completion:${curcontext}:jobs" verbose; then disp=( -ld lines ) else disp=() fi [[ -z $lines ]] || _wanted jobs expl 'scheduled jobs' \ compadd "$disp[@]" - {1..$#lines} return else _message -e times 'time specification' return 1 fi fi compset -n 3 && _normal PK[@?zzfunctions/_dpkg-repacknuW+A#compdef dpkg-repack _arguments \ '--root=[take package from filesystem rooted on ]:root dir:_files -/' \ '--arch=[force the package to be built for architecture ]:architecture:(alpha amd64 arm hppa hurd-i386 i386 ia64 m68k mips mipsel powerpc s390 sparc)' \ '--generate[generate build directory but do not build deb]' \ '*:package:_deb_packages xinstalled' PK[{functions/_globqual_delimsnuW+A#autoload # Helper for _globquals. Sets delim to delimiter to match. # don't restore special parameters compstate[restore]=no delim=$PREFIX[1] compset -p 1 # One of matching brackets? # These don't actually work: the parser gets very confused. local matchl="<({[" matchr=">)}]" integer ind=${matchl[(I)$delim]} (( ind )) && delim=$matchr[ind] if compset -P "[^$delim]#$delim"; then # Completely matched. return 0 else # Still in delimiter return 1 fi PK[1functions/zcalcnuW+A#!/bin/zsh -i # # Zsh calculator. Understands most ordinary arithmetic expressions. # Line editing and history are available. A blank line or `q' quits. # # Runs as a script or a function. If used as a function, the history # is remembered for reuse in a later call (and also currently in the # shell's own history). There are various problems using this as a # script, so a function is recommended. # # The prompt shows a number for the current line. The corresponding # result can be referred to with $, e.g. # 1> 32 + 10 # 42 # 2> $1 ** 2 # 1764 # The set of remembered numbers is primed with anything given on the # command line. For example, # zcalc '2 * 16' # 1> 32 # printed by function # 2> $1 + 2 # typed by user # 34 # 3> # Here, 32 is stored as $1. This works in the obvious way for any # number of arguments. # # If the mathfunc library is available, probably understands most system # mathematical functions. The left parenthesis must be adjacent to the # end of the function name, to distinguish from shell parameters # (translation: to prevent the maintainers from having to write proper # lookahead parsing). For example, # 1> sqrt(2) # 1.4142135623730951 # is right, but `sqrt (2)' will give you an error. # # You can do things with parameters like # 1> pi = 4.0 * atan(1) # too. These go into global parameters, so be careful. You can declare # local variables, however: # 1> local pi # but note this can't appear on the same line as a calculation. Don't # use the variables listed in the `local' and `integer' lines below # (translation: I can't be bothered to provide a sandbox). # # You can declare or delete math functions (implemented via zmathfuncdef): # 1> function cube $1 * $1 * $1 # This has a single compulsory argument. Note the function takes care of # the punctuation. To delete the function, put nothing (at all) after # the function name: # 1> function cube # # Some constants are already available: (case sensitive as always): # PI pi, i.e. 3.1415926545897931 # E e, i.e. 2.7182818284590455 # # You can also change the output base. # 1> [#16] # 1> # Changes the default output to hexadecimal with numbers preceded by `16#'. # Note the line isn't remembered. # 2> [##16] # 2> # Change the default output base to hexadecimal with no prefix. # 3> [#] # Reset the default output base. # # This is based on the builtin feature that you can change the output base # of a given expression. For example, # 1> [##16] 32 + 20 / 2 # 2A # 2> # prints the result of the calculation in hexadecimal. # # You can't change the default input base, but the shell allows any small # integer as a base: # 1> 2#1111 # 15 # 2> [##13] 13#6 * 13#9 # 42 # and the standard C-like notation with a leading 0x for hexadecimal is # also understood. However, leading 0 for octal is not understood --- it's # too confusing in a calculator. Use 8#777 etc. # # Options: -# is the same as a line containing just `[#], # similarly -##; they set the default output base, with and without # a base discriminator in front, respectively. # # # To do: # - separate zcalc history from shell history using arrays --- or allow # zsh to switch internally to and from array-based history. emulate -L zsh setopt extendedglob # TODO: make local variables that shouldn't be visible in expressions # begin with _. local line ans base defbase forms match mbegin mend psvar optlist opt arg local compcontext="-zcalc-line-" integer num outdigits outform=1 # We use our own history file with an automatic pop on exit. history -ap "${ZDOTDIR:-$HOME}/.zcalc_history" forms=( '%2$g' '%.*g' '%.*f' '%.*E' '') zmodload -i zsh/mathfunc 2>/dev/null autoload -Uz zmathfuncdef : ${ZCALCPROMPT="%1v> "} # Supply some constants. float PI E (( PI = 4 * atan(1), E = exp(1) )) # Process command line while [[ -n $1 && $1 = -(|[#-]*) ]]; do optlist=${1[2,-1]} shift [[ $optlist = (|-) ]] && break while [[ -n $optlist ]]; do opt=${optlist[1]} optlist=${optlist[2,-1]} case $opt in ('#') # Default base if [[ -n $optlist ]]; then arg=$optlist optlist= elif [[ -n $1 ]]; then arg=$1 shift else print "-# requires an argument" >&2 return 1 fi if [[ $arg != (|\#)[[:digit:]]## ]]; then print - "-# requires a decimal number as an argument" >&2 return 1 fi defbase="[#${arg}]" ;; esac done done for (( num = 1; num <= $#; num++ )); do # Make sure all arguments have been evaluated. # The `$' before the second argv forces string rather than numeric # substitution. (( argv[$num] = $argv[$num] )) print "$num> $argv[$num]" done psvar[1]=$num while vared -cehp "${ZCALCPROMPT}" line; do [[ -z $line ]] && break # special cases # Set default base if `[#16]' or `[##16]' etc. on its own. # Unset it if `[#]' or `[##]'. if [[ $line = (#b)[[:blank:]]#('[#'(\#|)(<->|)']')[[:blank:]]#(*) ]]; then if [[ -z $match[4] ]]; then if [[ -z $match[3] ]]; then defbase= else defbase=$match[1] fi print -s -- $line line= continue else base=$match[1] fi else base=$defbase fi print -s -- $line line="${${line##[[:blank:]]#}%%[[:blank:]]#}" case "$line" in # Escapes begin with a colon (:(\\|)\!*) # shell escape: handle completion's habit of quoting the ! eval ${line##:(\\|)\![[:blank:]]#} line= continue ;; ((:|)q) # Exit return 0 ;; ((:|)norm) # restore output format to default outform=1 ;; ((:|)sci[[:blank:]]#(#b)(<->)(#B)) outdigits=$match[1] outform=2 ;; ((:|)fix[[:blank:]]#(#b)(<->)(#B)) outdigits=$match[1] outform=3 ;; ((:|)eng[[:blank:]]#(#b)(<->)(#B)) outdigits=$match[1] outform=4 ;; (:raw) outform=5 ;; ((:|)local([[:blank:]]##*|)) eval $line line= continue ;; ((:|)function[[:blank:]]##(#b)([^[:blank:]]##)(|[[:blank:]]##([^[:blank:]]*))) zmathfuncdef $match[1] $match[3] line= continue ;; (:*) print "Unrecognised escape" line= continue ;; (*) # Latest value is stored as a string, because it might be floating # point or integer --- we don't know till after the evaluation, and # arrays always store scalars anyway. # # Since it's a string, we'd better make sure we know which # base it's in, so don't change that until we actually print it. eval "ans=\$(( $line ))" # on error $ans is not set; let user re-edit line [[ -n $ans ]] || continue argv[num++]=$ans psvar[1]=$num ;; esac if [[ -n $base ]]; then print -- $(( $base $ans )) elif [[ $ans = *.* ]] || (( outdigits )); then if [[ -z $forms[outform] ]]; then print -- $(( $ans )) else printf "$forms[outform]\n" $outdigits $ans fi else printf "%d\n" $ans fi line= done return 0 PK[o6<<functions/_zfsnuW+A#compdef zfs _zfs() { local context state line expl typeset -A opt_args local -a subcmds rw_properties rw_propnames ro_properties subcmds=( "create" "destroy" "clone" "promote" "rename" "snapshot" "rollback" "list" "set" "get" "inherit" "mount" "unmount" "share" "unshare" "send" "receive" "allow" "unallow" "upgrade" ) ro_properties=( "name" "type" "creation" "used" "available" "referenced" "compressratio" "mounted" "origin" ) # TODO: Be cleverer about what values can be set. Is there any way to # set the sorting for *size properties to false by default? rw_properties=( "aclinherit:value:(discard noallow secure passthrough)" "aclmode:value:(discard groupmask passthrough)" "atime:value:(on off)" "canmount:value:(on off)" "checksum:value:(on off fletcher2 fletcher4 sha256)" "compression:value:(on off lzjb gzip gzip-{1..9})" "copies:value:(1 2 3)" "devices:value:(on off)" "exec:value:(on off)" "mountpoint:value:{if [[ -prefix /* ]]; then _path_files -/; else _wanted mountpoints expl 'mountpoint (type \"/\" to start completing paths)' compadd legacy none; fi}" "quota:number or 'none':{if [[ -prefix [0-9]## ]]; then _message -e 'number'; elif [[ $PREFIX == quota= ]]; then _wanted none expl 'number or none' compadd none; else _wanted none expl 'quota' compadd none; fi}" "readonly:value:(on off)" "recordsize:value:(512 1K 2K 4K 8K 16K 32K 64K 128K)" "reservation:value:" # , "none" "setuid:value:(on off)" "shareiscsi:value:(on off)" # or "type=" "sharenfs:value:(on off)" # or share(1M) options "snapdir:value:(hidden visible)" "version:value:(1 2 current)" "volblocksize:value:(512 1K 2K 4K 8K 16K 32K 64K 128K)" "volsize:value:" # "xattr:value:(on off)" "zoned:value:(on off)" ) rw_propnames=( ${rw_properties%%:*} ) if [[ $service == "zfs" ]]; then _arguments -C -A "-*" \ '-\?[help]' \ '*::command:->subcmd' && return 0 if (( CURRENT == 1 )); then _wanted commands expl "zfs subcommand" compadd -a subcmds return fi service="$words[1]" curcontext="${curcontext%:*}=$service:" fi case $service in ("create") _arguments -A "-*" \ '-p[create parent datasets]' \ '-o[set initial properties]:property:_values -s , "property" $rw_properties' \ - set1 \ ':filesystem:' \ - set2 \ '-s[create sparse volume]' \ '-b[set volblocksize]:blocksize:' \ '-V[set size]:size:' \ ':volume:' ;; ("destroy") _arguments -A "-*" \ '-r[recursively destroy all children]' \ '-R[recursively destroy all dependents]' \ '-f[force unmounts]' \ ':filesystem/volume/snapshot:_zfs_dataset' ;; ("snapshot") _arguments -A "-*" \ '-r[recursively snapshot all descendant datasets]' \ ':filesystem/volume:_zfs_dataset -t fs -t vol -S@' ;; ("rollback") _arguments -A "-*" \ '-r[recursively destroy more recent snapshots]' \ '-R[recursively destroy more recent snapshots and clones]' \ '-f[force unmounts]' \ ':snapshot:_zfs_dataset -t snap' ;; ("clone") # XXX needs to bail if there are no snapshots _arguments -A "-*" \ '-p[create parent datasets]' \ ':snapshot:_zfs_dataset -t snap' \ ':filesystem/volume:' ;; ("promote") # XXX complete only cloned filesystems _arguments \ ':filesystem:_zfs_dataset -t fs' \ ;; ("rename") _arguments -A "-*" \ - set1 \ '-p[create parent datasets]' \ ':filesystem/volume/snapshot:_zfs_dataset' \ ':filesystem/volume/snapshot:' \ - set2 \ '-r[recursively rename snapshots of all descendent datasets]' \ ':snapshot:_zfs_dataset -t snap' \ ':snapshot:' ;; ("list") _arguments -A "-*" \ '-r[recursively display children]' \ '-H[scripting mode]' \ '-o[properties to list]:property:_values -s , "property" $ro_properties $rw_propnames' \ '*-s[sort key (ascending)]:property:_values "property" $ro_properties $rw_propnames' \ '*-S[sort key (descending)]:property:_values "property" $ro_properties $rw_propnames' \ '-t[dataset types to list]:dataset type:_values -s , "dataset type" filesystem snapshot volume' \ '*:filesystem/volume/snapshot:_zfs_dataset' ;; ("set") _arguments \ ':property:_values -s , "property" $rw_properties' \ '*:filesystem/volume:_zfs_dataset -t fs -t vol' ;; ("get") _arguments -A "-*" \ "-r[recursively display children's properties]" \ '-H[scripting mode]' \ '-p[display numbers exactly]' \ '-s[specify sources]:source:_values -s , "source" local default inherited temporary none' \ '-o[specify fields]:field:_values -s , "field" name property value source' \ ':property:_values -s , "property" $ro_properties $rw_propnames all' \ '*:filesystem/volume/snapshot:_zfs_dataset' ;; ("inherit") _arguments -A "-*" \ '-r[recursively inherit property for all children]' \ ':property:_values -s , "property" $ro_properties $rw_properties' \ '*:filesystem/volume:_zfs_dataset -t fs -t vol' ;; ("mount") _arguments -A "-*" \ '-o[mount options]:mount options:_values -s , "option" {,no}{devices,exec,setuid} ro rw' \ '-O[overlay mount]' \ '-v[report mount progress]' \ - set1 \ ':filesystem:_zfs_dataset -t fs' \ - set2 \ '-a[mount all available ZFS filesystems]' ;; ("unmount") _arguments -A "-*" \ - set1 \ '-f[force unmount]' \ ':filesystem:_zfs_dataset -t fs -t mtpt' \ - set2 \ '-a[unmount all ZFS filesystems]' ;; ("share") _arguments -A "-*" \ - set1 \ '-a[share all available ZFS filesystems]' \ - set2 \ ':filesystem:_zfs_dataset -t fs' ;; ("unshare") _arguments -A "-*" \ - set1 \ '-a[unshare all shared ZFS filesystems]' \ - set2 \ '-F[force unshare]' \ ':filesystem:_zfs_dataset -t fs -t mtpt' ;; ("send") _arguments -A "-*" \ '-i[generate an incremental stream]:snapshot:_zfs_dataset -t snap' \ ':snapshot:_zfs_dataset -t snap' ;; ("receive") _arguments -A "-*" \ '-v[verbose]' \ '-n[do not receive the stream]' \ '-F[force a rollback if necessary]' \ - set1 \ ':filesystem/volume/snapshot:_zfs_dataset' \ - set2 \ '-d[set path prefix]:filesystem:_zfs_dataset -t fs' ;; ("allow"|"unallow") _message "unimplemented zfs subcommand: $service" ;; ("upgrade") _arguments -A "-*" \ - set1 \ '-v[verbose]' \ - set2 \ '-a[upgrade all filesystems on all pools]' \ '-r[upgrade descendent filesystems, too]' \ '-V[upgrade to specified version]:version:(1 2)' \ - set3 \ '-r[upgrade descendent filesystems, too]' \ '-V[upgrade to specified version]:version:(1 2)' \ ':filesystem:_zfs_dataset -t fs' \ ;; (*) _message "unknown zfs subcommand: $service" ;; esac } _zfs "$@" PK[a.rrfunctions/_fetchnuW+A#compdef fetch # Deprecated arguments are removed from the completion _arguments -s \ '-1[stop and return exit code 0 at the first successfully retrieved file]' \ '-4[forces fetch to use IPv4 addresses only]' \ '-6[forces fetch to use IPv6 addresses only]' \ '-A[do not automatically follow "temporary" (302) redirects]' \ '-a[automatically retry the transfer upon soft failures]' \ '-B[specify the read buffer size in bytes]:bytes:' \ '-d[use a direct connection even if a proxy is configured]' \ '-F[in combination with the -r flag, forces a restart]' \ '-l[if the target is a file-scheme URL, make a symbolic link to the target]' \ '-M' \ '-m[mirror mode]' \ '-N[use file instead of ~/.netrc to look up login names and pass- words for FTP sites]' \ '-n[do not preserve the modification time]' \ '-o[set the output file name]:file:_files' \ '-P' \ '-p[use passive FTP]' \ '-q[quiet mode]' \ '-R[do not delete the output file in any circumstances]' \ '-r[restart a previously interrupted transfer]' \ '-S[require the file size reported by the server to match the specified value]' \ '-s[print the size in bytes, without fetching it]' \ '-T[set timeout value]:seconds:' \ '-U[when using passive FTP, allocate the port for the data connection from the low port range]' \ '-v[increase verbosity level]' \ '-w[wait successive retries]:seconds:' \ '*:URL to fetch:_urls' PK[:88functions/run-help-sudonuW+A if [ $# -eq 0 ]; then man sudo else man $1 fi PK[Ũmfunctions/_csshnuW+A#compdef cssh crsh _arguments \ '-h[help]' \ '-H[show man page]' \ '-v[show version]' \ '-d[enable basic debugging mode]' \ '-D[enable extended debugging mode]' \ '-q[enable automatic quit after last window is closed]' \ '-Q[disable automatic quit after last window is closed]' \ '-u[output configuration]' \ '-g[enable window tiling]' \ '-G[disable window tiling]' \ '-c[use additional cluster file]:cluster file:_files' \ '-l:username:_users' \ '-T:window title prefix:' \ '-o:arguments to ssh or rsh:' \ '-t:arguments to terminals:' \ '-i[ignore errors from unresolvable hostnames]' \ '-e[evaluate arguments to identify potential errors]:userhostport:_user_at_host' \ '*:userhostport: _alternative hosts:host:_hosts usersathosts:userathost:_user_at_host' PK[v functions/_mtnuW+A#compdef mt local -a args cmds local state line curcontext="$curcontext" ret=1 args=( '(-)-f[specify raw tape device]:tape device:_files' ) cmds=( {eof,weof}':write specified number of EOF marks at current position' 'fsf:forward space by specified number of files' 'fsr:forward space by specified number of records' 'bsf:backward space by specified number of files' 'bsr:backward space by specified number of records' 'asf:absolute space to specified file number' 'eom:go to end of recorded media on the tape' 'rewind:rewind the tape' {offline,rewoffl}':rewind and unload the tape' 'status:print status information about the tape unit' 'retension:rewind, wind to end of reel, rewind again - smoothes tape tension' 'erase:erase the tape' ) if _pick_variant gnu=GNU unix --version; then args=( '(1 2 -)'{-V,--version}'[print version info]' '(1 2 -)--help[display usage info]' '(-V --version --help -f --file)'{-f,--file=}'[specify raw tape device]:tape device:_files' '(-V --version --help)--rsh-command=[specify remote shell command]:rsh command:_command_names -e' ) # should really allow remote user@host for tape device cmds+=( 'bsfm:backward space by specified number of file marks' 'fsfm:forward space by specified number of file marks' 'fss:forward space by specified number of setmarks' 'bss:backward space by specified number of setmarks' 'wset:write specified number of setmarks at current position' {eod,seod}':space to end of valid data' 'setblk:set drive block size' 'setdensity:set tape density code' 'drvbuffer:set drive buffer code' 'stoptions:set driver option bits' 'stwrthreshold:set device write threshold' 'seek:seek to specified block' 'tell:tell the current block on tape' 'densities:explain some common density codes' 'datcompression:enquire or set compression status' ) elif [[ $OSTYPE = (freebsd|dragonfly)* ]]; then cmds=( ${cmds:#(asf|eof):*} 'smk:write specified number of setmarks at current position' 'fss:forward space by specified number of setmarks' 'bss:backward space by specified number of setmarks' 'rdhpos:read hardware block position' 'rdspos:read SCSI logical block position' 'sethpos:set hardware block position' 'setspos:set SCSI logical block position' 'errstat:print error status info about device' 'blocksize:set drive block size' 'density:set tape density code' 'geteotmodel:print the current EOT filemark model' 'seteotmodel:set the current EOT filemark model' 'eod:go to end of recorded media on the tape' 'comp:set compression mode' ) elif [[ $OSTYPE = solaris* ]]; then cmds+=( 'nbsf:back space by specified number of files positioning at file start' 'reserve:allow drive to remain reserved after close until explicit release' 'release:re-establish release at close behaviour' ) if (( ! EUID )); then cmds+=( 'forcereserve:break reservation of tape drive held by other host' ) fi fi _arguments -C "$args[@]" '(--help --version -V)1:operation:->operation' \ '2:count:' && ret=0 [[ -n "$state" ]] && _describe -t operations 'operation' cmds && ret=0 return ret PK[y--functions/_my_accountsnuW+A#autoload _user_at_host -t my-accounts "$@" PK[Z77functions/VCS_INFO_hooknuW+A### vim:ft=zsh:foldmethod=marker ## Written by Frank Terbeck ## Distributed under the same BSD-ish license as zsh itself. local hook func local -x context hook_name local -xi ret local -a hooks local -i debug ret=0 hook_name="$1" shift context=":vcs_info:${vcs}+${hook_name}:${usercontext}:${rrn}" zstyle -t "${context}" debug && debug=1 || debug=0 if (( debug )); then printf 'VCS_INFO_hook: running hook: "%s"\n' "${hook_name}" printf 'VCS_INFO_hook: current context: "%s"\n' "${context}" fi zstyle -a "${context}" hooks hooks || return 0 # Protect some internal variables in hooks. The `-g' parameter to # typeset does *not* make the parameters global here (they are already # "*-local-export). It prevents typeset from creating *new* *local* # parameters in this function's scope. typeset -g -r vcs rrn usercontext maxexports msgs vcs_comm for hook in ${hooks} ; do func="+vi-${hook}" if (( ${+functions[$func]} == 0 )); then (( debug )) && printf ' + Unknown function: "%s"\n' "${func}" continue fi (( debug )) && printf ' + Running function: "%s"\n' "${func}" true ${func} "$@" case $? in (0) ;; (*) break ;; esac done typeset -g +r vcs rrn usercontext maxexports msgs vcs_comm return $ret PK[z __functions/_toiletnuW+A#compdef toilet local fontdir typeset -A opt_args fontdir=$(_call_program path toilet -I2 2>/dev/null) _arguments \ '(-f --font)'{-f,--font}'[specify font]:font:_files -W ${~opt_args[-d]\:-$fontdir} -g \*tlf\*\(-.\:r\)' \ '(-d --directory)'{-d,--directory}'[specify font directory]:font directory:_files -/' \ '(-t --termwidth -w --width)'{-w,--width}'[set output width]:width:' \ '(-t --termwidth -w --width)'{-t,--termwidth}'[adapt to terminal width]' \ '(-F --filter)'{-F,--filter}'[apply filter to text]:filter:(gay metal)' \ '--gay[rainbow filter]' \ '--metal[metal filter]' \ '--irc[output IRC color codes]' \ '--html[output HTML document]' \ '--tga[output TGA document]' \ '(-h --help)'{-h,--help}'[help]' \ '(-I --infocode)'{-I,--infocode}'[print FIGlet-compatible infocode]:code:' \ '(-v --version)'{-v,--version}'[version]' PK[ܻfunctions/_stgitnuW+A#compdef stg typeset -a subcmds subcmds=( ${${${(M)${(f)"$(stg help 2> /dev/null)"}## *}# }/#(#b)([^[:space:]]##)[[:space:]]##(*)/$match[1]:$match[2]} ) local curcontext="$curcontext" local subcmd local ret=1 if (( CURRENT == 2 )); then _describe -t commands 'stgit command' subcmds && ret=0 else shift words (( CURRENT-- )) subcmd="$words[1]" curcontext="${curcontext%:*}-${subcmd}:" case $subcmd in (push) _wanted -V "unapplied patches" expl "patch" \ compadd ${${(M)${(f)"$(stg series 2> /dev/null)"}##- *}#- } \ && ret=0 ;; (pop) _wanted -V "applied patches" expl "patch" \ compadd ${${(M)${(f)"$(stg series 2> /dev/null)"}##[+>] *}#[+>] } \ && ret=0 ;; (edit|files|goto|rename|log|float|delete|sink|mail|sync|show|pick|hide) _wanted -V "patches" expl "patch" \ compadd $(stg series --noprefix > /dev/null) \ && ret=0 ;; (*) _files ;; esac fi return ret PK[ZE,,functions/_gccnuW+A#compdef gcc g++ -value-,LDFLAGS,-default- -value-,CFLAGS,-default- -value-,CPPFLAGS,-default- local curcontext="$curcontext" state line ret=1 expl args args2 typeset -A opt_args if [[ "$service" = -value-* ]]; then compset -q words=( fake "$words[@]" ) (( CURRENT++ )) if [[ "$service" = *LDFLAGS ]]; then args2=( '-R:runtime path:->rundir' ) else args2=() fi else args2=( '*:input file:_files -g "*.([cCmisSoak]|cc|cxx|ii|k[ih])(-.)"' ) fi args=() case $MACHTYPE in m68*) args=( -m68000 -m68020 -m68020-40 -m68030 -m68040 -m68881 -mbitfield -mc68000 -mc68020 -mfpa -mnobitfield -mrtd -mshort -msoft-float ) ;; vax) args=( -mg -mgnu -munix ) ;; c[1234]*) args=( -mc1 -mc2 -mc32 -mc34 -mc38 -margcount -mnoargcount -mlong32 -mlong64 -mvolatile-cache -mvolatile-nocache ) ;; amd290?0) args=( -m29000 -m29050 -mbw -mnbw -mdw -mndw -mlarge -mnormal -msmall -mkernel-registers -mno-reuse-arg-regs -mno-stack-check -mno-storem-bug -mreuse-arg-regs -msoft-float -mstack-check -mstorem-bug -muser-registers ) ;; arm) args=( -mapcs -m2 -m3 -m6 -mbsd -mxopen -mno-symrename ) ;; m88k) args=( -m88000 -m88100 -m88110 -mbig-pic -mcheck-zero-division -mhandle-large-shift -midentify-revision -mno-check-zero-division -mno-ocs-debug-info -mno-ocs-frame-position -mno-optimize-arg-area -mno-serialize-volatile -mno-underscores -mocs-debug-info -mocs-frame-position -moptimize-arg-area -mserialize-volatile -msvr3 -msvr4 -mtrap-large-shift -muse-div-instruction -mversion-03.00 -mwarn-passed-structs '-mshort-data--:maximum displacement:' ) ;; rs6000|powerpc*) args=( '-mcpu=:CPU type:(rios1 rios2 rsc 501 603 604 power powerpc 403 common)' -mpower -mno-power -mpower2 -mno-power2 -mpowerpc -mno-powerpc -mpowerpc-gpopt -mno-powerpc-gpopt -mpowerpc-gfxopt -mno-powerpc-gfxopt -mnew-mnemonics -mno-new-mnemonics -mfull-toc -mminimal-toc -mno-fop-in-toc -mno-sum-in-toc -msoft-float -mhard-float -mmultiple -mno-multiple -mstring -mno-string -mbit-align -mno-bit-align -mstrict-align -mno-strict-align -mrelocatable -mno-relocatable -mtoc -mno-toc -mtraceback -mno-traceback -mlittle -mlittle-endian -mbig -mbig-endian -mcall-aix -mcall-sysv -mprototype ) ;; romp) args=( -mcall-lib-mul -mfp-arg-in-fpregs -mfp-arg-in-gregs -mfull-fp-blocks -mhc-struct-return -min-line-mul -mminimum-fp-blocks -mnohc-struct-return ) ;; mips*) args=( '-mcpu=:CPU type:(r2000 r3000 r4000 r4400 r4600 r6000_' -mabicalls -membedded-data -membedded-pic -mfp32 -mfp64 -mgas -mgp32 -mgp64 -mgpopt -mhalf-pic -mhard-float -mint64 -mips1 -mips2 -mips3 -mlong64 -mlong-calls -mmemcpy -mmips-as -mmips-tfile -mno-abicalls -mno-embedded-data -mno-embedded-pic -mno-gpopt -mno-long-calls -mno-memcpy -mno-mips-tfile -mno-rnames -mno-stats -mrnames -msoft-float -m4650 -msingle-float -mmad -mstats -EL -EB -nocpp '-G:maximum size for small section objects:' ) ;; i[3456]86|x86_64) args=( '-mtune=:CPU type:(i386 i486 i586 pentium pentium-mmx i686 pentiumpro pentium2 pentium3 pentium3m pentium-m pentium4 pentium4m prescott nocona k6 k6-2 k6-3 athlon athlon-tbird athlon-4 athlon-xp athlon-mp k8 opteron athlon64 athlon-fx winchip-c6 winchip2 c3 c3-2)' '-march=:CPU type:(i386 i486 i586 pentium pentium-mmx i686 pentiumpro pentium2 pentium3 pentium3m pentium-m pentium4 pentium4m prescott nocona k6 k6-2 k6-3 athlon athlon-tbird athlon-4 athlon-xp athlon-mp k8 opteron athlon64 athlon-fx winchip-c6 winchip2 c3 c3-2)' '-mfpmath=:FPU type:(387 sse sse,387)' '-masm=:asm dialect:(att intel)' -mieee-fp -mno-ieee-fp -msoft-float -mno-fp-ret-in-387 -mno-fancy-math-387 -malign-double -mno-align-double -m128bit-long-double -m96bit-long-double -msvr3-shlib -mno-svr3-shlib -mrtd '-mregparm=:number of integer argument registers:' '-mpreferred-stack-boundary=:size of boundary:' -mmmx -msse -msse2 -msse3 -m3dnow -mno-mmx -mno-sse -mno-sse2 -mno-sse3 -mno-3dnow -mpush-args -mno-push-args -maccumulate-outgoing-args -mthreads -mno-align-stringops -minline-all-stringops -momit-leaf-frame-pointer -mtls-direct-seg-refs -mno-tls-direct-seg-refs -m32 -m64 -mno-red-zone '-mcmodel=:memory model:(small kernel medium large)' -mno-wide-multiply '-mreg-alloc=:default register allocation order:' '-malign-jumps=: **2 base for jump goal alignment:' '-malign-loops=: **2 base for loop alignment:' '-malign-functions=: **2 base for function alignment:' ) ;; hppa*) args=( -mdisable-fpregs -mdisable-indexing -mfast-indirect-calls -mgas -mjump-in-delay -mlong-millicode-calls -mno-disable-fpregs -mno-disable-indexing -mno-fast-indirect-calls -mno-gas -mno-jump-in-delay -mno-millicode-long-calls -mno-portable-runtime -mno-soft-float -msoft-float -mpa-risc-1-0 -mpa-risc-1-1 -mportable-runtime '-mschedule=:code scheduling constraints:(700 7100 7100LC)' ) ;; i960) args=( -m{ka,kb,mc,ca,cf,sa,sb} -masm-compat -mclean-linkage -mcode-align -mcomplex-addr -mleaf-procedures -mic-compat -mic2.0-compat -mic3.0-compat -mintel-asm -mno-clean-linkage -mno-code-align -mno-complex-addr -mno-leaf-procedures -mno-old-align -mno-strict-align -mno-tail-call -mnumerics -mold-align -msoft-float -mstrict-align -mtail-call ) ;; sparc) args=( -mapp-regs -mno-app-regs -mfpu -mhard-float -mno-fpu -msoft-float -mhard-quad-float -msoft-quad-float -mno-unaligned-doubles -munaligned-doubles -mfaster-structs -mno-faster-structs -mimpure-text '-mcpu=:CPU type:(v7 cypress v8 supersparc sparclite f930 f934 hypersparc sparclite86x sparclet tsc701 v9 ultrasparc ultrasparc3)' '-mtune=:CPU type:(cypress supersparc hypersparc f930 f934 sparclite86x tsc701 ultrasparc ultrasparc3)' -mv8plus -mno-v8plus -mvis -mno-vis -mlittle-endian -m32 -m64 '-mcmodel=:memory model:(medlow medmid medany embmedany)' -mstack-bias -mno-stack-bias -mv8 -mcypress -mepilogue -mflat -mno-flat -mno-epilogue -msparclite -msupersparc -mmedlow -mmedany -mint32 -mint64 -mlong32 -mlong64 ) ;; alpha*) args=( -mfp-regs -mno-fp-regs -mno-soft-float -msoft-float ) ;; clipper) args=( -mc300 -mc400 ) ;; h8/300) args=( -mrelax -mh ) ;; esac _arguments -C -M 'L:|-{fW}no-=-{fW} r:|[_-]=* r:|=*' \ "$args[@]" \ -c -S -E -v -a -w -C -H -P -s '(-pg)-p' '(-p)-pg' \ '-o:output file:_files -g "^*.(c|h|cc|C|cxx)(-.)"' \ '-x:input file language:(c objective-c c++ c-header cpp-output c++-cpp-output assembler assembler-with-cpp none)' \ '+e-:virtual function definitions in classes:((0\:only\ interface 1\:generate\ code))' \ '-d-:dump:->dump' \ '-g-::debugging information type:(gdb coff stabs stabs+ dwarf dwarf+ xcoff xcoff+)' \ '-O-::optimization level:(0 1 2 3)' \ '*-M-::output dependencies:((M\:only\ user\ header\ files MD\:output\ to\ file G\:treat\ missing\ header\ files\ as\ generated))' \ '*-A-:define assertion:' \ '*-D-:define macro:' \ '*-U-:undefine macro:' \ '*-Wp,-:preprocessor option:' \ '*-Wl,-:linker option:' \ '*-Xlinker:linker option:' \ '*-u:pretend symbol to be undefined:' \ '*-Wa,-:assembler option:' \ '*-l:library:->library' \ '*-L-:library search path:_files -/' \ '*-I-:header file search path:_files -/' \ '-B-:executable prefix:_files -/' \ '-b:target machine:' \ '-V:gcc version:' \ '-print-file-name=:library:->library' \ '-print-prog-name=:program:' \ '*-include:include file:_files -g \*.h\(-.\)' \ '*-imacros:macro input file:_files -g \*.h\(-.\)' \ '*-idirafter:second include path directory:_files -/' \ '*-iprefix:prefix:_files' \ '*-iwithprefix:second include path directory:_files -/' \ '*-iwithprefixbefore:main include path directory:_files -/' \ '*-isystem:second include path directory (system):_files -/' \ -nostdinc -trigraphs -undef -pipe -ansi \ -fallow-single-precision -fcond-mismatch -fasm \ -fbuiltin -fsigned-bitfields -fsigned-char \ -funsigned-bitfields -funsigned-char -fwritable-strings \ -traditional -traditional-cpp -trigraphs \ -fall-virtual -fdollars-in-identifiers -felide-constructors \ -fenum-int-equiv -fexternal-templates -ffor-scope \ -fhandle-signatures -fmemoize-lookups -fdefault-inline -fgnu-keywords \ -fnonnull-objects -foperator-names -fstrict-prototype \ -fthis-is-variable -nostdinc++ -traditional \ -fsyntax-only -pedantic -pedantic-errors \ -Wall -Waggregate-return -Wbad-function-cast \ -Wcast-align -Wcast-qual -Wchar-subscript -Wcomment \ -Wconversion -Wenum-clash -Werror -Wformat \ '-Wid-clash--:minimum identifier difference length:' \ -Wimplicit -Wimport -Winline \ '-Wlarger-than--:maximum object length:' \ -Wmissing-declarations \ -Wmissing-prototypes -Wnested-externs \ -Wimport -Woverloaded-virtual -Wparentheses \ -Wpointer-arith -Wredundant-decls -Wreorder -Wreturn-type -Wshadow \ -Wstrict-prototypes -Wswitch -Wsynth -Wtemplate-debugging \ -Wtraditional -Wtrigraphs -Wuninitialized -Wunused \ -Wwrite-strings \ -fpretend-float \ -print-libgcc-file-name \ -print-search-dirs -save-temps \ -fcaller-saves -fcse-follow-jumps -fcse-skip-blocks \ -fdelayed-branch -fexpensive-optimizations \ -ffast-math -ffloat-store -fforce-addr -fforce-mem \ -finline-functions -fkeep-inline-functions \ -fdefault-inline -fdefer-pop -ffunction-cse \ -finline -fpeephole -fomit-frame-pointer \ -frerun-cse-after-loop -fschedule-insns \ -fschedule-insns2 -fstrength-reduce -fthread-jumps \ -funroll-all-loops -funroll-loops \ -nostartfiles -nodefaultlibs -nostdlib \ -static -shared -symbolic \ '*-fcall-saved--:register saved by function call:' \ '*-fcall-used--:register clobbered by function call:' \ '*-ffixed--:fixed register:' \ -finhibit-size-directive \ -fno-common -fno-ident -fno-gnu-linker \ -fpcc-struct-return -fpic -fPIC \ -freg-struct-return -fshared-data -fshort-enums \ -fshort-double -fvolatile -fvolatile-global \ -fverbose-asm -fpack-struct \ "$args2[@]" && ret=0 case "$state" in dump) _values -s '' 'dump information' \ 'M[only macro definitions]' \ 'N[macro names]' \ 'D[macro definitions and normal output]' \ 'y[debugging information during parsing]' \ 'r[after RTL generation]' \ 'x[only generate RTL]' \ 'j[after jump optimization]' \ 's[after CSE]' \ 'L[after loop optimization]' \ 't[after second CSE pass]' \ 'f[after flow analysis]' \ 'c[after instruction combination]' \ 'S[after first instruction scheduling pass]' \ 'l[after local register allocation]' \ 'g[after global register allocation]' \ 'R[after second instruction scheduling pass]' \ 'J[after last jump optimization]' \ 'd[after delayed branch scheduling]' \ 'k[after conversion from registers to stack]' \ 'a[all dumps]' \ 'm[print memory usage statistics]' \ 'p[annotate assembler output]' && ret=0 ;; library) _wanted libraries expl library \ compadd - ${^=LD_LIBRARY_PATH:-/usr/lib /usr/local/lib}/lib*.(a|so*)(:t:fr:s/lib//) && ret=0 ;; rundir) compset -P '*:' compset -S ':*' _files -/ -S/ -r '\n\t\- /:' "$@" ;; esac return ret PK[]functions/_arpnuW+A#compdef arp local state line expl curcontext="$curcontext" local -a cmds cmds=(-a --display -d --delete -s --set -f --file) _arguments -C \ "($cmds 1 -D --use-device)"{-a,--display}'[show entries for all or specified hosts]:host:->hostintable' \ "($cmds 1 -n --numeric -D --use-device -H --hw-type)"{-d,--delete}'[delete entry from table]:host:->hostintable' \ "($cmds 1 -n --numeric)"{-s,--set}'[create an ARP entry]:host:_hosts:ethernet address::*:option:(temp trail pub)' \ "($cmds 1 -n --numeric)"{-f,--file}'[read multiple entries from file]:file:_files' \ '(-i --device)'{-i,--device}'[select an interface]:::_net_interfaces:' \ '(-D --use-device -a --display -d --delete)'{-D,--use-device}"[use the interface ifa's hardware address]" \ '(-H --hw-type -d --delete)'{-H,--hw-type}'[class of entries to check for]:class:(ether arcnet pronet ax25 netrom)' \ '(-n --numeric -d --delete -s --set -f --file)'{-n,--numeric}'[shows numerical addresses]' \ '(-v --verbose)'{-v,--verbose}'[be verbose]' \ '(-a)1:host:->hostintable' [[ "$state" = hostintable ]] && _wanted hosts expl 'host' compadd ${${${(f)"$(${words[1]} -an)"}##[ ?(]#}%%[ )]*} PK[-3functions/_aliasnuW+A#compdef alias local curcontext="$curcontext" state line expl type suf typeset -A opt_args _arguments -C -s -A "-*" -S \ '(-r +r -s +s)-+g[list or define global aliases]' \ '(-g +g -s +s)-+r[list or define regular aliases]' \ '(-r +r -g +g)-+s[list or define suffix aliases]' \ '-+m[print aliases matching specified pattern]' \ '-L[print each alias in the form of calls to alias]' \ '*::alias definition:->defn' if [[ -n "$state" ]]; then if compset -P 1 '*='; then compset -q _normal else compset -S '=*' || suf='=' type=( ${opt_args[(i)[-+][grs]]#?} ) (( $#type )) && type=( -s $type ) _wanted -x alias expl 'alias definition' _aliases -qS "$suf" "$type[@]" fi fi PK[qMMfunctions/VCS_INFO_detect_darcsnuW+A## vim:ft=zsh ## darcs support by: Frank Terbeck ## Distributed under the same BSD-ish license as zsh itself. setopt localoptions NO_shwordsplit [[ $1 == '--flavours' ]] && return 1 VCS_INFO_check_com ${vcs_comm[cmd]} || return 1 vcs_comm[detect_need_file]=format VCS_INFO_bydir_detect '_darcs' return $? PK[8__functions/_wigglenuW+A#compdef wiggle local fns='-m --merge -d --diff -x --extract' _arguments \ "($fns -1 -2 -3)"{-m,--merge}'[select the merge function]' \ "($fns -3 3)"{-d,--diff}'[display differences between files]' \ "($fns 2 3)"{-x,--extract}'[extract one branch of a patch or merge file]' \ '(-w --words -l --lines)'{-w,--words}'[make operations and display word based]' \ '(-l --lines -w --words)'{-l,--lines}'[make operations and display line based]' \ '(-p --patch)'{-p,--patch}'[treat last named file as a patch]' \ '(-r --replace)'{-r,--replace}'[replace orginal file with merged output]' \ '(-R --reverse -x --extract)'{-R,--reverse}'[swap the files or revert changes]' \ '(-2 -3 -m --merge)-1[select branch]' \ '(-1 -3 -m --merge)-2[select branch]' \ '(-1 -2 -m --merge)-3[select branch]' \ '(1 2 3 -)'{-h,--help}'[display help information]' \ '(1 2 3 -)'{-V,--version}'[display version information]' \ '(-v --verbose -q --quiet)'{-v,--verbose}'[enable verbose output]' \ '(-q --quiet -v --verbose)'{-q,--quiet}'[enable quiet output]' \ '1:file:_files' \ '2:file:_files' \ '3:file:_files' PK[ o;;functions/_fusernuW+A#compdef fuser local -a args arg1 typeset -A opt_args if _pick_variant -c $words[1] psmisc=psmisc unix -V; then (( $+functions[_fuser_services] )) || _fuser_services() { local expl suf ret=1 [[ $opt_args[-n] = ??p || $EUID = 0 ]] || return if compset -P '*/'; then _wanted protocols expl protocol compadd tcp udp elif compset -P '*,*,'; then compset -S '/*' || [[ -n $opt_args[-n] ]] || suf=( -qS / ) _ports $suf && ret=0 elif compset -P '*,'; then compset -S ',*' || suf=( -S , -r "/ \t\n\-" ) _hosts $suf && ret=0 else compset -S ',*' || suf=( -S ${${opt_args[-n]/?*/,}:-/} -r "/, \t\n\-" ) _ports $suf && ret=0 fi return ret } _arguments \ '(-s)-a[show all files specified on the command line]' \ {-c,-m}'[list all processes accessing files on the filesystem specified by name]' \ '-k[kill processes accessing the file]' \ '-i[ask for confirmation before killing]' \ '-l[list all known signal names]' \ '-n[select name space]:namespace:(file udp tcp)' \ '(-a)-s[silent operation]' \ '-signal[send alternate signal with -k]:signal:_signals' \ '-u[append the user name of the process owner to each PID]' \ '-v[verbose mode]' \ '-V[display version information]' \ '-4[search only for IPv4 sockets]' \ '-6[search only for IPv6 sockets]' \ '*:name: _alternative "files:file:_files" "services:service:_fuser_services"' else case $OSTYPE in solaris2.9 ) args=( '-n[list only processes with non-blocking mandatory locks]' '-s[send alternate signal with -k]:signal:_signals' ) ;; sysv4 ) (( $+words[(r)-k] )) && arg1=( ':name: _alternative signals\:signal\:_signals\ -p files:file:_files' ) ;; esac _arguments \ '(-f)-c[list all processes accessing files on the filesystem specified by name]' \ '(-c)-f[list all processes accessing named files]' \ '-k[kill processes accessing the file]' \ '-u[append the user name of the process owner to each PID]' \ $args \ $arg1 \ '*:file:_files' fi PK[f functions/merenuW+A# read a man page setopt localoptions extendedglob local manual="$1" col=col terminal=man magic line # /usr/bin/col on SunOS 4 doesn't support -x. if [[ -x /usr/5bin/col ]]; then col=/usr/5bin/col; fi # SunOS 5 has no `man' terminal. if [[ -d /usr/share/lib/nterm && ! -e /usr/share/lib/nterm/tab.$terminal ]]; then terminal=lp; fi # HP-UX has no `man' terminal. if [[ -d /usr/share/lib/term && ! -e /usr/share/lib/term/tab$terminal ]]; then terminal=lp; fi # IRIX has no `man' terminal. if [[ -d /usr/lib/nterm && ! -e /usr/lib/nterm/tab.$terminal ]]; then terminal=lp; fi # Unixware has no `man' terminal. if [[ -d /usr/ucblib/doctools/nterm && ! -e /usr/ucblib/doctools/nterm/tab.$terminal ]]; then terminal=lp; fi # Solaris has SGML manuals. if [[ -f /usr/lib/sgml/sgml2roff ]] && [[ "$(read -er < $manual)" = "map' && ret=0 ;; ypmatch) _arguments -C -s "$_yp_args[@]" '::key map:->keymap' ':map name:->map' && ret=0 ;; yppasswd) _users return ;; ypwhich) _arguments -C \ '(-x)-d[specify domain]:domain name' \ '(-x -V2 -m -t)-V1[identify version 1 servers]' \ '(-x -V1 -m -t)-V2[identify version 2 servers]' \ '(: -x -V1 -V2 -m)-t[specify map name]:map name:->maponly' \ '(: -x -V1 -V2 -t)-m[specify map or nick name]:map or nick name:->map' \ '(: -d -m -t -V1 -V2)-x[display nicknames]' \ ':host:_hosts' && ret=0 ;; ypset) _arguments -C \ '(-V2)-V1[bind version 1 servers]' \ '(-V1)-V2[bind version 2 servers]' \ '-d[specify domain]:domain name' \ '-h[set NIS binding on specified host]:host:_hosts' \ ':server:_hosts' && ret=0 ;; ypserv) _arguments -C \ '-a[specify database routines]:database routines:((b\:btree d\:dbm/ndbm h\:hash))' && ret=0 ;; ypbind) _arguments -C \ '-s[allow secure mode for ypbind]' \ '-S[set domain and servers]:domain:->servers' \ '(-ypsetme)-ypset[accept all ypset requests]' \ '(-ypset)-ypsetme[accept only local ypset requests]' && ret=0 ;; yppush) _arguments -C \ '-d[specify domain]:domain name' \ '-v[print messages]' \ ':map name:->map' && ret=0 ;; yppoll) _arguments -C \ '-d[specify domain]:domain name' \ '-h[ask specified yp server]:host:_hosts' \ ':map name:->map' && ret=0 ;; ypxfr) _arguments -C \ '-a[specify database routines]:database routines:((b\:btree d\:dbm/ndbm h\:hash))' \ '-f[force transfer]' \ "-c[don't clear current map]" \ '-d[specify domain]:domain name' \ '-h[get map from specified host instead of master]:host:_hosts' \ '-C[call back]:transaction ID: :program number: :IP address: :port number' \ ':map name:->map' && ret=0 ;; domainname) _message -e new-domains 'new domain name' return 1 ;; esac [[ "$state" = keymap ]] && _message -e keys 'key' if [[ "$state" = map* ]]; then if [[ $+opt_args[-t] -eq 0 && "$state" != maponly ]]; then _tags maps nicknames else _tags maps fi while _tags; do # The `-M ...' allows `pa.n' to complete to `passwd.byname'. _requested maps expl 'map name' \ compadd -M 'l:.|by=by l:.|=by r:|.=* r:|=*' -a \ _yp_cache_maps && ret=0 _requested nicknames expl nicknames \ compadd -a _yp_cache_nicks && ret=0 (( ret )) || return 0 done elif [[ "$state" = servers ]]; then if compset -P '*,'; then _wanted hosts expl server _hosts -qS, && ret=0 else _message -e domains 'domain name' fi fi return ret PK[ g g functions/keymap+widgetnuW+A#autoload ## # self-insert-by-keymap originally appeared in zsh-users/10559 (July 2006). # Changes have been made to the widget naming scheme, based on feedback on # the mailing list thread. ## emulate -L zsh zmodload -i zsh/zleparameter || return 1 # Rebind the most common widgets to override in multiple keymaps. Ideally # complete-word would also be in this list, but so many other things # already rebind complete-word that doing so here is a waste of effort. local -a m local w='' k='' for w in self-insert accept-line forward-char backward-char \ up-{,line-or-}history down-{,line-or-}history \ magic-space backward-delete-char delete-char-or-list do # If this is run early enough that all the widgets are still builtins, # no explicit remapping is needed. If they've already been rebound, # it's not safe to assume we can do so again. if [[ $widgets[$w] != (builtin|user:$w-by-keymap) ]] then m+="Cannot rebind $w: $widgets[$w]" continue fi function $w-by-keymap { if (( $+widgets[$KEYMAP+$WIDGET] == 1 )) then zle $KEYMAP+$WIDGET "$@" else zle .$WIDGET "$@" fi } zle -N $w $w-by-keymap done [[ -n $m ]] && { zle && zle -M "${(F)m}" || print -l -u2 -R $m } return 0 # With this in place, you should rarely need "zle -N self-insert frob" # again. Instead you do this: # # bindkey -N frobber main # zle -N frobber+self-insert frob # # Then, whenever you wish to replace self-insert with frob, change # keymaps: # # zle recursive-edit -K frobber # Here's a simple example, which improves upon the caps-lock example in # the zsh manual entry for recursive-edit: # # ucase+self-insert() { # LBUFFER+=${(U)KEYS[-1]} # } # zle -N ucase+self-insert # caps-lock() { # bindkey -N ucase $KEYMAP # bindkey -M ucase "$KEYS" .accept-line # zle recursive-edit -K ucase || zle send-break # } # zle -N caps-lock # # To turn this on, pick a key sequence (I've chosen ctrl-x shift-L) and # bind the caps-lock widget to it: # # bindkey -M main '^XL' caps-lock # Another example of using a continuation widget to propagate accept-line # (or any other binding from the original keymap) through the caller: # # bindkey -N newkeymap $KEYMAP # recursive-edit-and-accept() { # local -a __accepted # zle -N newkeymap+accept-line end-recursive-edit # zle recursive-edit -K newkeymap || zle send-break # if [[ ${__accepted[0]} != end-recursive-edit ]] # then zle "${__accepted[@]}"; return # else return 0 # fi # } # end-recursive-edit() { # __accepted=($WIDGET ${=NUMERIC:+-n $NUMERIC} "$@") # zle .accept-line # return 0 # } PK[/8functions/_mailboxesnuW+A#autoload _mailboxes() { #emulate -L zsh local expl ret=1 local maildirectory pinedirectory zstyle -s ":completion:${curcontext}:" mail-directory maildirectory || maildirectory="~/Mail" zstyle -s ":completion:${curcontext}:" pine-directory pinedirectory if (( ! $+_mailbox_cache )) then _mailbox_cache "$@" fi case "${curcontext}:" in (*:mail:*) if [[ "$PREFIX" == +* ]]; then _tags mailboxes else _tags mailboxes files fi;; (*:(mush|zmail|zmlite):*) if [[ "$PREFIX" == [%+]* ]]; then _tags mailboxes else _tags mailboxes files fi;; (*:mutt:*) if [[ "$PREFIX" == (|-f)[+=]* ]]; then _tags mailboxes else _tags mailboxes files fi;; (*:pine:*) # Files for pine must be absolute paths. if [[ "$PREFIX" == (|-f)[/\~]* ]]; then pinedirectory='' _tags mailboxes files else _tags mailboxes fi;; (*) if [[ "$PREFIX" == (|-f)+* ]]; then _tags mailboxes else _tags mailboxes files fi;; esac while _tags; do _requested mailboxes expl 'mailbox specification' _mua_mailboxes && ret=0 if _requested files expl 'mailbox file'; then [[ "${curcontext}:" != *:(mail|mush|mutt|zmail|zmlite):* ]] && compset -P -f _files "$expl[@]" && ret=0 fi (( ret )) || return 0 done return 1 } _mailbox_cache () { local i j _mc_tmp local -aU dirboxes local maildirectory pinedirectory muttrc typeset -aU -g _mailbox_cache typeset -aU -g _maildir_cache _mbox_cache _mh_cache _mutt_cache _pine_cache zstyle -s ":completion:${curcontext}:" mail-directory maildirectory || maildirectory="~/Mail" zstyle -s ":completion:${curcontext}:" pine-directory pinedirectory zstyle -s ":completion:${curcontext}:" muttrc muttrc || muttrc="~/.muttrc" [[ -f ${~muttrc:-.} ]] && _mc_tmp=${=${(M)${(f)"$(<${~muttrc})"}:#mailboxes *}#mailboxes *} && _mutt_cache=( ${=${(Xe)_mc_tmp}} ) _mbox_cache=( ${~maildirectory}/*(^/) ) if [[ -n $pinedirectory ]]; then _pine_cache=( ${~pinedirectory}/**/*(.) ) else _pine_cache=() fi dirboxes=( ${~maildirectory}/*(/) ) while (( $#dirboxes )); do i=${dirboxes[1]} shift dirboxes if [[ -d "$i/cur" ]]; then _maildir_cache=( "${_maildir_cache[@]}" "$i" ) elif j=( "$i"/<1-> ) && [[ -n "$j" ]]; then _mh_cache=( "${_mh_cache[@]}" "$i" ) dirboxes=( $dirboxes "$i"/*(/) ) else _mbox_cache=( "${_mbox_cache[@]}" "$i"/*(.) ) dirboxes=( $dirboxes "$i"/*(/) ) fi done [[ -n "$mailpath" ]] && _mailbox_cache=( "${_mailbox_cache[@]}" "${(@)mailpath%%\?*}" ) [[ -n "$MAIL" ]] && _mailbox_cache=( "${_mailbox_cache[@]}" $MAIL ) } _mua_mailboxes() { local -a mbox_short local -aU mbox_names local ret=1 local maildirectory pinedirectory zstyle -s ":completion:${curcontext}:" mail-directory maildirectory || maildirectory="~/Mail" zstyle -s ":completion:${curcontext}:" pine-directory pinedirectory case "${curcontext}:" in (*:elm:*) # I've probably got this wrong, or at least incomplete mbox_names=( "${_mbox_cache[@]}" "${_mailbox_cache[@]}" ) mbox_short=( \! \< \> ) ;; (*:mail:*) if compset -P +; then mbox_names=( "${(@)_mbox_cache#$~maildirectory/}" ) else mbox_names=( +"${(@)^_mbox_cache#$~maildirectory/}" "${_mailbox_cache[@]}" ) fi ;; (*:mh:*) local lastmhbox=$(mhpath) if compset -P +; then mbox_names=( "${(@)_mh_cache#$~maildirectory/}" ) elif compset -P @; then mbox_names=( "${(@)${(@M)_mh_cache:#$~lastmhbox/*}#$~lastmhbox/}" ) else mbox_names=( +"${(@)^_mh_cache#$~maildirectory/}" @"${(@)^${(@M)_mh_cache:#$~lastmhbox/*}#$~lastmhbox/}" "${_mh_cache[@]}" ) fi ;; (*:mush:*) if compset -P %; then mbox_short=( "${(@k)userdirs}" ) elif compset -P +; then mbox_names=( "${(@)_mbox_cache#$~maildirectory/}" ) else mbox_names=( +"${(@)^_mbox_cache#$~maildirectory/}" "${_mailbox_cache[@]}" ) mbox_short=( \& % %"${(@k)^userdirs}" ) fi ;; (*:mutt:*) if compset -P '(|\\)='; then mbox_names=( "${_mutt_cache[@]#[+=]}" "${(@)_mbox_cache#$~maildirectory/}" "${(@)_maildir_cache#$~maildirectory/}" "${(@)_mh_cache#$~maildirectory/}") elif compset -P +; then mbox_names=( "${_mutt_cache[@]#[+=]}" "${(@)_mbox_cache#$~maildirectory/}" "${(@)_maildir_cache#$~maildirectory/}" "${(@)_mh_cache#$~maildirectory/}") else mbox_names=( "${_mutt_cache[@]}" "${_mailbox_cache[@]}" "${_maildir_cache[@]}" "${_mh_cache[@]}" ) mbox_short=( \! \< \> ) fi ;; (*:pine:*) mbox_names=( "${_mbox_cache[@]}" "${_mailbox_cache[@]}" "${_mh_cache[@]}" ) # Pine is like mail but with no leading `+' to disambiguate; # any files not in $pinedirectory must be absolute paths. if [[ -n $pinedirectory ]]; then mbox_names+=( "${(@)_pine_cache#$~pinedirectory/}" ) fi ;; (*:tkrat:*) # Has a couple of custom formats I haven't programmed for. mbox_names=( "${_mbox_cache[@]}" "${_mailbox_cache[@]}" "${_mh_cache[@]}" ) ;; (*:(zmail|zmlite):*) if compset -P %; then mbox_short=( "${(@k)userdirs}" ) elif compset -P +; then mbox_names=( "${(@)_mbox_cache#$~maildirectory/}" ) else mbox_names=( +"${(@)^_mbox_cache#$~maildirectory/}" "${_mailbox_cache[@]}" "${_mh_cache[@]}" ) mbox_short=( \& % %"${(@k)^userdirs}" ) fi ;; (*) # Some other program wants mailbox names? Use them all? mbox_names=( "${_mailbox_cache[@]}" "${_mbox_cache[@]}" "${_mh_cache[@]}" "${_mutt_cache[@]}" "${_pine_cache[@]}" ) ;; esac (( $#mbox_names )) && _multi_parts "$@" / mbox_names && ret=0 (( $#mbox_short )) && compadd "$@" -a mbox_short && ret=0 return ret } _mailboxes "$@" PK[]k{{functions/_dpkg-crossnuW+A#compdef dpkg-cross local _dpkgcross_arches _dpkgcross_arches=(/etc/dpkg-cross/cross-config.*(N)) _dpkgcross_arches=(${${_dpkgcross_arches#*.}:-alpha amd64 common cygwin-i386 gnu hppa i386 linux m32r m68k mips powerpc sh sh3 sh3eb sh4 sh4eb w32}) _arguments \ '(-h --help)'{-h,--help}'[show summary of options]' \ '(-v --verbose)'{-v,--verbose}'[be more verbose]' \ '(-q --quiet)'{-q,--quiet}'[be more quiet]' \ '(-a --arch)'{-a,--arch}':architecture:('"$_dpkgcross_arches"')' \ '(-i --install)'{-i,--install}'[install packages]' \ '(-A --convert-anyway)'{-A,--convert-anyway}'[convert package even if not useful]' \ '(-b --build)'{-b,--build}'[just build but do not install]' \ '(-r --remove)'{-r,--remove}'[remove packages]' \ '(-s --status)'{-s,--status}'[print status of named packages]' \ '(-l --list)'{-l,--list}'[print short status of named packages or patterns]' \ '(-L --list-files)'{-L,--list-files}'[list files belonging to named packages]' \ '(-u --update)'{-u,--update}'[update current cross-inst]' \ '(-Q --query)'{-Q,--query}'[print available update packages]' \ '*:package or path or pattern:_files' PK[]functions/prompt_oliver_setupnuW+A# oliver prompt theme prompt_oliver_help() { cat <<'ENDHELP' With this prompt theme, the prompt contains the current directory, history number, number of jobs (if non-zero) and the previous command's exit code (if non-zero) and a final character which depends on priviledges. The colour of the prompt depends on two associative arrays - $pcolour and $tcolour. Each array is indexed by the name of the local host. Alternatively, the colour can be set with parameters to prompt. To specify colours, use English words like 'yellow', optionally preceded by 'bold'. The hostname and username are also included unless they are in the $normal_hosts or $normal_users array. ENDHELP } prompt_oliver_setup() { prompt_opts=( cr subst percent ) [[ "${(t)pcolour}" != assoc* ]] && typeset -Ag pcolour [[ "${(t)tcolour}" != assoc* ]] && typeset -Ag tcolour local pcol=${1:-${pcolour[${HOST:=`hostname`}]:-bold}} local pcolr="%F{${${pcol#bold}:-default}}" [[ $pcol = bold* ]] && pcolr=%B$pcolr local tcol=${2:-${tcolour[$HOST]}} local tcolr="fg=${${tcol#bold}:-default}" [[ $tcol = bold* ]] && tcolr=bold,$tcolr local a host="%m:" user="%n " [[ $HOST == (${(j(|))~normal_hosts}) ]] && host="" [[ $LOGNAME == (root|${(j(|))~normal_users}) ]] && user="" PS1="$pcolr$user$host%~%"'$((COLUMNS-12))'"(l.$prompt_newline. )[%h%1(j.%%%j.)%0(?..:%?)]%# %b%f%k" RPS2='<%^' PS2='' zle_highlight[(r)default:*]=default:$tcolr } prompt_oliver_setup "$@" PK[Hfunctions/_user_at_hostnuW+A#autoload # Complete user/host combinations. Normally this looks for the style # `users-hosts' for the tag `accounts'. A different tag may be given # with `-t tag'. # A `-' or `--' as the first argument is ignored. local expl suf tag=accounts if [[ "$1" = -t?* ]]; then tag="${1[3,-1]}" shift elif [[ "$1" = -t ]]; then tag="$2" shift 2 fi [[ "$1" = -(|-) ]] && shift if [[ -prefix 1 *@ ]]; then local user=${PREFIX%%@*} compset -P 1 '*@' _wanted -C user-at hosts expl "host for $user" \ _combination -s '[:@]' "${tag}" users-hosts users="$user" hosts "$@" - else compset -S '@*' || suf="@" _wanted users expl "user" \ _combination -s '[:@]' "${tag}" users-hosts users -S "$suf" -q "$@" - fi PK[=++functions/_options_setnuW+A#autoload # Complete all set options. This relies on `_main_complete' to store the # names of the options that were set when it was called in the array # `_options_set'. local expl _wanted zsh-options expl 'set zsh option' \ compadd "$@" -M 'B:[nN][oO]= M:_= M:{A-Z}={a-z}' -a - _options_set PK[˕N]]functions/_dictnuW+A#compdef dict local strategy database state line curcontext="$curcontext" typeset -A opt_args _arguments -C -S \ '(--host -h)'{--host=,-h+}'[specify hostname of dict server]:dict server:_hosts' \ '(--port -p)'{--port=,-p+}'[specify port for dict server]:service:_ports' \ '(--database -d)'{--database=,-d+}'[database]:db name:->database' \ '(--match -m)'{--match,-m}'[perform matching]' \ '(--strategy -s)'{--strategy=,-s+}'[specify matching strategy]:strategy:->strategy' \ '(--nocorrect -C)'{--nocorrect,-C}'[disable spelling correction]' \ '(--config -c)'{--config=,-c+}'[specify config file]:config file:_files' \ '(--dbs -D)'{--dbs,-D}'[list available databases]' \ '(--strats -S)'{--strats,-S}'[list available search strategies]' \ '(--serverhelp -H)'{--serverhelp,-H}'[query server for help info it provides]' \ '(--info -i)'{--info=,-i+}'[get info on specified database]:db name:->database' \ '(--serverinfo -I)'{--serverinfo,-I}'[display info about server]' \ '(--noauth -a)'{--noauth,-a}'[disable authentication]' \ '(--user -u)'{--user=,-u+}'[specify username for authentication]:user name:' \ '(--key -k)'{--key=,-k+}'[specify key for authentication]:shared secret:' \ '(-)'{--version,-V}'[display program version]' \ '(-)'{--license,-L}'[display program license]' \ '(-)--help[display usage info]' \ '(--verbose -v)'{--verbose,-v}'[verbose output]' \ '(--raw -r)'{--raw,-r}'[be very verbose]' \ '(--pager -P)'{--pager=,-P+}'[specify pager]:program:_command_names -e' \ '--pipesize=[specify buffer size for pipelining commands]:buffer size:' \ '--client=[specify additional text to send to server]:client text' \ '--debug=[set a debug flag]:debug flag:(verbose raw scan parse pipe serial time)' \ ':word:_dict_words' && return case "$state" in strategy) strategy=( ${${${(f)"$(_call_program strategy dict -S 2>/dev/null)"}[2,-1]#?}/ ##/:} ) _describe -t strategy strategy strategy && return ;; database) database=( ${${${(f)"$(_call_program database dict --dbs 2>/dev/null)"}[2,-1]#?}/ ##/:} ) _describe -t database database database && return ;; esac PK[a,, functions/cdrnuW+A# Description # =========== # # Change to a recently used directory recorded in a file so that the # recent file list persists across sessions. # # To use this system, # # autoload -Uz chpwd_recent_dirs cdr add-zsh-hook # add-zsh-hook chpwd chpwd_recent_dirs # # (add-zsh-hook appeared in zsh version 4.3.4.) This ensures that all # directories you change to interactively are registered. The # chpwd_recent_dirs function does some guesswork to see if you are "really" # changing directory permanently, see below. # # The argument to cdr is a number corresponding to the Nth most recently # changed-to directory starting at 1 for the immediately preceeding # directory (the current directory is remembered but is not offered as a # destination). You can use directory arguments if you set the # recent-dirs-default style, see below; however, it should be noted # that if you do you gain nothing over using cd directly (the recent # directory list is updated in either case). # # If the argument is omitted, 1 is assumed. # # Completion is available if compinit has been run; menu selection is # recommended, using # # zstyle ':completion:*:*:cdr:*:*' menu selection # # and also the verbose style to ensure the directory is shown (this # is on by default). # # Options # ======= # # "cdr -l" lists the numbers and the corresponding directories in # abbreviated form (i.e. with "~" substitution reapplied), one per line. # The directories here are not quoted (this would only be an issue if a # directory name contained a newline). This is used by the completion # system. # # "cdr -r" sets the parameter "reply" to the current set of directories. # # "cdr -e" allows you to edit the list of directories, one per line. The # list can be edited to any extent you like; no sanity checking is # performed. Completion is available. No quoting is necessary (except for # newlines, where I have in any case no sympathy); directories are in # unabbreviated from and contain an absolute path, i.e. they start with / # (and only /). Usually the first entry should be left as the current # directory. # # Details of directory handling # ============================= # # Recent directories are saved to a file immediately and hence are # preserved across sessions. Note currently no file locking is applied: # the list is updated immediately on interactive commands and nowhere else # (unlike history), and it is assumed you are only going to change # directory in one window at once. This is not safe on shared accounts, # but in any case the system has limited utility when someone else is # changing to a different set of directories behind your back. # # To make this a little safer, only directory changes instituted from the # command line, either directly or indirectly through shell function calls # (but not through subshells, evals, traps, completion functions and the # like) are saved. This works best in versions of the shell from 4.3.11 # which has facilities to check the evaluation context. Shell functions # should use cd -q or pushd -q to avoid side effects if the change to the # directory is to be invisible at the command line. See the function # chpwd_recent_dirs for more details. # # Styles # ====== # # Various styles are available. The context for setting styles should be # ':chpwd:*' in case the meaning of the context is extended in future, for # example: # # zstyle ':chpwd:*' recent-dirs-max 0 # # although the style name is specific enough that a context of '*' should # be fine in practice. The only exception is recent-dirs-insert, which is # used exclusively by the completion system and so has the usual completion # system context (':completion:*' if nothing more specific is needed, # though again '*' should be fine in practice). # # recent-dirs-default # If true, and the command is expecting a recent directory index, and # either there is more than one argument or the argument is not an # integer, then fall through to "cd". This allows the lazy to use only # one command for directory changing. Completion recognises this, too; # see recent-dirs-insert for how to control completion when this option # is in use. # # recent-dirs-file # The file where the list of directories is saved. The default # is ${ZDOTDIR:-$HOME}/.chpwd-recent-dirs, i.e. this is in your # home directory unless you have set ZDOTDIR to point somewhere else. # Directory names are saved in $'...' quoted form, so each line # in the file can be supplied directly to the shell as an argument. # # The value of this style may be an array. In this case, the first # file in the list will always be used for saving directories while any # other files are left untouched. When reading the recent directory # list, if there are fewer than the maximum number of entries in the # first file, the contents of later files in the array will be appended # with duplicates removed from the list shown. The contents of the two # files are not sorted together, i.e. all the entries in the first file # are shown first. The special value "+" can appear in the list to # indicate the default file should be read at that point. This allows # effects like the following: # # zstyle recent-dirs-file ':chpwd:*' ~/.chpwd-recent-dirs-${TTY##*/} + # # Recent directories are read from a file numbered according to # the terminal. If there are insufficient entries the list # is supplemented from the default file. # # recent-dirs-insert # Used by completion. If recent-dirs-default is true, then setting # this to true causes the actual directory, rather than its index, to # be inserted on the command line; this has the same effect as using # the corresponding index, but makes the history clearer and the line # easier to edit. With this setting, if part of an argument was # already typed, normal directory completion rather than recent # directory completion is done; this is because recent directory # completion is expected to be done by cycling through entries menu # fashion. However, if the value of the style is "always", then only # recent directories will be completed; in that case, use the cd # command when you want to complete other directories. If the value is # "fallback", recent directories will be tried first, then normal # directory completion is performed if recent directory completion # failed to find a match. Finally, if the value is "both" then both # sets of completions are presented; the usual tag mechanism can be # used to distinguish results, with recent directories tagged as # "recent-dirs". Note that the recent directories inserted are # abbreviated with directory names where appropriate. # # recent-dirs-max # The maximum number of directories to save to the file. If # this is zero or negative there is no maximum. The default is 20. # Note this includes the current directory, which isn't offered, # so the highest number of directories you will be offered # is one less than the maximum. # # recent-dirs-prune # This style is an array determining what directories should (or should # not) be added to the recent list. Elements of the array can include: # parent # Prune parents (more accurately, ancestors) from the recent list. # If present, changing directly down by any number of directories # causes the current directory to be overwritten. For example, # changing from ~pws to ~pws/some/other/dir causes ~pws not to be # left on the recent directory stack. This only applies to direct # changes to descendant directories; earlier directories on the # list are not pruned. For example, changing from ~pws/yet/another # to ~pws/some/other/dir does not cause ~pws to be pruned. # pattern: # Gives a zsh pattern for directories that should not be # added to the recent list (if not already there). This element # can be repeated to add different patterns. For example, # 'pattern:/tmp(|/*)' stops /tmp or its descendants from being # added. The EXTENDED_GLOB option is always turned on for # these patterns. # # recent-dirs-pushd # If set to true, cdr will use pushd instead of cd to change the # directory, so the directory is saved on the directory stack. As the # directory stack is completely separate from the list of files saved # by the mechanism used in this file there is no obvious reason to do # this. # # Use with dynamic directory naming # ================================= # # It is possible to refer to recent directories using the dynamic directory # name syntax that appeared in zsh version 4.3.7. If you create and # autoload a function zsh_directory_name containing the following code, # ~[1] will refer to the most recent directory other than $PWD, and so on. # This also includes completion (version 4.3.11 is required for this to # work; previous versions needed the file _dynamic_directory_name to # be overloaded). # # if [[ $1 = n ]]; then # if [[ $2 = <-> ]]; then # # Recent directory # typeset -ga reply # autoload -Uz cdr # cdr -r # if [[ -n ${reply[$2]} ]]; then # reply=(${reply[$2]}) # return 0 # else # reply=() # return 1 # fi # fi # elif [[ $1 = c ]]; then # if [[ $PREFIX = <-> || -z $PREFIX ]]; then # typeset -a keys values # # values=(${${(f)"$(cdr -l)"}/ ##/:}) # keys=(${values%%:*}) # # _describe -t dir-index 'recent directory index' \ # values keys -V unsorted -S']' # return # fi # fi # return 1 emulate -L zsh setopt extendedglob autoload -Uz chpwd_recent_filehandler chpwd_recent_add integer list set_reply i bad edit local opt dir local -aU dirs while getopts "elr" opt; do case $opt in (e) edit=1 ;; (l) list=1 ;; (r) set_reply=1 ;; (*) return 1 ;; esac done shift $(( OPTIND - 1 )) if (( set_reply )); then typeset -ga reply else local -a reply fi if (( list || set_reply || edit )); then (( $# )) && bad=1 else if [[ $#1 -eq 0 ]]; then 1=1 elif [[ $# -ne 1 || $1 != <-> ]]; then if zstyle -t ':chpwd:' recent-dirs-default; then cd "$@" return else bad=1 fi fi fi if (( bad )); then print "Usage: $0 [-l | -r | ] Use $0 -l or completion to see possible directories." return 1 fi chpwd_recent_filehandler if [[ $PWD != $reply[1] ]]; then # When we first start we don't have the current directory. # Add it now for consistency. chpwd_recent_add $PWD && chpwd_recent_filehandler $reply fi if (( edit )); then local compcontext='directories:directory:_path_files -/' IFS=' ' vared reply || return 1 chpwd_recent_filehandler $reply fi # Skip current directory if present (may have been pruned). [[ $reply[1] = $PWD ]] && reply=($reply[2,-1]) if (( list )); then dirs=($reply) for (( i = 1; i <= ${#dirs}; i++ )); do print -n ${(r.5.)i} print -r ${(D)dirs[i]} done return fi (( set_reply || edit )) && return if (( $1 > ${#reply} )); then print "Not enough directories ($(( ${#dirs} - 1)) possibilities)" >&2 return 1 fi dir=${reply[$1]} if zstyle -t ':chpwd:' recent-dirs-pushd; then pushd -- $dir else cd -- $dir fi PK[ld functions/_lsnuW+A#compdef ls gls # Ulrik Haugen 2001 local arguments is_gnu _pick_variant -r is_gnu gnu=gnu unix --help if [[ "$OSTYPE" = (netbsd*|freebsd*|openbsd*|darwin*) && "$is_gnu" != gnu ]]; then arguments=( '(-A)-a[list entries starting with .]' '(-a)-A[list all except . and ..]' '-d[list directory entries instead of contents]' '-L[list referenced file for sym link]' '-R[list subdirectories recursively]' '(-k)-h[print sizes in human readable form]' '(-h)-k[print sizes of 1k]' '-i[print file inode numbers]' '(-l -g -1 -C -m -x)-l[long listing]' '(-l -1 -C -m -x)-g[long listing but without owner information]' '(-l -g -C -m -x)-1[single column output]' '(-l -g -1 -m -x)-C[list entries in columns sorted vertically]' '(-l -g -1 -C -x)-m[comma separated]' '(-l -g -1 -C -m)-x[sort horizontally]' '-o[display file flags]' '-s[display size of each file in blocks]' '(-u)-c[status change time]' '(-c)-u[access time]' '-f[unsorted, all, short list]' '-r[reverse sort order]' '(-t)-S[sort by size]' '(-S)-t[sort by modification time]' '(-p)-F[append file type indicators]' '(-F)-p[append file type indicators for directory]' '-f[output is not sorted]' '-n[numeric uid, gid]' '-T[show complete time information]' '(-B -b -w -q)-B[print octal escapes for control characters]' '(-B -b -w -q)-b[as -B, but use C escape codes whenever possible]' '(-B -b -w -q)-q[hide control chars]' '(-B -b -w -q)-w[print raw characters]' '*:files:_files' ) if [[ "$OSTYPE" = (freebsd*|darwin*) ]]; then arguments+=( '-G[enable colorized output]' '-H[follow symlinks on the command line]' '-P[do not follow symlinks]' ) fi else arguments=( '(--all -a -A --almost-all)'{--all,-a}'[list entries starting with .]' '(--almost-all -A -a --all)'{--almost-all,-A}'[list all except . and ..]' '--author[print the author of each file]' '(--ignore-backups -B)'{--ignore-backups,-B}"[don't list entries ending with ~]" '(--directory -d)'{--directory,-d}'[list directory entries instead of contents]' '(--dired -D)'{--dired,-D}"[generate output designed for Emacs' dired mode]" '(--ignore,-I)'{--ignore,-I}"[don't list entire matching pattern]:pattern:" '(--dereference -L --dereference-command-line --dereference-command-line-symlink-to-dir)'{--dereference,-L}'[list referenced file for sym link]' '(--dereference -L --dereference-command-line --dereference-command-line-symlink-to-dir)'{--dereference-command-line,--dereference-command-line-symlink-to-dir} '(--recursive -R)'{--recursive,-R}'[list subdirectories recursively]' '(--no-group -G)'{--no-group,-G}'[inhibit display of group information]' '(--human-readable -h -H --si)'{--human-readable,-h}'[print sizes in human readable form]' '(--si -H -h --human-readable)'{--si,-H}'[sizes in human readable form; powers of 1000]' '(--inode -i)'{--inode,-i}'[print file inode numbers]' '(--format -l -g -o -1 -C -m -x)-l[long listing]' '(--format -l -1 -C -m -x)-g[long listing but without owner information]' '(--format -l --no-group -G -1 -C -m -x)-o[no group, long]' '(--format -l -g -o -C -m -x)-1[single column output]' '(--format -l -g -o -1 -m -x)-C[list entries in columns sorted vertically]' '(--format -l -g -o -1 -C -x)-m[comma separated]' '(--format -l -g -o -1 -C -m)-x[sort horizontally]' '(-l -g -o -1 -C -m -x)--format=:format:(verbose long commas horizontal across vertical single-column)' '(--size -s -f)'{--size,-s}'[display size of each file in blocks]' '(--time -u)-c[status change time]' '(--time -c)-u[access time]' '(-c -u)--time=[specify time to show]:time:(ctime status use atime access)' '--time-style=[show times using specified style]:time style:(full-iso long-iso iso locale)' '(-a --all -U -l --format -s --size -t --sort --full-time)-f[unsorted, all, short list]' '(--reverse)'{--reverse,-r}'[reverse sort order]' '(--sort -t -U -v -X)-S[sort by size]' '(--sort -S -U -v -X)-t[sort by modification time]' '(--sort -S -t -v -X)-U[unsorted]' '(--sort -S -t -U -X)-v[sort by version (filename treated numerically)]' '(--sort -S -t -U -v)-X[sort by extension]' '(-S -t -U -v -X)--sort=:sort:(size time none version extension)' '--color=-[control use of color]:color:(never always auto)' '(--classify -F --indicator-style -p --file-type)'{--classify,-F}'[append file type indicators]' '(--file-type -p --indicator-style -F --classify)'{--file-type,-p}'[append file type indicators except *]' '(-F --classify -p --file-type)--indicator-style=:indicator style:(none file-type classify)' '(-f)--full-time[list both full date and full time]' '(--kilobytes -k --block-size)'{--kilobytes,-k}'[use block size of 1k]' '(-k --kilobytes)--block-size=[specify block size]:block size (bytes):(1024)' '(--numeric-uid-gid -n)'{--numeric-uid-gid,-n}'[numeric uid, gid]' '(--tabsize -T)'{--tabsize=,-T+}'[specify tab size]:tab size' '(--width -w)'{--width=,-w+}'[specify screen width]:screen width' '(--quoting-style -b --escape -N --literal -Q --quote-name)'{--escape,-b}'[print octal escapes for control characters]' '(--quoting-style -b --escape -N --literal -Q --quote-name)'{--literal,-N}'[print raw characters]' '(--quoting-style -b --escape -N --literal -Q --quote-name)'{--quote-name,-Q}'[quote names]' '(-b --escape -N --literal -Q --quote-name)--quoting-style=:quoting style:(literal shell shell-always c escape clocale locale)' '(--hide-control-chars -q --show-control-chars)'{--hide-control-chars,-q}'[hide control chars]' '(-q --hide-control-chars)--show-control-chars' '(- :)--help[display help information]' '(- :)--version[display version information]' '*:files:_files' ) # remove long options? if [[ $is_gnu != gnu ]]; then arguments=( ${${${arguments:#(|*\))--*}//--[^ )]#/}/\( #\)/} ) fi fi _arguments -s $arguments PK[XXfunctions/_x_argumentsnuW+A#compdef -P */X11(|R<4->)/* local ret long xargs opts rawret nm="$compstate[nmatches]" xargs=( '-display:display:_x_display' '-geometry:geometry:_x_geometry' ) (( $# )) || xargs=( "$xargs[@]" '*:default: _default' ) long=$argv[(I)--] if (( long )); then argv[long]=( "$xargs[@]" -- ) else set -- "$@" "$xargs[@]" fi opts=() while [[ $1 = -(O*|[CRWsw]) ]]; do opts=($opts $1) [[ $1 = -R ]] && rawret=yes shift done _arguments -R "$opts[@]" "$@" ret=$? if [[ "$ret" = 300 ]]; then compstate[restore]='' [[ -z $rawret ]] && ret=$(( nm == $compstate[nmatches] )) fi return ret PK[0Efunctions/_x_modifiernuW+A#autoload local expl _wanted modifiers expl modifier \ compadd "$@" -M 'm:{a-z}={A-Z}' - \ Shift Lock Control Mod1 Mod2 Mod3 Mod4 Mod5 PK[ǹD]functions/_defaultnuW+A#compdef -default- local ctl if { zstyle -s ":completion:${curcontext}:" use-compctl ctl || zmodload -e zsh/compctl } && [[ "$ctl" != (no|false|0|off) ]]; then local opt opt=() [[ "$ctl" = *first* ]] && opt=(-T) [[ "$ctl" = *default* ]] && opt=("$opt[@]" -D) compcall "$opt[@]" || return 0 fi _files "$@" && return 0 # magicequalsubst allows arguments like =~/foo to do # file name expansion after the =. In that case, it's natural to # allow completion to handle file names after any equals sign. if [[ -o magicequalsubst && "$PREFIX" = *\=* ]]; then compstate[parameter]="${PREFIX%%\=*}" compset -P 1 '*=' _value "$@" else return 1 fi PK[բw;;functions/_grep-excusesnuW+A#compdef grep-excuses _arguments \ '(--no-conf --noconf)'{--no-conf,--noconf}'[do not read any config files]' \ '(--wipnity -w)'{--wipnity,-w}'[get information from release.debian.org]' \ '--version[display version information]' \ '--help[display help information]' \ ':package:_deb_packages avail' PK["Gfunctions/_x_windownuW+A#autoload local list expl _tags windows || return 1 list=( "${(@)${(M@)${(@f)$(_call_program windows xwininfo -root -tree)}:#[ ]#0x[0-9a-f]# \"*}##[ ]#}" ) if [[ "$1" = -n ]]; then shift _wanted windows expl 'window name' \ compadd "$@" -d list - "${(@)${(@)list#*\"}%%\"*}" else [[ "$1" = - ]] && shift _wanted windows expl 'window ID' compadd "$@" -d list - "${(@)list%% *}" fi PK[}؆LLfunctions/_growisofsnuW+A#compdef mkisofs growisofs local context state line typeset -A opt_args declare -a find_options find_options=( '( -L -P)-H[follow symbolic links encountered on the command line]' '(-H -P)-L[follow all symbolic links]' '(-H -L )-P[do not follow symbolic links (default)]' '(- *)-help[print -find help]' '(- *)-version[print -find version]') local find_paths find_paths='*: :_directories' declare -a find_operators find_operators=( '*-a[logical and of options]' '*-o[logical or of options]') declare -a find_expressions # TODO: Modes (see _chmod) # TODO: Ranges # TODO: The -type types should be documented correctly and only include D on # Solaris systems (?) # TODO: --sfm is only available on NT systems (i.e., cygwin?) find_expressions=( '*-acl[true if the file has additional ACLs defined]' '*-atime[true if the last-access time is in the specified range]:range' '*-chgrp[change group of file]:group:_group' '*-chmod[change mode of file]:mode' '*-chown[change user of file]:user:_user' '*-ctime[true if the inode-change time is in the specified range]:range' '*-depth[evaluate directory contents before directory itself]' '*-dostat[do not do stat optimization]' '*-exec[execute program on found file]:program: _command_names -e:*\;::program arguments: _normal' '*-false[always false]' '*-fstype[true if the file is on a file system of the given type]:file-system type:_file_systems' '*-group[true if the file is owned by the given group]:group:_groups' '*-inum[true if the inode of the file is in the specified range]:inode range' '*-linkedto[true if the file is linked to the given file]:file:_files' '*-links[true if the file has a number of links to it in the specified range]:number of links' '*-lname[true if symbolic-link name matches the given glob]:glob' '*-local[true if the file is on a local file-system]' '*-lpat[true if symbolic-link name matches the given pattern]:pattern' '*-ls[list found files]' '*-maxdepth[descend at most the given number of directories deep]:maximum search depth:' '*-mindepth[descend at least the given number of directories deep]:minimum search depth' '*-mtime[true if the last-modification time is in the specified range]:range' '*-name[true if file-name matches the given glob]:glob' '*-newer[true if last-modification time is newer than that of the given file]:file:_files' '*-neweraa[true if the last-access time is newer than that of the given file]:file:_files' '*-newerac[true if the last-access time is newer than the inode-change time of the given file]:file:_files' '*-neweram[true if the last-access time is newer than the last-modification time of the given file]:file:_files' '*-newerca[true if the inode-change time is newer than the last-access time of the given file]:file:_files' '*-newercc[true if the inode-change time is newer than that of the given file]:file:_files' '*-newercm[true if the inode-change time is newer than the last-modification time of the given file]:file:_files' '*-newerma[true if the last-modification time is newer than the last-access time of the given file]:file:_files' '*-newermc[true if the last-modification time is newer than the inode-change time of the given file]:file:_files' '*-newermm[true if the last-modification time is newer than that of the given file]:file:_files' '*-nogroup[true if the group of the file is not in the group database]' '*-nouser[true if the user of the file is not in the user database]' '*-ok[execute program on found file, after confirmation]:program: _command_names -e:*\;::program arguments: _normal' '*-pat[true if the file-name matches the given pattern]:pattern' '*-path[true if the full path matches the given glob]:glob' '*-perm[true if the given symbolic or octal permission matches that of the file]:mode' '*-ppat[true if the full path matches the given pattern]:pattern' '*-print[print filenames to stdout separated by newlines]' '*-printnnl[print filenames to stdout separated by spaces]' '*-prune[do not descend into found directory]' '*-size[true if the size of the file is in the given range]:range' '*-sparse[true if the file appears to be sparse]' '*-true[always true]' '*-type[true if the file is of the given type]:file type:((b\:"block (buffered) special" \ c\:"character (unbuffered) special" \ d\:directory \ p\:"named pipe (FIFO)" \ f\:"regular file" \ l\:"symbolic link" \ s\:socket \ D\:"door (Solaris)" e\:unknown))' '*-user[true if the file is owned by the given user]:user:_users' '*-xattr[true if the file has extended attributes]' '*'{-xdev,-mount}'[restrict the search to the current file-system]') (( $+_cache_mkisofs_find_primaries_not_taking_an_argument )) || _cache_mkisofs_find_primaries_not_taking_an_argument=(\) ${${${find_expressions:#\*-*\[*\]:*}#\*}%%\[*}) (( $+_cache_mkisofs_find_primaries_taking_an_argument )) || _cache_mkisofs_find_primaries_taking_an_argument=(${${${(M)find_expressions:#\*-*\[*\]:*}#\*}%%\[*}) (( $+functions[_mkisofs_character_sets] )) || _mkisofs_character_sets () { local expl character_sets character_sets=${${(f)"$(_call_program character-sets mkisofs -input-charset help 2>&1)"}[3,-1]} _wanted character-sets expl 'character set' compadd - $character_sets } (( $+functions[_mkisofs_sparc_boot_images] )) || _mkisofs_sparc_boot_images () { compset -P '*,' sep='-qS,' [[ $words[CURRENT] == ?*,?*,?*,?*,?*,?*,* ]] && sep= _alternative \ "boot-images:boot image:_files $sep" \ 'boot-image-replications:boot-image replication:((...\:"use the previous boot-image for the rest of the partitions"))' } # TODO: Need to escape = in the result. (( $+functions[_mkisofs_pathspec] )) || _mkisofs_pathspec () { local sep if (( $words[(I)-graft-points] )); then if ! compset -P '*[^\\]\='; then sep='-qS=' fi fi _files $sep } integer index_of_find (( index_of_find = $words[(I)-find] )) if (( index_of_find > 0 && index_of_find < CURRENT )); then if (( $words[(I)-help] || $words[(I)-version] )); then _message 'no more arguments' elif (( index_of_find == CURRENT - 1 )); then _arguments \ $find_options \ $find_paths \ $find_expressions elif ((( index_of_find == CURRENT - 2 )) && [[ $words[CURRENT-1] == -([HLP]|-(help|version)) ]]) || [[ -d $words[CURRENT-1] ]]; then # TODO: all $words[index_of_find,CURRENT-1] must be -d. # But we can perhaps assume that the user hasn’t gone back and changed an # argument without thinking about it carefully…otherwise, all previous # words of interest will have passed the -d test. _arguments \ $find_paths \ $find_expressions else integer i (( i = index_of_find + 1 )) while [[ $words[i] == -([HLP]|-(help|version)) ]]; do (( i++ )) done while [[ -d $words[i] ]]; do (( i++ )) done words=($words[1,index_of_find] $words[i,-1]) (( CURRENT -= i - index_of_find - 1 )) echo one: $i - $CURRENT - $words > /dev/pts/8 integer old_words_length (( old_words_length = $#words )) words=(${words:#\\[()\!]}) (( CURRENT -= old_words_length - $#words )) echo two: $i - $CURRENT - $words > /dev/pts/8 _arguments \ $find_operators \ $find_expressions fi # elif (( $_cache_mkisofs_find_primaries_not_taking_an_argument[(I)$words[CURRENT-1]] || # $_cache_mkisofs_find_primaries_taking_an_argument[(I)$words[CURRENT-2]] )); then # _arguments \ # $find_operators \ # $find_expressions \ # '*:fuck: ' # echo 3 > /dev/pts/7 # else # _arguments \ # $find_expressions \ # '*:fuck: ' # echo 4 > /dev/pts/7 # fi else declare -a growisofs_options if [[ $service == growisofs ]]; then growisofs_options=( '-Z[burn an initial session to the selected device]:device:->devimg' '-M[merge a session with an existing one on the selected device]:device:->devimg' '-dvd-compat[provide maximum compatibility with DVD-ROM/Video]' '-dry-run[do everything up to the actual burning process]' '-overburn[allow overburning of the media]' '-speed=-[set recording speed]:speed') fi # TODO: -M device and -dev device _arguments \ '-abstract[specify the abstract file-name]:file:_files' \ '-A[specify application id]:application id' \ {-allow-leading-dots,-ldots}'[allow ISO9660 filenames to begin with a period]' \ '-allow-lowercase[allow lower-case characters in ISO9660 filenames]' \ '-allow-multidot[allow more than one dot in ISO9660 filen-names]' \ '-biblio[specify the bibliographic file-name]:file:_files' \ '(-no-cache-inodes )-cache-inodes[cache inode and device numbers to find hard links to files]' \ '( -cache-inodes)-no-cache-inodes[do not cache inode and device numbers]' \ '-b[specify path and file-name of a el torito boot-image]:boot image:_files' \ '-eltorito-alt-boot[start a new set of el torito boot parameters]' \ {-B,-sparc-boot}'[specify comma-separated list of boot images needed for sparc systems]:boot image:_mkisofs_sparc_boot_images' \ '-G[specify path and file-name of a generic boot-image]:boot image:_files' \ '-hard-disk-boot[specify that the el torito boot-image is a hard-disk image]' \ '-no-emul-boot[specify that the el torito boot-image is a "no emulation" image]' \ '-no-boot[specify that the el torito CD should be markes an non-bootable]' \ '-boot-load-seg[specify the load-segment address of the boot-image for a "no emulation" image]:segment address' \ '-boot-lead-size[specify the number of 512-byte sectors to load in "no emulation" mode]:load sectors' \ '-boot-info-table[specify that a 56-byte table of CD-ROM-layout information should be written]' \ '-C[specify last session start and next session start addresses for CDextra]' \ '-c[specify the path and file-name of a boot catalog to be used for an el torito bootable-CD]' \ '-check-oldnames[check all filenames imported from an old session against current rules]' \ '-check-session[check old session for compliance against current rules]' \ '-copyright[specify the path and file-name of the copyright file]' \ '-d[omit trailing period from files that do not have a period]' \ '-D[do not use deep directory-realocation]' \ '-dir-mode[specify the mode of directories]' \ '-dvd-video[generate a DVD-Video compliant UDF file-system]' \ '-f[follow symbolic links when generating the file system]' \ '-file-mode[specify the mode of regular files]' \ '-find[the rest of the command line is treated like a find expression]' \ '-gid[use the given group-id for files in the image]:group:_groups' \ '-gui[behave favorable towards a GUI]' \ '-graft-points[allow graft-points in filenames]' \ '*-hide[hide files and directories matching the given glob on the image]:glob' \ '-hide-list[hide files and directories found in the given file]:file-list file:_files' \ '-hide-joliet[hide files and directories matching the given glob in the Joliet tree of the image]:glob' \ '-hide-joliet-trans-tbl[hide the TRANS.TBL files from the Joliet tree]' \ '-hide-rr-moved[rename the RR_MOVED directory to .rr_moved in the Rock Ridge tree]' \ '-input-charset[specify the character set of source files]:character set:_mkisofs_character_sets' \ '-output-charset[specify the character set of files in the Rock Ridge tree]:_mkisofs_character_sets' \ '-iso-level[specify ISO9660 conformance level]:ISO9660 conformance level:(1 2 3 4)' \ '-J[generate a Joliet tree]' \ '-joliet-long[generate a Joliet tree allowing filenames up to 103 characters long]' \ '-jcharset[specify the character set of files in the Joliet tree]:_mkisofs_character_sets' \ '-l[allow full 31-character filenames]' \ '-log-file[write all output to the given file]:log file:_files' \ '-m[exclude files matching the given glob from the image]:glob' \ '-exclude-list[exclude files matching globs in the given file]:glob file:_files' \ '-max-iso9660-filenames[allow 37-character ISO9660-filenames]' \ '-M[specify path or device to existing ISO9660 image to merge with]:ISO9660 image:_files' \ '-dev[specify device of existing ISO9660 image to merge with]:ISO9660 device' \ '-N[omit version numbers from ISO9660 filenames]' \ '-new-dir-mode[mode to use when creating directories in the ISO9660 image]:mode' \ {-nobak,-no-bak}'[do not include backup files on the ISO9660 file-system]' \ '-force-rr[do not use the automatic Rock Ridge attribute-recognition for previous sessions]' \ '-no-rr[do not use use the Rock Ridge attributes from previous sessions]' \ '-no-split-symlink-components[do not split the symbolic-link compontents]' \ '-no-split-symlink-fields[do not split the symbolic-link fields]' \ '-o[output the ISO9660-file-system image to the given file]:ISO9660 image:_files' \ '-pad[pad the end of the image by 150 sectors]' \ '-no-pad[do not pad the end of the image by 150 sectors]' \ '-path-list[read directory and file-name pathspecs from the given file]' \ '-publisher[specify what should be written in the publisher volume-header]' \ '-p[specify what should be written in the preparer volume-header]' \ '-print-size[print estimated file-system-size in multiples of the sector size and exit]' \ '-quiet[output even less information than usual]' \ '-R[generate SUSP and RR records using the Rock-Ridge protocol]' \ '-r[same as -R, but with more useful UID and GID values]' \ '-relaxed-filenames[allow more characters in ISO9660 filenames]' \ '-root[move all files and directories into the given directory on the image]:root directory:_directories' \ '-rrip110[create ISO9660-file-system images that follow the Rrip v1.10 standard]' \ '-rrip112[create ISO9660-file-system images that follow the Rrip v1.12 standard]' \ '-old-root[specify the root directory used in a previous session]:old root-directory:_directories' \ '-sort[sort files on the image based on weights defined in the given file]:sort-weighting file:_files' \ '-sparc-label[set the sun disk-label-name used for the -sparc-boot option]:label' \ '-split-output[split the output image into several files ~1GiB in size]' \ '-stream-media-size[enable streaming operation and set media size to given number of sectors]:media size in sectors' \ '-stream-file-name[reserved for future use]:name' \ '-sunx86-boot[specify a comma-separated list of file-system images needed to make a bootable Solaris-x86-CD]:list' \ '-sunx86-label[specify the SVr4 disk-label-name for the SVr4 disk-label created with the -sunx86-boot option]:label' \ '-sysid[specify the system ID]' \ '-T[generate a TRANS.TBL file in each directory on the image]' \ '-table-name[alternative translation-table filename]:translation-table filename:_files' \ '-ucs-level[specify Unicode conformance-level in the Joliet directory]:Unicode conformance-level:(1 2 3)' \ '-udf[include UDF support in the generated file-system image]' \ '-uid[use the given user-id for files in the image]:user:_users' \ '-use-fileversions[use version numbers found on the file system for files included in the image]' \ '-U[allow basically any characters in filenames in the ISO9660 image]' \ "-no-iso-translate[do not translate invalid characters '#' and '~' for ISO9660 filenames]" \ '-V[specify the volume ID]:volume ID' \ '-volset[specify the volume-set ID]:volume-set ID' \ '-volset-size[specify the size of the volume-set]:volume-set size' \ '-volset-seqno[specify the volume-set sequence-number]:volume-set sequence-number' \ '*-v[enable verbose execution (given twice produces additional output)]' \ '*-x[exclude complete pathname from the image]:path:_directories' \ '-z[generate special RRIP records for transparently compressed files]' \ '-hfs[create a ISO9660/HFS-hybrid CD]' \ '-apple[create an ISO9660 CD with apple extensions]' \ '-map[use the given file to map CREATOR and TYPE information for a file based on extension]:mapping file:_files' \ '-magic[the CREATOR and TYPE information is set using the magic number of the file]:magic file:_files' \ '-hfs-creator[specify the default CREATOR for all files in the image]:creator' \ '-hfs-type[specify the default TYPE for all files in the image]:type' \ '-probe[search the contents of files for known Apple/Unix file-formats]' \ '-no-desktop[do not create (empty) Desktop files]' \ '-map-name[use the HFS filename as the starting point for the image filenames]' \ '-boot-hfs-file[use the given file as a boot driver]:boot-driver file:_files' \ '-part[generate an HFS partition table]' \ '-auto[make the HFS CD auto-start with the given file]:auto-start file:_files' \ '-cluster-size[set the size in bytes of allocation units of PC-Exchange files]:cluster size' \ '-hide-hfs[hide files matching the given glob from the HFS volume]:glob' \ '-hide-hfs-list[hide files matching any of the globs found in the given file]:glob file:_files' \ '-hfs-volid[volume name for the HFS partition]:HFS volume-name' \ '-icon-position[use the icon-position information from the Apple/Unix file]' \ '-root-info[set metadata for the root folder of the HFS volume]' \ '*-prep-boot[specify the PReP boot-image-file]:PReP boot-image-file:_files' \ '-input--hfs-charset[specify the character set used in HFS filenames]:character set:_mkisofs_character_sets' \ '-output-hfs-charset[specify the character set of files in the HFS volume]:_mkisofs_character_sets' \ '-hfs-unlock[do not lock the HFS volume]' \ '-hfs-bless["bless" the given directory/folder]' \ '-hfs-params[override certain parameters used to create the HFS file system]:parameters' \ '--cap[look for AUFS CAP Macintosh files]' \ '--netatalk[look for NETATALK Macintosh files]' \ '--double[look for AppleDouble Macintosh files]' \ '--ethershare[look for Helios EtherShare Macintosh files]' \ '--ushare[look for IPT UShare Macintosh files]' \ '--exchange[look for PC Exchange Macintosh files]' \ '--sgi[look for SGI Macintosh files]' \ '--xinet[look for XINET Macintosh files]' \ '--macbin[look for MacBinary Macintosh files]' \ '--single[look for AppleSingle Macintosh files]' \ '--dave[look for Thursby Software Systems DAVE Macintosh files]' \ "--sfm[look for Microsoft's Services for Macintosh files]" \ '--osx-double[look for MacOS X AppleDouble Macintosh files]' \ '--osx-hfs[look for MacOS X HFS Macintosh files]' \ '(- *)-help[display help message]' \ '(- *)-version[display version information]' \ $growisofs_options \ '*:pathspec:_mkisofs_pathspec' && return 0 case "$state" in (devimg) if compset -P \*=; then _files else _files -g "*(%,@)" fi ;; esac fi PK[@@functions/_other_accountsnuW+A#compdef talk ntalk ytalk _user_at_host -t other-accounts "$@" PK[ȴ\}}functions/_x_borderwidthnuW+A#autoload local x="$argv[(I)-X]" if (( x )); then _message -r "$argv[x + 1]" else _message -e values 'border width' fi PK[@Bmfunctions/_jobs_bgnuW+A#compdef bg _jobs -s "$@" PK[functions/_terminalsnuW+A#compdef infocmp -value-,TERM,-default- local desc expl desc=( $TERMINFO ~/.terminfo $TERMINFO_DIRS /usr/{,share/}{,lib/}terminfo ) _wanted terminals expl 'terminal name' \ compadd "$@" - $desc/*/*(N:t) PK[jvvfunctions/_x_titlenuW+A#autoload local x="$argv[(I)-X]" if (( x )); then _message -r "$argv[x + 1]" else _message -e titles 'title' fi PK[^KMfunctions/_bogofilternuW+A#compdef bogoutil bogotune bogofilter local expl ret bogotokens _bogoutil_caching_policy () { local -a oldp # rebuild if cache is more than a week old oldp=( "$1"(mw+1) ) (( $#oldp )) && return 0 return 1 } _bogoutil() { typeset -a _bogoutil_actions _bogoutil_actions=(-h --help -V --version -d --dump -l --load -u --upgrade -m -w -p -H --db-verify -r -R --db-prune --db-recover --db-recover-harder --db-remove-environment -k --db-cachesize) _arguments -s \ '*'{-v,--verbosity}'[verbose]' \ '-n[replace non-ASCII characters]' \ {-D,--debug-to-stdout}'[redirect debug output to stdout]' \ '-a[acceptable token age]:date or day count' \ '-c[acceptable count]:count threshold' \ '-s[acceptable size range]:min-max range' \ {-y,--timestamp-date=}'[date for when unknown]:date in YYYYMMDD format' \ '(--input-file -I)'{-I,--input-file=}'[input file]:input file:_files' \ {-x,--debug-flags=}'[debug flags]:debug flags:' \ "($_bogoutil_actions)"{-d,--dump=}'[print contents of db]:database file:_files -g "*.db"' \ "($_bogoutil_actions)"{-l,--load=}'[load file into db]:textfile:_files' \ "($_bogoutil_actions)"{-u,--upgrade=}'[upgrade wordlist version]:database file:_files -g "*.db"' \ "($_bogoutil_actions)"'-m[perform maintenance functions]:file:_files' \ "($_bogoutil_actions)"'-w[display token information]:database file or directory:_files' \ "($_bogoutil_actions)"'-p[display token probability information]:database file or directory:_files' \ "($_bogoutil_actions)"'-H[print histogram]:database file or directory:_files' \ "($_bogoutil_actions)"'-r[recalculate ROBX]:database:_files -/' \ "($_bogoutil_actions)"'-R[recalculate and save ROBX]:database:_files -/' \ "($_bogoutil_actions)"{-k,--db-cachesize=}'[set Berkeley DB cache size]:size in MB:' \ "($_bogoutil_actions)"'--db-verify[verify database]:database:_files -/' \ "($_bogoutil_actions)"'--db-recover[run regular recovery]:database:_files -/' \ "($_bogoutil_actions)"'--db-recover-harder[run catastrophic recovery]:database:_files -/' \ "($_bogoutil_actions)"'--db-prune[checkpoint database]:database:_files -/' \ "($_bogoutil_actions)"'--db-remove-environment:database:_files -/' \ '--db_lk_max_locks[set max lock count]' \ '--db_lk_max_objects[set max object count]' \ "($_bogoutil_actions)"'-h[help]' \ "($_bogoutil_actions)"'--help' \ "($_bogoutil_actions)"'-V[version]' \ "($_bogoutil_actions)"'--version' \ '*:tokens:->tokens' && ret=0 zstyle -s ":completion:${curcontext}:" cache-policy update_policy if [[ -z "$update_policy" ]]; then zstyle ":completion:${curcontext}:" cache-policy _bogoutil_caching_policy fi case $state in (tokens) if ( [[ -z "$bogotokens" ]] || _cache_invalid bogotokens ) && ! _retrieve_cache bogotokens; then bogotokens=(${${(f)"$(_call_program bogoutil bogoutil -d ~/.bogofilter/wordlist.db -c 50)"}%% *}) _store_cache bogotokens bogotokens else : fi _wanted tokens expl "token" \ compadd -a bogotokens ;; esac } case $service in (bogoutil) _bogoutil "$@" ;; (bogotune) _arguments \ '-h[help]' \ '-C[do not read standard configs]' \ '-c[config file]:config file:_files' \ '-D[do not a wordlist file]' \ '-d[wordlist dir]:directory:_files -/' \ '-E[disable ESF tuning]' \ '-M[output input file in message count format]' \ '-r[specify robx value]:robx value:' \ '-T[specify fp target value]:fp target value:' \ '-s[spam files]:spam files:_files' \ '-n[non-spam files]:non-spam files:_files' \ '-v[verbose]' \ '-q[quiet]' ;; (bogofilter) _arguments -s -w \ '(--help)-h[help]' \ '(--version)-V[version]' \ '(--query)-Q[query]' \ '-QQ[display extended config info]' \ '(--passthrough)-p[passthrough]' \ '(--ham-true)-e[ham-true]' \ '(--update-as-scored)-u[update-as-scored]' \ '(--classify-mbox)-M[classify-mbox]' \ '(--classify-stdin)-b[classify-stdin]' \ '(--classify-files)-B[classify-files]:file list:_files' \ '(--dataframe)-R[print R dataframe]' \ '(--register-spam)-s[register as spam]' \ '(--register-ham)-n[register as non-spam]' \ '(--unregister-spam)-S[unregister as spam]' \ '(--unregister-ham)-N[unregister as non-spam]' \ '(--config-file)-c[config file]:config file:_files' \ '(--no-config-file)-C[do not read standard config files]' \ '(--bogofilter_dir)-d[wordlist directory]' \ '(--no-header-tags)-H[disable header line tagging]' \ '(--db_cachesize)-k[set Berkeley DB cache size]:megabytes:' \ '(--use-syslog)-l[log via syslog]' \ '(--syslog-tag)-L[specify tag value for log messages]:tag:' \ '(--input-file)-I[specify input file instead of stdin]:input file:_files' \ '(--output-file)-O[specify output file instead of stdout]:output file:_files' \ '(--min_dev --robs --robx)-m[user-defined min_dev, robs, and robx]:values:' \ '(--spam_cutoff --ham_cutoff)-o[user-defined spam and ham cutoffs]:values:' \ '(--terse)-t[terse output mode]' \ '(--fixed-terse-format)-T[invariant terse output mode]' \ '(--report-unsure)-U[print statistics if spamicity is unsure]' \ '(--verbosity)-v[set debug verbosity level]' \ '(--timestamp-date)-y[set date for token timestamps]' \ '(--debug-to-stdout)-D[direct debug output to stdout]' \ '(--debug-flags)-x[debug flags]:debug flags:' ;; esac PK[6;J J functions/_hostsnuW+A#compdef ftp rwho rup xping traceroute host aaaa zone mx ns soa txt # avoid calling variable "hosts", it's an obvious candidate for use in # zstyle -e '*' hosts 'reply=($hosts)' local expl _hosts tmp useip if ! zstyle -a ":completion:${curcontext}:hosts" hosts _hosts; then if (( $+_cache_hosts == 0 )); then # uniquify typeset -gUa _cache_hosts local ipstrip='[:blank:]#[^[:blank:]]#' # This boolean style determines whether hosts completes IP addresses. The # default is no (not using IP addresses). zstyle -t ":completion:${curcontext}:hosts" use-ip && useip=yes [[ -n $useip ]] && ipstrip= if (( ${+commands[getent]} )); then # pws: we were using the horrible ": ${(A)...:=}" syntax to assign # to _cache_hosts, overriding the typeset as well as being unreadable # and having obscure splitting behaviour. Why? We've just # tested _cache_hosts doesn't exist. _cache_hosts=(${(s: :)${(ps:\t:)${(f)~~"$(_call_program hosts getent hosts 2>/dev/null)"}##${~ipstrip}}}) else _cache_hosts=(${(s: :)${(ps:\t:)${${(f)~~"$(/dev/null); then _cache_hosts+=( ${=${(f)tmp}##${~ipstrip}} ) # If you use YP fi fi local khostfile typeset -Ua khostfiles # This style specifies a list of files to look up for host names and IP # addresses, if asked to. The files can contain comma separated host names # and IP's, and any text on a line after the first whitespace,| or # is # discarded. ssh's known_hosts files are thus supported. This style defaults # to the list /etc/ssh/ssh_known_hosts, ~/.ssh/known_hosts zstyle -a ":completion:${curcontext}:hosts" known-hosts-files khostfiles || khostfiles=(/etc/ssh/ssh_known_hosts ~/.ssh/known_hosts) for khostfile in $khostfiles; do if [[ -r $khostfile ]]; then khosts=(${${(s:,:)${(j:,:)${(u)${(f)"$(<$khostfile)"}%%[ |#]*}}}:#*[\[\]]*}) if [[ -z $useip ]]; then khosts=(${${${khosts:#(#s)[0-9]##.[0-9]##.[0-9]##.[0-9]##(#e)}:#(#s)[0-9a-f:]##(#e)}:#*[\[\]]*}) fi _cache_hosts+=($khosts) fi done fi _hosts=( "$_cache_hosts[@]" ) fi _wanted hosts expl host \ compadd -M 'm:{a-zA-Z}={A-Za-z} r:|.=* r:|=*' -a "$@" - _hosts PK[ functions/narrow-to-regionnuW+A# Restrict the start of the editable line to the region between cursor # and mark (including the character at the end). Can be bound used as # a zle widget, or called as a function from another widget. # # Optionally accepts exactly two arguments, which are used instead of # $CURSOR and $MARK as limits to the range. # # Other options: # -p pretext show `pretext' instead of the buffer text before the region. # -P posttext show `posttext' instead of the buffer text after the region. # Either or both may be empty. # -n Only replace the text before or after the region with # the -p or -P options if the text was not empty. # -S statevar # -R statevar # Save or restore the state in/from the parameter named statevar. In # either case no recursive editing takes place; this will typically be # done within the calling function between calls with -S and -R. The # statevar may not begin with the prefix _ntr_ which is reserved for # parameters within narrow-to-region. emulate -L zsh setopt extendedglob local _ntr_lbuffer _ntr_rbuffer local _ntr_predisplay=$PREDISPLAY _ntr_postdisplay=$POSTDISPLAY integer _ntr_start _ntr_end _ntr_swap _ntr_cursor=$CURSOR _ntr_mark=$MARK integer _ntr_stat local _ntr_opt _ntr_pretext _ntr_posttext _ntr_usepretext _ntr_useposttext local _ntr_nonempty _ntr_save _ntr_restore while getopts "np:P:R:S:" _ntr_opt; do case $_ntr_opt in (n) _ntr_nonempty=1 ;; (p) _ntr_pretext=$OPTARG _ntr_usepretext=1 ;; (P) _ntr_posttext=$OPTARG _ntr_useposttext=1 ;; (R) _ntr_restore=$OPTARG ;; (S) _ntr_save=$OPTARG ;; (*) [[ $_ntr_opt != '?' ]] && print "$0: unhandled option: $_ntr_opt" >&2 return 1 ;; esac done (( OPTIND > 1 )) && shift $(( OPTIND - 1 )) if [[ $_ntr_restore = _ntr_* || $_ntr_save = _ntr_* ]]; then zle -M "$0: _ntr_ prefix is reserved" >&2 return 1 fi if [[ -n $_ntr_save || -z $_ntr_restore ]]; then if (( $# )); then if (( $# != 2 )); then zle -M "$0: supply zero or two arguments" return 1 fi _ntr_start=$1 _ntr_end=$2 else _ntr_start=$MARK _ntr_end=$CURSOR fi if (( _ntr_start > _ntr_end )); then _ntr_swap=_ntr_start _ntr_start=_ntr_end _ntr_end=_ntr_swap fi (( _ntr_end++, _ntr_cursor -= _ntr_start, _ntr_mark -= _ntr_start )) _ntr_lbuffer=${BUFFER[1,_ntr_start]} if [[ -z $_ntr_usepretext || ( -n $_ntr_nonempty && -z $_ntr_lbuffer ) ]] then _ntr_pretext=$_ntr_lbuffer fi _ntr_rbuffer=${BUFFER[_ntr_end,-1]} if [[ -z $_ntr_useposttext || ( -n $_ntr_nonempty && -z $_ntr_rbuffer ) ]] then _ntr_posttext=$_ntr_rbuffer fi PREDISPLAY="$_ntr_predisplay$_ntr_pretext" POSTDISPLAY="$_ntr_posttext$_ntr_postdisplay" BUFFER=${BUFFER[_ntr_start+1,_ntr_end-1]} CURSOR=$_ntr_cursor MARK=$_ntr_mark if [[ -n $_ntr_save ]]; then eval "$_ntr_save=(${(qq)_ntr_predisplay} ${(qq)_ntr_postdisplay} ${(qq)_ntr_lbuffer} ${(qq)_ntr_rbuffer})" || return 1 fi fi if [[ -z $_ntr_save && -z $_ntr_restore ]]; then zle recursive-edit _ntr_stat=$? fi if [[ -n $_ntr_restore || -z $_ntr_save ]]; then if [[ -n $_ntr_restore ]]; then if ! eval "_ntr_predisplay=\${${_ntr_restore}[1]} _ntr_postdisplay=\${${_ntr_restore}[2]} _ntr_lbuffer=\${${_ntr_restore}[3]} _ntr_rbuffer=\${${_ntr_restore}[4]}"; then zle -M Failed. return 1 fi fi PREDISPLAY=$_ntr_predisplay POSTDISPLAY=$_ntr_postdisplay LBUFFER="$_ntr_lbuffer$LBUFFER" RBUFFER="$RBUFFER$_ntr_rbuffer" fi return $_ntr_stat PK[jS__functions/_firstnuW+A#compdef -first- # This function is called at the very beginning before any other # function for a specific context. # # This just gives some examples of things you might want to do here. # # # Other things you can do here is to complete different things if the # word on the line matches a certain pattern. This example allows # completion of words from the history by adding two commas at the end # and hitting TAB. # # if [[ "$PREFIX" = *,, ]]; then # local max i=1 expl opt # # PREFIX="$PREFIX[1,-2]" # # If a numeric prefix is given, we use it as the number of # # lines (multiplied by ten below) in the history to search. # if [[ ${NUMERIC:-1} -gt 1 ]]; then # max=$NUMERIC # unset NUMERIC # else # # The default is to search the last 100 lines. # max=10 # fi # # We first search in the last ten words, then in the last # # twenty words, and so on... # while [[ i -le max ]]; do # if zstyle -t ":completion:${curcontext}:history-words" sort; then # opt=-J # else # opt=-V # fi # if _wanted "$opt" history-words expl "history ($n)" \ # compadd -Q - \ # "${(@)${(@)historywords:#[\$'\"]*}[1,i*10]}"; then # # We have found at least one matching word, so we switch # # on menu-completion and make sure that no other # # completion function is called by setting _compskip. # compstate[insert]=menu # _compskip=all # return 0 # fi # (( i++ )) # done # fi PK[zW&&functions/_mysql_utilsnuW+A#compdef mysql mysqlshow mysqldump mysqlimport mysqladmin _mysql_get_identity() { local _mysql_pass _mysql_sock _mysql_user=${(v)opt_args[(i)-u|--user]} _mysql_port=${(v)opt_args[(i)-P|--port]} _mysql_host=${(v)opt_args[(i)-h|--host]} _mysql_pass=${(v)opt_args[(i)-p|--password]} _mysql_sock=${(v)opt_args[(i)-S|--socket]} _mysql_params=( ${_mysql_user:+"--user=$_mysql_user"} ${_mysql_host:+"--host=$_mysql_host"} ${_mysql_port:+"--port=$_mysql_port"} ${_mysql_pass:+"--password=$_mysql_pass"} ${_mysql_sock:+"--socket=$_mysql_sock"} ) } _mysql_hosts() { local _mysql_user _mysql_port _mysql_host _mysql_params _mysql_get_identity _wanted hosts expl 'server host' \ _combination -s '[:@]' '' hosts-ports-users \ ${_mysql_user:+users=${_mysql_user:q}} \ ${_mysql_port:+ports=${_mysql_port:q}} \ hosts - } _mysql_ports() { local _mysql_user _mysql_port _mysql_host _mysql_params _mysql_get_identity _wanted ports expl 'server port' \ _combination -s '[:@]' '' hosts-ports-users \ ${_mysql_user:+users=${_mysql_user:q}} \ ${_mysql_host:+hosts=${_mysql_host:q}} \ ports - } _mysql_users() { local _mysql_user _mysql_port _mysql_host _mysql_params _mysql_get_identity _wanted users expl 'server username' \ _combination -s '[:@]' '' hosts-ports-users \ ${_mysql_host:+hosts=${_mysql_host:q}} \ ${_mysql_port:+ports=${_mysql_port:q}} \ users - } _mysql_databases() { local _mysql_user _mysql_port _mysql_host _mysql_params _mysql_get_identity compadd "$@" - ${${(f)~~"$(_call_program databases \ mysql "$_mysql_params[@]" <<<'show databases' 2>/dev/null)"}[2,-1]} } _mysql_tables() { local _mysql_user _mysql_port _mysql_host _mysql_params _mysql_get_identity compadd "$@" - ${${(f)~~"$(_call_program tables \ mysql "$_mysql_params[@]" $1 <<< 'show tables' 2>/dev/null)"}[2,-1]} } _mysql() { _arguments -s \ "$_mysql_common_opts[@]" "$_mysql_variables_opts[@]" \ '(--disable-auto-rehash)--auto-rehash[enable automatic rehashing]' \ '(-t --table)'{-B,--batch}'[batch mode (no pretty ASCII)]' \ '--character-sets-dir=[specify directory containing character sets]:directory:_directories' \ '--default-character-set=[specify character set]:character set' \ {-T,--debug-info}'[print debug info on exit]' \ '(:)'{-D+,--database=}'[specify database to use]' \ {-e+,--exec=}':[execute specified command]:mysql command' \ {-f,--force}'[continue through errors]' \ '(--disable-named-commands)'{-G,--named-commands}'[enable named commands]' \ {-i,--ignore-spaces}'[ignore space after function names]' \ --local-infile \ {-b,--no-beep}'[turn off beep on error]' \ {-H,--html}'[produce HTML output]' \ {-x,--xml}'[produce XML output]' \ '(--skip-line-numbers)--line-numbers[write line numbers for errors]' \ "(--line-numbers)--skip-line-numbers[don't write line numbers for errors]" \ {-n,--unbuffered}'[flush the buffer after each query]' \ '--column-names[write column names in results]' \ "--skip-column-names[don't write column names in results]" \ {-o,--one-database}'[only update the default database]' \ '--pager=[specify pager to use for displaying results]::pager' \ '--prompt=[set the mysql prompt to specified value]:prompt' \ {-q,--quick}'[disable caching of the result]' \ {-r,--raw}'[write fields without conversion]' \ {-s,--silent}'[silent mode]' \ '(-B --batch)'{-t,--table}'[output in table format]' \ '(-B --batch)--tee=[append all output to file]:file:_files' \ {-U,--safe-updates}'[only allow UPDATE and DELETE that uses keys]' \ {-E,--vertical}'[print query output vertically]' \ {-w,--wait}'[wait and retry server connection if necessary]' \ '(--pager)--disable-pager[print directly to stdout]' \ '(--auto-rehash)--disable-auto-rehash[disable automatic hashing]' \ '(-G --named-commands)--disable-named-commands' \ ':MySQL database:_mysql_databases' } _mysqlshow() { _arguments -s \ "$_mysql_common_opts[@]" \ ':MySQL database to show:_mysql_databases' \ ':table to show:{ _mysql_tables "$line[1]" }' \ ':field wildcard' } _mysqldump() { _arguments -s \ "$_mysql_common_opts[@]" "$_mysql_variables_opts[@]" \ {-a,--all}'[include all create options]' \ {-c,--complete-insert}'[use complete insert statements]' \ {-e,--extended-insert}'[allow new INSERT syntax]' \ "--add-drop-table[add a 'drop table' before each create]" \ "--add-locks[add locks around insert statements]" \ "--allow-keywords[allow creation of column names that are keywords]" \ "--delayed[insert rows with INSERT DELAYED]" \ {-F,--flush-logs}'[flush logs file in server before dump]' \ {-l,--lock-tables}'[lock all tables for read]' \ {-t,--no-create-info}"[don't write table creation info]" \ {-d,--no-data}"[don't write row information]" \ '--opt[create fastest possible dump for reading]' \ {-q,--quick}"[don't buffer, dump directly to stdout]" \ {-T,--tab=}"[dump tab-separated text files for each table]:directory to store text files:_files -/" \ {-w+,--where=}'[dump only selected records]:WHERE clause to limit records to dump: ' \ '--fields-terminated-by=:(with --tab) fields in textfile terminated by ...:' \ '--fields-enclosed-by=:(with --tab) fields in import file enclosed by ...:' \ '--fields-optionally-enclosed-by=:(with --tab) fields in import file optionally enclosed by ...:' \ '--fields-escaped-by=:(with --tab) fields in import file escaped by ...:' \ '--lines-terminated-by=:(with --tab) lines in import file terminated by ...:' \ ':MySQL database to dump:_mysql_databases' \ '*:tables to dump:{ _mysql_tables "$line[1]" }' } _mysqlimport() { _arguments -s \ "$_mysql_common_opts[@]" "$_mysql_variables_opts[@]" \ '(-c --columns)'{-c,--columns=}'[use only specified columns to import the data to]:column list' \ '(-d --delete)'{-d,--delete}'[first delete all rows from table]' \ '--fields-terminated-by=:fields in textfile terminated by ...:' \ '--fields-enclosed-by=:fields in import file enclosed by ...:' \ '--fields-optionally-enclosed-by=:fields in import file optionally enclosed by ...:' \ '--fields-escaped-by=:fields in import file escaped by ...:' \ '(-f --force)'{-f,--force}'[continue through errors]' \ '(-r --replace -i --ignore)'{-i,--ignore}'[if duplicate key found, keep old row]' \ '--ignore-lines=[ignore specified number of lines from input file]:number of lines' \ '--lines-terminated-by=[specify line terminator in input file]:terminator' \ '(-L --local)'{-L,--local}'[read all files through the client]' \ '(-l --lock-tables)'{-l,--lock-tables}'[lock all tables for write]' \ '--low-priority[use LOW_PRIORITY when updating the table]' \ '(-i --ignore -r --replace)'{-r,--replace}'[if duplicate key found, replace old row]' \ ':MySQL database:_mysql_databases' } _mysqladmin() { local curcontext="$curcontext" state line expl ret=1 typeset -A opt_args _arguments -C -s \ "$_mysql_common_opts[@]" \ '(-f --force)'{-f,--force}'[continue through errors]' \ '(-i --sleep)'{-i+,--sleep=}'[repeat commands periodically]:number of seconds between executions' \ '(-s --silent)'{-s,--silent}"[silently exit if can't connect to server]" \ '(-t --timeout)'{-t+,--timeout=}'[specify timeout for connection]:time (seconds)' \ '(-w --wait)'{-w+,--wait=}'[wait and retry server connection if necessary]:number of retries' \ '*::mysqladmin command:->mysqladmin-commands' && ret=0 if [[ -n "$state" ]]; then if (( CURRENT == 1 )); then _wanted commands expl 'mysqladmin command' compadd - \ create drop extended-status \ flush-{hosts,logs,status,tables,threads,privileges} \ kill password ping processlist \ reload refresh shutdown \ status start-slave stop-slave variables version && ret=0 else case "${words[1]:t}" in create|drop) _wanted databases expl "MySQL database" _mysql_databases && ret=0 ;; kill) _message -e ids 'thread ids' ;; password) _message -e passwords 'new password' ;; esac fi fi return ret } _mysql_utils() { local _mysql_common_opts _mysql_variables_opts _mysql_common_opts=( '(- *)'{-\?,--help}'[display help]' '(- *)'{-V,--version}'[display version information]' \ {-\#+,--debug=}'[specify debug log file]:log file:_files' '--print-defaults[print the program argument list and exit]' "--no-defaults[don't read default options from any options file]" '--defaults-file=[read defaults from the given file]:file:_files' '--defaults-extra-file=[read specified file after the global files]:defaults file:_files' '(-S --socket)'{-S+,--socket=}'[specify socket file to use for connection]:server socket file:_files' '(-h --host)'{-h+,--host=}'[specify server hostname]:hostname:_mysql_hosts' '(-P,--port)'{-P+,--port=}'[specify port number for connection]:server port:_mysql_ports' '(-u --user)'{-u+,--user=}'[specify username for login]:server username:_mysql_users' '(-p --password)'{-p-,--password=}'[specify password to use for connection]:server password' '(-C --compress)'{-C,--compress}'[use compression in server/client protocol]' \*{-v,--verbose}'[more verbose output]' ) _mysql_variables_opts=( '--max_allowed_packet[maximum allowed packet size]:packet size in bytes' '--net_buffer_length[network buffer length]:buffer length in bytes' '--connect_timeout:timeout' '--select_limit:limit' '--max_join_size:size' ) case "$service" in mysql) _mysql "$@" ;; mysqlshow) _mysqlshow "$@" ;; mysqldump) _mysqldump "$@" ;; mysqlimport) _mysqlimport "$@" ;; mysqladmin) _mysqladmin "$@" ;; esac } _mysql_utils "$@" PK[*dfunctions/_chmodnuW+A#compdef chmod local curcontext="$curcontext" state line expl ret=1 local -a args privs args=( '*:file:->files' ) (( $+words[(r)--reference*] )) || args+=( '1:mode:->mode' ) if _pick_variant gnu=Free\ Soft unix --version; then args+=( '(-v --verbose -c --changes)'{-c,--changes}'[report changes made]' '(-v --verbose -c --changes)'{-v,--verbose}'[output a diagnostic for every file processed]' '(-f --silent --quiet)'{-f,--silent,--quiet}'[suppress most error messages]' '--reference=[copy permissions of specified file]:file:_files' '(-R --recursive)'{-R,--recursive}'[change files and directories recursively]' '(- : *)--help[display help information]' '(- : *)--version[display version information]' ) privs=( 'X[execute only if executable to another]' "u[owner's current permissions]" "g[group's current permissions]" "o[other's current permissions]" ) else # based on $OSTYPE = solaris2.8 args+=( '-f[suppress most error messages]' '-R[change files and directories recursively]' ) privs=( 'l[mandatory locking]' ) fi _arguments -C -s "$args[@]" && ret=0 case "$state" in mode) compset -P \*, compset -S ,\* if [[ -prefix [0-7] ]]; then _message -e number 'numeric mode' elif compset -P '[a-z]#[+-=]'; then _values -S '' privilege \ 'r[read]' 'w[write]' 'x[execute]' \ 's[set uid/gid]' 't[sticky]' \ "$privs[@]" && ret=0 else suf=( -S '' ) compset -P '*' _alternative -O suf \ 'who:who:((u\:user g\:group a\:all o\:others))' \ 'operators:operator:(+ - =)' fi ;; files) if [[ -n $opt_args[--reference] ]]; then zmodload -F zsh/stat b:zstat 2>/dev/null typeset -i8 ref=$(zstat +mode $opt_args[--reference]) _wanted files expl file _files -g "*(-.^f${ref#??})" && ret=0 elif [[ $words[2] = [0-7]## ]]; then _wanted files expl file _files -g "*(-.^f$words[2])" && ret=0 else local spec who op priv local -a specs for spec in ${(s:,:)words[2]}; do if [[ ${spec#*[+-=]} != [rwxst]## ]]; then _files && ret=0 return ret fi specs+=( ${${(M)spec##[+-=]*}:+a}$spec ) done _wanted files expl file _files -g "*(-.^f:${(j.,.)specs}:)" && ret=0 fi ;; esac return ret PK[<eefunctions/_functionsnuW+A#compdef unfunction local expl _wanted functions expl 'shell function' compadd -k "$@" - functions PK[q functions/_xvnuW+A#compdef xv _x_arguments \ -{help,quick24,slow24,best24,noqcheck,pkludge,RM} \ -+{fixed,rw,perfect,owncmap,stdcmap,cecmap,ninstall,8,24,root,noresetroot,max,maxpect,quit,clear,cmap,imap,cemap,cmtmap,vsmap,nopos,dither,smooth,raw,acrop,4x3,hflip,vflip,norm,hist,mono,rv,wloop,random,loadclear,nofreecols,rgb,hsv,lbrowse,nostat,2xlimit,nolimits,close,iconic,viewonly,poll,vsperfect,vsdisable,nodecor} \ '-fg:foreground color:_x_color' \ '-bg:background color:_x_color' \ '-hi:top left shadow color:_x_color' \ '-lo:bottom right shadow color:_x_color' \ '-bw:border width' \ '-geometry:geometry:_x_geometry' \ '-expand:expansion factor' \ '-aspect:aspect ratio (e.g. 4:3)' \ '-ncols:maximum number of colors used' \ '-rmode:root display mode:((0\:tiling 1\:integer\ tiling 2\:mirrored\ tiling 3\:integer\ mirrored\ tiling 4\:centered\ tiling 5\:centered\ tiling\ on\ solid\ background 6\:centered\ tiling\ on\ '\\\''warp'\\\''\ background 7\:centered\ tiling\ on\ '\\\''brick'\\\''\ background 8\:symmetrical\ tiling 9\:symmetrical\ mirrored\ tiling))' \ '-rfg:root foreground color:_x_color' \ '-rbg:root background color:_x_color' \ '-cgeom:control window geometry:_x_geometry' \ '-igeom:info window geometry:_x_geometry' \ '-cegeom:color editor window geometry:_x_geometry' \ '-cmtgeometry:comments window geometry:_x_geometry' \ '-tgeometry:text view window geometry:_x_geometry' \ '-vsgeometry:visual schauzer geometry:_x_geometry' \ '-crop:left border: :top border: :width: :height' \ '-rotate:rotation angle:(0 90 -90 +90 180 -180 +180 270 -270 +270)' \ '-gamma:gamma value' \ '-cgamma:red gamma value: :green gamma value: :blue gamma value' \ '-preset:default preset (1-4):(1 2 3 4)' \ '-white:'"'"'white'"'"' color:_x_color' \ '-black:'"'"'black'"'"' color:_x_color' \ '-wait:seconds to wait' \ '-visual:visual:_x_visual' \ '-cursor:cursor character number' \ '-icgeometry:icon geometry:_x_geometry' \ '-dir:directory:_files -/' \ '-flist:file list file:_files' \ '-drift:x movement correction: :y movement correction' \ '-mfn:mono spaced font:_x_font' \ '-name:window name:_x_name' \ '-+grabdelay:grab delay (seconds)' \ '-gsdev:ghostscript device' \ '-gsres:ghostscript resolution' \ '-gsgeom:ghostscript page size' \ '-DEBUG:debug level' \ '*:picture file:_files -g \*.\(\#i\)\(png\|gif\|jpeg\|jpg\|tiff\|tif\|pbm\|pgm\|ppm\|xbm\|xpm\|ras\(\|t\)\|tga\|rle\|rgb\|bmp\|pcx\|fits\|pm\)\(-.\)' PK[7_functions/_renicenuW+A#compdef renice if [[ $CURRENT = 2 ]]; then _message -e priority else local opts ret=1 opts=( '-g:interpret args as process group IDs' '-u:interpret args as user names' '-p:interpret args as process IDs' ) _describe -o option opts && ret=0 case ${(v)words[(I)-?]} in -g) _message -e pgids 'process group ID' && ret=0 ;; -u) _users && ret=0 ;; *) _pids && ret=0;; esac fi return ret PK[M""functions/_dchrootnuW+A#compdef dchroot local expl context state line typeset -A opt_args _arguments -S \ '(-h --help)'{-h,--help}'[help]' \ '(-a --all)'{-a,--all}'[select all chroots]' \ '*'{-c,--chroot=}'[use specified chroot]:chroot:->chroot' \ '(-d --directory)'{-d,--directory=}'[directory to use]:dir:_files -W / -P /' \ '(-l --list)'{-l,--list}'[list available chroots]' \ '(-i --info)'{-i,--info}'[show information about selected chroots]' \ '(-p --path)'{-p,--path}'[print path to selected chroot]' \ '--config[dump configuration of selected chroots]' \ '(-d --preserve-environment)'{-d,--preserve-environment}'[preserve user environment]' \ '(-q --quiet)'{-q,--quiet}'[quiet]' \ '(-v --verbose)'{-v,--verbose}'[verbose]' \ '(-V --version)'{-V,--version}'[version]' \ '(-):command name: _command_names -e' \ '*::arguments: _normal' && return 0 case "$state" in (chroot) _wanted tag expl 'chroot' \ compadd ${(os:,:)${${${"$(dchroot -l )"#*: }// /}//[[\]]/,}} ;; esac PK[h@@functions/_assignnuW+A#compdef -assign-parameter- _parameters -g "^*readonly*" -S '' PK[qhfunctions/_ranlibnuW+A#compdef ranlib _arguments \ "(-a)-s[preferred type ToC (default)]" \ "(-s)-a[original type ToC]" \ "-c[include common symbols]" \ "(-T)-L[4.4bsd archive extended format #1 (default)]" \ "(-L)-T[truncate names to 16 chars, per pre-4.4.bsd format]" \ "-f[warn about fat archives]" \ "-t[do not rebuild ToC (ignored)]" \ "(-)-[no more options]" \ "1:archive: _files" PK[tNy))functions/_lessnuW+A#compdef less -value-,LESS,-default- -value-,LESSCHARSET,-default- local curcontext="$curcontext" state line expl ret=1 local -a files case $service in *LESSCHARSET*) _wanted charsets expl 'character set' compadd ascii iso8859 latin1 latin9 \ dos ebcdic IBM-1047 koi8-r next utf-8 return ;; *LESS*) compset -q words=( fake "$words[@]" ) (( CURRENT++ )) ;; *) files=( '*:file:_files' ) ;; esac if compset -P '+[-0-9]#'; then _describe 'less command' '( g:goto\ line F:scroll\ to\ end\ and\ keep\ reading\ file G:go\ to\ end\ of\ file %:go\ to\ position\ in\ file p:go\ to\ position\ in\ file )' return fi _arguments -S -s -A "[-+]*" \ '(-? --help)'{-\?,--help}'[display summary of less commands]' \ '(-a --search-skip-screen)'{-a,--search-skip-screen}'[begin forward searches after last displayed line]' \ '(-b --buffers)'{-b+,--buffers=}'[specify amount of buffer space used for each file]:buffer space (kilobytes)' \ '(-B --auto-buffers)'{-B,--auto-buffers}"[don't automatically allocate buffers for pipes]" \ '(-C --CLEAR-SCREEN -c --clear-screen)'{-c,--clear-screen}'[repaint screen instead of scrolling]' \ '(-c --clear-screen -C --CLEAR-SCREEN)'{-C,--CLEAR-SCREEN}'[clear screen before repaints]' \ '(-d --dumb)'{-d,--dumb}'[suppress error message if terminal is dumb]' \ '(-e -E --quit-at-eof --QUIT-AT-EOF)'{-e,--quit-at-eof}'[exit the second time end-of-file is reached]' \ '(-e -E --quit-at-eof --QUIT-AT-EOF)'{-E,--QUIT-AT-EOF}'[exit when end-of-file is reached]' \ '(-f --force)'{-f,--force}'[force opening of non-reqular files]' \ '(-F --quit-if-one-screen)'{-F,--quit-if-one-screen}'[exit if entire file fits on first screen]' \ '(-G --HILITE-SEARCH -g --hilite-search)'{-g,--hilite-search}'[highlight only one match for searches]' \ '(-g --hilite-search -G --HILITE-SEARCH)'{-G,--HILITE-SEARCH}'[disable highlighting of search matches]' \ '(-h --max-back-scroll)'{-h+,--max-back-scroll=}'[specify backward scroll limit]:backward scroll limit (lines)' \ '(-I --IGNORE-CASE -i --ignore-case)'{-i,--ignore-case}'[ignore case in searches that lack uppercase]' \ '(-i --ignore-case -I --IGNORE-CASE)'{-I,--IGNORE-CASE}'[ignore case in all searches]' \ '(-j --jump-target)'{-j+,--jump-target}'[specify screen position of target lines]:position (line)' \ '(-J --status-column)'{-J,--status-column}'[display status column on the left]' \ \*{-k+,--lesskey-file=}'[use specified lesskey file]:lesskey file:_files' \ '(-L --no-lessopen)'{-L,--no-lessopen}'[ignore the LESSOPEN environment variable]' \ '(-M --LONG-PROMPT -m --long-prompt)'{-m,--long-prompt}'[prompt verbosely]' \ '(-m --long-prompt -M --LONG-PROMPT)'{-M,--LONG-PROMPT}'[prompt very verbosely]' \ '(-N --LINE-NUMBERS -n --line-numbers)'{-n,--line-numbers}"[don't keep track of line numbers]" \ '(-n --line-numbers -N --LINE-NUMBERS)'{-N,--LINE-NUMBERS}'[show line numbers]' \ '(* -O --LOG-FILE -o --log-file)'{-o+,--log-file=}'[copy input to file]:file:_files' \ '(* -o --log-file -O --LOG-FILE)'{-O+,--LOG-FILE=}'[copy input to file, overwriting if necessary]:file:_files' \ '(-p --pattern)'{-p+,--pattern=}'[start at specified pattern]:pattern' \ \*{-P+,--prompt=}'[specify prompt format]:prompt:->prompts' \ '(-Q --QUIET --SILENT -q --quiet --silent)'{-q,--quiet,--silent}'[never use bell]' \ '(-q --quiet --silent -Q --QUIET --SILENT)'{-Q,--QUIET,--SILENT}'[limit use of bell]' \ '(-r -R --raw-control-chars --RAW-CONTROL-CHARS)'{-r,--raw-control-chars}'[display raw control characters]' \ '(-r -R --raw-control-chars --RAW-CONTROL-CHARS)'{-R,--RAW-CONTROL-CHARS}'[display control chars; keep track of screen effects]' \ '(-s --squeeze-blank-lines)'{-s,--squeeze-blank-lines}'[squeeze consecutive blank lines down to one]' \ '(-S --chop-long-lines)'{-S,--chop-long-lines}'[truncate long lines instead of folding]' \ '(-t --tag)'{-t+,--tag=}'[edit file containing tag]:tag:->tags' \ '(-T --tag-file)'{-T+,--tag-file=}'[specify tags file]:tags file:_files' \ '(-u --underline-special)'{-u,--underline-special}'[send backspaces and carriage returns to the terminal]' \ '(-U --UNDERLINE-SPECIAL)'{-U,--UNDERLINE-SPECIAL}'[treat backspaces, tabs and carriage returns as control characters]' \ '(* -)'{-V,--version}'[display version information]' \ '(-W --HILITE-UNREAD -w --hilite-unread)'{-w,--hilite-unread}'[highlight first unread line after forward page]' \ '(-w --hilite-unread -W --HILITE-UNREAD)'{-W,--HILITE-UNREAD}'[highlight first unread line after forward movement]' \ '(-x --tabs)'{-x+,--tabs=}'[set tab stops]:tab stops' \ '(-X --no-init)'{-X,--no-init}'[disable use of terminal init string]' \ '--no-keypad[disable use of keypad terminal init string]' \ '(-y --max-forw-scroll)'{-y,--max-forw-scroll}'[specify forward scroll limit]' \ '(-z --window)'{-z+,--window=}'[specify scrolling window size]:lines' \ '(-\" --quotes)'{-\"+,--quotes=}'[change quoting character]:quoting characters' \ '(-~ --tilde)'{-~,--tilde}"[don't display tildes after end of file]" \ '(-\# --shift)'{-\#+,--shift=}"[specify amount to move when scrolling horizontally]:number" \ "$files[@]" && ret=0 if [[ -n "$state" ]]; then case $state in prompts) if compset -P \?; then _message -e prompt else _describe 'prompt' '( s:short\ prompt m:medium\ prompt M:long\ prompt h:help\ screen\ prompt \=:\=\ command\ prompt w:waiting\ prompt )' && ret=0 fi ;; tags) if (( $+LESSGLOBALTAGS )); then _global_tags else _ctags_tags fi ;; esac fi return ret PK[o5J$functions/_lindanuW+A#compdef linda _arguments \ '(-c --config)'{-c,--config=}':config file:_files' \ '(-C --checks)'{-C,--checks=}':check regexes:' \ '(-d --debug)*'{-d,--debug}'[debug]' \ '(-D --disable-local)*'{-D,--disable-local}'[disable registration of local checks]' \ '(-f --format)'{-f,--format=}':output format:(branden long lintian figlet)' \ '(-h --help)'{-h,--help}'[help]' \ '(-i --info)'{-i,--info}'[info]' \ '(-l --lab)'{-l,--lab=}':lab root:_files -/' \ '(-L --list-checks)'{-L,--list-checks=}':list checks:' \ '(-m --more-overrides)'{-m,--more-overrides=}':more overrides:' \ '(-n --no-cull)'{-n,--no-cull}'[do not delete lab after completion]' \ '(-o --show-overridden)'{-o,--show-overridden}'[display errors that are overridden]' \ '(-p --print-overrides)'{-p,--print-overrides}'[print parsed overrides]' \ '(-P --profiling)'{-P,--profiling}'[print profiling stats]' \ '(-q --quiet)'{-q,--quiet}'[quiet]' \ '(-s --show-tag)'{-s,--show-tag}'[print tag along with errors]' \ '(-S --seteuid)'{-S,--seteuid}'[do not seteuid to nobody]' \ '(-t --types)'{-t,--types=}':types string:_values -s , "types" Error Warning eXperimental Informational' \ '(-T --traceback)'{-T,--traceback}'[show a traceback from any exception]' \ '(-U --unpack)'{-U,--unpack}':unpack level:' \ '(-v --verbose)'{-v,--verbose}'[verbose]' \ '(-V --version)'{-V,--version}'[version]' \ ':package:_files -g "*.(changes|u#deb|dsc)"' PK[&#functions/zfopennuW+A# function zfopen { # Use zftp params to set parameters for open, rather than sending # them straight to open. That way they are stored for a future open # command. # # With option -1 (just this 1ce), don't do that. emulate -L zsh [[ $curcontext = :zf* ]] || local curcontext=:zfopen local opt dir opt_1 setparams while getopts :1 opt; do [[ $opt = "?" ]] && print "zfopen: bad option: -$OPTARG" >&2 && return 1 eval "opt_$opt=1" done (( OPTIND > 1 )) && shift $(( OPTIND - 1 )) # This is where we should try and do same name-lookupage in # both .netrc and .ncftp/bookmarks . We could even try saving # the info in their for new hosts, like ncftp does. if [[ $1 = */* ]]; then 1=${1##ftp://} dir=${1#*/} 1=${1%%/*} fi if [[ $opt_1 = 1 ]]; then zftp open $* || return 1 if [[ $# = 1 ]]; then if ! zftp login; then zftp close return 1 fi fi else # set parameters, but only if there was at least a host (( $# > 0 )) && zfparams $* && setparams=1 # now call with no parameters if ! zftp open; then [[ -n $ZFTP_HOST ]] && zftp close [[ -n $setparams ]] && zfparams - return 1 fi fi if [[ -n $dir ]]; then zfcd $dir fi # } PK[L33functions/_portauditnuW+A#compdef portaudit _arguments -s \ '-a[vulnerability report for all installed packages]' \ '-C[vulnerability report for the port in the current working directory]' \ '-d[print creation date of the database]' \ '-F[fetch the current database]' \ '-q[quiet mode]' \ '-V[show portaudit version number]'\ '-v[verbose mode]' \ '-X[download a fresh database from least days old]:days:' \ '-f[check the packages listed in file]:file:_files' \ '-r[restrict listed vulnerabilities with eregex pattern]:eregex:' \ ':pkg-name:' PK[\Dfunctions/_pumpnuW+A#compdef pump _arguments \ '(-c --config-file=)'{-c,--config-file=}'[specify configuration file to use]:configuration file:_files' \ '(-h --hostname=)'{-h,--hostname=}'[specify hostname to request]:hostname:_hosts' \ '(-i --interface=)'{-i,--interface=}'[specify interface to configure]:interface:_net_interfaces' \ '(-k --kill)'{-k,--kill}'[kill daemon (and disable all interfaces)]' \ '(-l --lease=)'{-l,--lease=}'[specify lease time to request]:time (hours)' \ '(-L --leasesecs=)'{-L,--leasesecs=}'[specify seconds to request for]:time (seconds)]' \ '(-r --release)'{-r,--release}'[release interface]:interface:_net_interfaces' \ '(-R --renew)'{-R,--renew}'[force immediate lease renewal]:interface:_net_interfaces' \ '(-v --verbose)'{-v,--verbose}'[log verbose debug info]' \ '(-s --status)'{-s,--status}'[display interface status]:interface:_net_interfaces' \ '(-d --no-dns)'{-d,--no-dns}"[don't update resolv.conf]" \ '(- *)'{-?,--help}'[display help information]' \ "--no-gateway[don't set a gateway for this interface]" \ "--no-setup[don't set up anything]" \ "--no-resolvconf[don't set up resolvconf]" \ '--no-bootp[ignore non-DHCP BOOTP responses]' \ '--lookup-hostname[force lookup of hostname]' \ '--script=[specify script to use]:script:_files' \ "--win-client-ident[set the client identifier to match window's]" \ '--usage[display brief usage message]' \ ':interface:_net_interfaces' PK[¾oWWfunctions/_tracepathnuW+A#compdef tracepath tracepath6 _arguments \ ':destination:_hosts' \ ':port:_ports' PK[Rfunctions/_zednuW+A#compdef zed fned case $service in (fned) _arguments ':shell function:_functions';; (zed) _arguments '(-):file:_files' \ '(:)-f[edit function]:shell function:_functions';; esac PK[GBFFfunctions/_pspdfnuW+A#compdef gsbj gsdj gsdj500 gslj gslp gsnd ps2ascii ghostview mgv pstoedit pstotgif local expl ext # ghostscript: # gs gsbj gsdj gsdj500 gslj gslp gsnd ps2ascii if [[ "$1" == '-z' ]]; then ext='(|.gz|.Z)' shift fi _description files expl 'PostScript or PDF file' _files "$@" "$expl[@]" -g "*.(#i)(pdf|ps|eps)$ext(-.)" PK[TE^functions/_showmountnuW+A#compdef showmount _arguments \ '(-a --all)'{-a,--all}'[list both hostname and mounted dir in host:dir format]' \ '(-d --directories)'{-d,--directories}'[list only the directories mounted by some client]' \ '(-e --exports)'{-e,--exports}'[show server export list]' \ '(-h --help)'{-h,--help}'[help]' \ '(-v --version)'{-v,--version}'[version]' \ '--no-headers[suppress descriptive headers from output]' \ ':host:_hosts' PK[F& functions/keepernuW+A## # The "keeper" function suite originally appeared in several zsh-users # posts in the fall of 2004. It was published in summary form in the # Shell Corner column on UnixReview.com in January 2005 at the URL # # # A few minor edits have been made to those functions for this file. Key # bindings are commented out to avoid clashes with any existing bindings. ## declare -a kept # The "keep" function accepts a set of file patterns as the positional # parameters or a series of lines (expected to represent file names) on # standard input. It stores the expansion of those patterns, or the input # lines, in the global variable $kept, and then displays the result # formatted in columns, similar to an "ls" listing. Its alias, also named # "keep", prevents the file patterns from being expanded when the command # line is executed; they're expanded in the assignment to $kept instead, # so that the local settings of nonomatch etc. are applied. function keep { setopt localoptions nomarkdirs nonomatch nocshnullglob nullglob setopt noksharrays noshwordsplit kept=($~*) if [[ ! -t 0 ]]; then local line while read -r line; do kept+=( $line ) done fi print -Rc - ${^kept%/}(T) } alias keep='noglob keep' # The function "_insert_kept" copies the value of $kept to the cursor # position. If a prefix of a name is immediately to the left of the # cursor, then only the subset of $kept that matches that prefix is # copied, as is usual for completion. The examples bind it to two # different widgets, "insert-kept-result" and "expand-kept-result". If # invoked via the "expand-kept-result" widget, it replaces a pattern on # the command line with the matching words from the $kept array. _insert_kept() { (( $#kept )) || return 1 local action zstyle -s :completion:$curcontext insert-kept action if [[ -n $action ]] then compstate[insert]=$action elif [[ $WIDGET = *expand* ]] then compstate[insert]=all fi if [[ $WIDGET = *expand* ]] then compadd -U ${(M)kept:#${~words[CURRENT]}} else compadd -a kept fi } zle -C insert-kept-result complete-word _generic zstyle ':completion:insert-kept-result:*' completer _insert_kept # bindkey '^Xk' insert-kept-result zle -C expand-kept-result complete-word _generic zstyle ':completion:expand-kept-result:*' completer _insert_kept # bindkey '^XK' expand-kept-result # The "_expand_word_and_keep" function stores the expansions computed by # the "_expand" completer in the global $kept for later retrieval by # "_insert_kept". _expand_word_and_keep() { function compadd() { local -A args zparseopts -E -A args J: if [[ $args[-J] == all-expansions ]] then builtin compadd -A kept "$@" kept=( ${(Q)${(z)kept}} ) fi builtin compadd "$@" } { _expand_word } always { unfunction compadd } } zle -C _expand_word complete-word _expand_word_and_keep # This style is required to segregate the all-expansions group for # purposes of _expand_word_and_keep. zstyle ':completion:expand-word:expand:::all-expansions' group-name '' PK[Zfunctions/_inetadmnuW+A#compdef inetadm _inetadm() { _arguments -s \ '-?[help]' \ '-l[list service instance properties]:FMRI:_svcs_fmri -i' \ '-e[enable specified instance]:FMRI:_svcs_fmri -i' \ '-d[disable specified instance]:FMRI:_svcs_fmri -i' \ '-p[list inet service properties]' \ '-m[modify service instance properties]:FMRI:_svcs_fmri -i' \ '-M[modify inet service properties]' } _inetadm "$@" # vi:tw=0 PK[Iw99functions/_merenuW+A#compdef mere _files -g '*.[1-9]([a-z]|)(-.) *.man(-.)' PK[?u7 functions/_rubbernuW+A#compdef rubber rubber-pipe rubber-info local _rubber_version _rubber_path _rubber_modules _rubber_args eval $(rubber --version 2>/dev/null | sed 's/^.* \([^ ]*\): */_rubber_\1=/') if [[ ${_rubber_version#0} != $_rubber_version ]]; then _rubber_modules=( $_rubber_path/rubber/modules/[^_]*.py(N:r:t) ) else _rubber_modules=( $_rubber_path/modules/*.rub(N:r:t) $_rubber_path/rubber/rules/latex/[^_]*.py(N:r:t) ) fi _rubber_args=( \*{-c,--command}'=[run the directive CMD before parsing]:command' \*{-e,--epilogue}'=[run the directive CMD after parsing]:command' {-z,--gzip}'[compress the final document]' '(- *)'{-h,--help}'[show help]' '--into=[go to directory DIR before compiling]:directory:_files -/' {-l,--landscape}'[change paper orientation (if relevant)]' {-n,--maxerr}'=[display at most NUM errors]:num' \*{-m,--module}'=[use module]:module:($_rubber_modules)' '--only=[only include the specified SOURCES]:sources' \*{-o,--post}'=[postprocess with module]:postprocessor:($_rubber_modules)' {-d,--pdf}'[produce PDF output instead of DVI]' {-p,--ps}'[produce a PostScript document]' {-q,--quiet}'[suppress messages]' \*{-r,--read}'[read additional directives from a file]:directives files:_files' {-s,--short}'[display errors in a compact form]' \*{-I,--texpath}'=[add DIR to the search path for LaTeX]:tex path:_files -/' \*{-v,--verbose}'[increase verbosity]' '--version[print version information and exit]' ) case "$service" in rubber) _arguments -s \ "$_rubber_args[@]" \ '--clean[remove produced files instead of compiling]' \ {-f,--force}'[force at least one compilation]' \ '--inplace[compile the documents from their source directory]' \ \*{-W,--warn}'=[report warnings of the given TYPE]:warnings:(all boxes misc refs)' \ '*:LaTeX files:_files -g \*.\(tex\|dtx\|lhs\|w\)' return 0 ;; rubber-pipe) _arguments -s \ "$_rubber_args[@]" \ {-k,--keep}'[keep the temporary files after compiling]' \ \*{-W,--warn}'=[report warnings of the given TYPE]:warnings:(all boxes misc refs)' return 0 ;; rubber-info) _arguments -s \ "$_rubber_args[@]" \ '--boxes[report overfull and underfull boxes]' \ '--check[report errors or warnings default action]' \ '--deps[show the target file s dependencies]' \ '--errors[show all errors that occured during compilation]' \ '--refs[show the list of undefined references]' \ '--warnings[show all LaTeX warnings]' \ ':LaTeX file:_files -g \*.\(tex\|dtx\|lhs\|w\)' return 0 ;; esac return 1 PK[qfunctions/_vuxnuW+A#compdef vux vuxctl local expl case "$service" in (vux) _arguments -s -C \ '-x:action:((play\:play\ music generate\:generate\ new\ scorelist merge\:merge\ new\ songs weed\:prune\ songs\ from\ scorelist ratings\:show\ statistics force\:force-rate))' \ '-s:file:_files' \ '-a:file:_files' \ '-z:file:_files' \ '-y:file:_files' \ '-p:file:_files' \ '-w:ratings:(b t)' \ '-W:repeats:(a c)' \ '-G:age bypass method:(t s n)' \ '-e:pattern' \ '-O:device:_files' \ '-M:minimum age val' \ '-S[disable saving scorelist]' \ '-A[disable saving agelist]' \ '-Z[disable saving countlist]' \ '-Y[disable missing log]' \ '-c[disable rating check]' \ '-d[disable rating updates on play]' \ '-l[disable rating updates on skip]' \ '-j[disable repeat check]' \ '-b[disable repeat updates on play]' \ '-k[disable repeat updates on skip]' \ '-n[disable player]' \ '-t:percent' \ '-T:percent' \ '-C:factor' \ '-D:factor' \ '-I:factor' \ '-U:rating' \ '-X:score' \ '-N:count' \ '-f:rating' \ '-J[accelerate decreases]' \ '-K[accelerate increases]' \ '-u[check age before rating]' \ '-R[show ratings after processing]' \ '-V[verbose file manipulation]' \ '-v[show version and exit]' \ '-F[skip songs with -n and -xf]' \ '-q[minimize vux output]' \ '-P[always play new songs]' \ '-g[print stats in xgraph format]' \ '-h[show summary of options]' ;; (vuxctl) _wanted vuxcmd expl 'vux control command' \ compadd start clean double half up down next previous forward \ replay pause resume stop reload save history help ;; esac PK[ %鬧functions/_dmidecodenuW+A#compdef dmidecode _arguments \ '(-d --dev-mem)'{-d,--dev-mem}':memory device:_files' \ '(-q --quiet -u --dump)'{-q,--quiet}'[be less verbose]' \ '(-t --type -u --dump -s --string)'{-s,--string}':DMI string:(bios-vendor bios-version bios-release-date system-manufacturer system-product-name system-version system-serial-number system-uuid baseboard-manufacturer baseboard-product-name baseboard-version baseboard-serial-number baseboard-asset-tag chassis-manufacturer chassis-type chassis-version chassis-serial-number chassis-asset-tag processor-family processor-manufacturer processor-version processor-frequency)' \ '(-t --type)'{-t,--type}':types to display:(bios system baseboard chassis processor memory cache connector slot)' \ '(-q --quiet -u --dump -s --string)'{-u,--dump}'[do not decode]' \ '(-h --help)'{-h,--help}'[display usage information]' \ '(-V --version)'{-V,--version}'[display version information]' PK[3Zz~~functions/_debdiffnuW+A#compdef debdiff _arguments \ '(-d --dirs)'{-d,--dirs}'[do not ignore directories]' \ '--nodirs[ignore directories]' \ '(-m --move)'{-m,--move}':movement:_files' \ '--move-regex:movement:_files' \ '--nocontrol[do not compare control files]' \ '--control[compare control files]' \ '--wp[pass -p to wdiff]' \ '--wl[pass -l to wdiff]' \ '--wt[pass -t to wdiff]' \ '--show-moved[show movements between packages]' \ '--noshow-moved[do not show movements between packages]' \ '--renamed:package:_deb_packages avail' \ '(--no-conf --noconf)'{--no-conf,--noconf}'[do not read any config files]' \ '(-h --help)'{-h,--help}'[show help]' \ '(-v --version)'{-v,--version}'[show version]' \ '(-q --quiet)'{-q,--quiet}'[be quiet if no differences]' \ '--from:debs:_files -g "*.deb"' \ '--to:debs:_files -g "*.deb"' \ '*:file to compare:_files -g "*.(deb|changes|dsc)"' PK[pfunctions/_devtodonuW+A#compdef devtodo todo tda tde tdd tdr ## completion for devtodo 0.1.20 typeset -a arg_generic arg_add todo_opts \ priorities typeset -A arg_pair arg_desc typeset -i i typeset expl for ((i=2; i <= $#words; i++)) { if [[ $words[$i] == '--database' ]] { todo_opts+=(--database ${~words[$((++i))]}) } } priorities=(verylow low medium high veryhigh) arg_add=( '-p[priority]:priority:_todo_priority' '-g[parent item]:parent:_todo_index' ) arg_generic=( '--remove[remove items]:index:_todo_index' '--database[database file]:file:_files' '--global-database[global database file]:file:_files' '*--colour[item color]:color:_todo_color' '--force-colour[force use of colors]' '--mono[no colors]' '--help[display help]' '--version[display version]' '--title[todo title]:string: ' '--date-format[strftime time formet]:time string: ' '*--format[define format]:format:_todo_format' '*--use-format[output format]:format:_todo_format' '--sort[sort database]:sort expression:_todo_sort' '--paranoid[paranoid parmissions etc]' '--database-loaders[loader order]:database loader: ' '--backup[backup database]:count: ' '--timeout[display timeout]:seconds: ' '--purge[purge completed items]:days: ' '*'{'--filter','-f'}'[show items matching filter]:filter:_todo_filter' '*::item:_todo_index' ) arg_pair=( 'verbose' 'v' 'add' 'a' 'graft' 'g' 'link' 'l' 'reparent' 'R' 'priority' 'p' 'edit' 'e' 'done' 'd' 'not-done' 'D' 'global' 'G' 'TODO' 'T' 'all' 'A' ) arg_desc=( 'verbose' '[be verbose]' 'add' '[add item]:item' 'graft' '[parent item]:parent:_todo_index' 'link' '[link file into database]:database:_files' 'reparent' '[change item parent]:index:_todo_index' 'priority' '[item priority]:priority:_todo_priority' 'edit' '[edit item]:index:_todo_index' 'done' '[mark as done]:index:_todo_index' 'not-done' '[mark as undone]:index:_todo_index -u' 'global' '[use global database]' 'TODO' '[generate TODO file]' 'all' '[show all items]' ) for arg in ${(k)arg_pair}; { arg_generic+='(--'$arg')-'${arg_pair[$arg]}${arg_desc[$arg]} arg_generic+='(-'${arg_pair[$arg]}')--'${arg}${arg_desc[$arg]} } function _todo_index () { typeset number text i entry last_entry depth last_depth=0 IFS=$'\n' typeset -a index desc for i in $*; do case $i in -u) todo_opts+=(--filter done) esac done for entry in $(todo $todo_opts -f +children --format display='%1>%i%n:%t\n'); do number=${entry%%:*} depth=$(( ${#number} - ${#${number// }} )) ((depth)) && entry=${(j:.:)${${(s:.:):-a.${last_entry%%:*}}[2,depth+1]}}.$entry text=${entry#*:} number=${${entry%%:*}// } entry=$number:$text index+=$entry last_depth=$depth last_entry=$entry done _describe -t items index index } function _todo_color () { if compset -P '*='; then _wanted color expl 'color' \ compadd black red green yellow blue magenta cyan white default else _wanted item expl 'item' \ compadd -S '=' $priorities title info fi } function _todo_filter { typeset prefix if [[ ${#${words[$CURRENT]}} -gt 0 ]] { prefix=${${words[$CURRENT]}[1]} _wanted expression expl 'filter expression' \ compadd -p $prefix -- all children done $priorities } else { # XXX the '-' makes problems _wanted expression expl 'filter expression' \ compadd -S '' -- - + = all children done $priorities } } function _todo_format () { typeset prefix if [[ -prefix *= ]] { _message 'format string' } else { _wanted expression expl 'format name' \ compadd -S '=' display generated verbose-display verbose-generated } } function _todo_priority () { _wanted priority expl 'priority' \ compadd default $priorities } function _todo_sort () { typeset -a keys used_prefixes typeset key prefix='' keys=(created completed text priority duration none done) for key in $keys; { [[ $key != none ]] && keys+="-$key" } if [[ -prefix *, ]] { prefix=${words[$CURRENT]%,*}, used_prefixes=(${(s:,:)prefix}) for key in $used_prefixes; { [[ $key == -* ]] && used_prefixes+=$key[2,-1] || used_prefixes+=-$key } } _wanted expression expl 'sort expression' \ compadd -F used_prefixes -qS , -P "$prefix" $keys } case $service in tda) _arguments -s $arg_add ;; tde|tdd) _arguments -s ':index:_todo_index' ;; tdr) zstyle ':completion:*:tdr:*' ignore-line yes _arguments -s '*:index:_todo_index' ;; *todo) _arguments -s $arg_generic ;; esac PK[O3}functions/_x_colormapidnuW+A#autoload local expl list desc _tags colormapids || return 1 list=(${(f)"$(xprop -root -f RGB_COLOR_MAP 32xcccccccxx ': $0\n'|awk -F'[ ():]' '/^[a-zA-Z_]+\(RGB_COLOR_MAP\)/ {print $5, "--", $1}')"}) if zstyle -T ":completion:${curcontext}:colormap-id" verbose; then desc=(-ld list) else desc=() fi _wanted colormapids expl 'colormap id' \ compadd "$@" "$desc[@]" - "${(@)list%% *}" PK[7*^functions/_call_programnuW+A#autoload +X local tmp if zstyle -s ":completion:${curcontext}:${1}" command tmp; then if [[ "$tmp" = -* ]]; then eval "$tmp[2,-1]" "$argv[2,-1]" else eval "$tmp" fi else eval "$argv[2,-1]" fi PK[d\**functions/run-help-svnnuW+Asvn help ${${@:#-*}[1]} | ${=PAGER:-more} PK[functions/_x_colornuW+A#autoload # This tries to automatically find the rgb.txt color database. If this # in an unusual place on your system or you want a personal database, # you can use the configuration key: # # colors_path # Path to a file containing the names of colors you want to # complete. In the form of a X11 rgb.txt file. local expl if (( ! $+_color_cache )); then local file # Cache of color names doesn't exist yet, create it. zstyle -s ":completion:${curcontext}:colors" path file if [[ -n "$file" ]]; then _color_cache=( "${(@)${(@f)$(< $file)}[2,-1]##* }" ) else file=( /usr/{lib,{{X11R6,openwin},local{,/X11{,R6}}}/lib}/X11/rgb.txt(N) ) (( $#file )) && _color_cache=( "${(@)${(@)${(@f)$(< $file[1])}[2,-1]##* }:#* *}" ) fi # Stupid default value. (( $#_color_cache )) || _color_cache=(white black gray red blue green) fi _wanted colors expl 'color specification' compadd "$@" -M \ 'm:{a-z}={A-Z} m:-=\ r:[^ A-Z0-9]||[ A-Z0-9]=* r:|=*' -a - _color_cache PK[:functions/_perl_basepodsnuW+A#autoload # # _perl_basepods - zsh completion function # # Adam Spiers # # Calculate all installed Perl base pods (perlfunc, perlfaq etc.). # The result is cached for future use. # if (( ! $+_perl_basepods )); then typeset -agU _perl_basepods if (( ${+commands[basepods]} )); then _perl_basepods=( ${$(basepods):t:r} ) else local podpath podpath=$(perl -MConfig -e 'print "$Config{installprivlib}/pod"') if [[ ! -e $podpath/perl.pod ]]; then _message "can't find perl.pod from Config.pm; giving up" return 1 else _perl_basepods=( ${podpath}/*.pod(:r:t) ) fi fi fi local expl _wanted pods expl 'perl base pod' compadd -a "$@" - _perl_basepods PK[functions/calendar_editnuW+Alocal line calendar local -a lockfiles editor integer cal_running if (( $# )); then editor=("$@") else editor=(${VISUAL:-${EDITOR:-vi}}) fi sched | while read line; do [[ $line = *" calendar -s "<->" "<-> ]] && (( cal_running = 1 )) done zstyle -s ':datetime:calendar:' calendar-file calendar || calendar=~/calendar # start of subshell for OS file locking ( # start of block for following always to clear up lockfiles. # Not needed but harmless if OS file locking is used. { if zmodload -F zsh/system b:zsystem && zsystem supports flock && zsystem flock $calendar 2>/dev/null; then # locked OK : else calendar_lockfiles $calendar || exit 1 fi eval $editor \$calendar } always { (( ${#lockfiles} )) && rm -f $lockfiles } ) (( cal_running )) && calendar -s PK[is functions/_user_expandnuW+A#autoload # This completer function is an addition to the _expand completer that # allows the user to define their own expansions. It does not replace # the _expand completer. # # This function will allow other completer functions to be called if # the expansions done produce no result or do not change the original # word from the line. setopt localoptions nonomatch [[ _matcher_num -gt 1 ]] && return 1 local exp word sort expr expl subd suf=" " asp tmp spec local -a specs reply if [[ "$funcstack[2]" = _prefix ]]; then word="$IPREFIX$PREFIX$SUFFIX" else word="$IPREFIX$PREFIX$SUFFIX$ISUFFIX" fi # In exp we will collect the expansions. exp=("$word") # Now look for user completions. zstyle -a ":completion:${curcontext}" user-expand specs || return 1 for spec in $specs; do case $spec in ('$'[[:IDENT:]]##) # Spec is an associative array with explicit keys. # Surely there's a better way of doing an associative array # lookup from its name? eval tmp='${'$spec[2,-1]'[$word]}' if [[ -n $tmp ]]; then exp=("$tmp") break fi ;; ('_'*) reply=() $spec $word if (( ${#reply} )); then exp=("${reply[@]}") break fi ;; esac done [[ $#exp -eq 1 && "$exp[1]" = "$word" ]] && return 1 # Now add as matches whatever the user requested. zstyle -s ":completion:${curcontext}:" sort sort [[ "$sort" = (yes|true|1|on) ]] && exp=( "${(@o)exp}" ) if zstyle -s ":completion:${curcontext}:" add-space tmp; then if [[ "$tmp" != *subst* || "$word" != *\$* || "$exp[1]" = *\$* ]]; then [[ "$tmp" = *file* ]] && asp=file [[ "$tmp" = *(yes|true|1|on|subst)* ]] && asp="yes$asp" fi else asp=file fi # If there is only one expansion, add a suitable suffix if (( $#exp == 1 )); then if [[ -d ${exp[1]} && "$exp[1]" != */ ]]; then suf=/ elif [[ "$asp" = yes* || ( "$asp" = *file && -f "${exp[1]}" ) ]]; then suf=' ' else suf= fi fi if [[ -z "$compstate[insert]" ]] ;then if [[ "$sort" = menu ]]; then _description expansions expl expansions "o:$word" else _description -V expansions expl expansions "o:$word" fi compadd "$expl[@]" -UQ -qS "$suf" -a exp else _tags all-expansions expansions original if [[ $#exp -gt 1 ]] && _requested expansions; then local i j normal space dir if [[ "$sort" = menu ]]; then _description expansions expl expansions "o:$word" else _description -V expansions expl expansions "o:$word" fi normal=() space=() dir=() for i in "$exp[@]"; do j="${i}" if [[ -d "$j" && "$i" != */ ]]; then dir=( "$dir[@]" "$i" ) elif [[ "$asp" = yes* || ( "$asp" = *file && -f "$j" ) ]]; then space=( "$space[@]" "$i" ) else normal=( "$normal[@]" "$i" ) fi done (( $#dir )) && compadd "$expl[@]" -UQ -qS/ -a dir (( $#space )) && compadd "$expl[@]" -UQ -qS " " -a space (( $#normal )) && compadd "$expl[@]" -UQ -qS "" -a normal fi if _requested all-expansions expl 'all expansions'; then local disp dstr if [[ "${#${exp}}" -ge COLUMNS ]]; then disp=( -ld dstr ) dstr=( "${(r:COLUMNS-5:)exp} ..." ) else disp=() fi [[ -o multios ]] && exp=($exp[1] $compstate[redirect]${^exp[2,-1]}) compadd "$disp[@]" "$expl[@]" -UQ -qS "$suf" - "$exp" fi _requested original expl original && compadd "$expl[@]" -UQ - "$word" compstate[insert]=menu fi return 0 PK['functions/_defaultsnuW+A#compdef defaults _defaults_domains(){ if [[ "`eval echo $PREFIX`" != [/~]* ]]; then local str="$(_call_program domains defaults domains 2>/dev/null)" local expl local -a list list=( ${(s/, /)str} -g -globalDomain ) _wanted domains expl 'defaults database domain' \ compadd -M 'r:|.=* r:|=*' -a list else _files -g '*.plist(e:"reply=\${REPLY%.plist}":)' fi } _defaults_keys(){ local ks ks=(${${${${(M)${(f)"$(defaults read "$words[2]" 2>/dev/null)"}:# [^ ]*=*}# }%% = *}:Q}) local expl _wanted keys expl 'key' compadd "$ks[@]" } _defaults(){ local -a _1st_arguments _1st_arguments=( read read-type write rename delete domains find help ) local curcontext="$curcontext" state line expl _arguments -A '-*' \ '(-currentHost)-host:host:_hosts' \ '(-host)-currentHost' \ '*::command:->subcmd' && return 0 if (( CURRENT == 1 )); then _describe -t commands "command" _1st_arguments return fi case $words[1] in read|read-type|delete) _arguments \ "(1)-app:application:_mac_applications" \ "(-app)1:domain:_defaults_domains" \ "2:keys:_defaults_keys" ;; write) _arguments \ "(1)-app:application:_mac_applications" \ "(-app)1:domain:_defaults_domains" \ "2:key:_defaults_keys" \ "*::value" ;; rename) _arguments \ "(1)-app:application:_mac_applications" \ "(-app)1:domain:_defaults_domains" \ "2:old key:_defaults_keys" \ "3:new key:_defaults_keys" ;; domains|help) ;; find) _message word ;; *) _message "unknown defaults command: $words[1]" ;; esac } _defaults "$@" PK[HH-functions/_varsnuW+A#compdef getopts unset # This will handle completion of keys of associative arrays, e.g. at # `vared foo['. local ret=1 if [[ $PREFIX = *\[* ]]; then compstate[parameter]=${PREFIX%%(|\\)\[*} IPREFIX=${PREFIX%%\[*}\[ PREFIX=${PREFIX#*\[} _subscript -q else _parameters -g '^a*' "$@" && ret=0 if compset -S '\[*'; then set - -S "" "$@" else set - -qS"${${QIPREFIX:+[}:-\[}" "$@" fi _parameters -g 'a*' "$@" && ret=0 return ret fi PK[GYmmfunctions/_killallnuW+A#compdef killall killall5 if [[ $service = killall && "$OSTYPE" = (linux*|*bsd*|darwin*) ]]; then _alternative \ 'signals:: _signals -p' \ 'processes-names:process:{ compadd "$expl[@]" ${${${${(f)"$(_call_program processes-names ps ${${EUID/(#s)0(#e)/xa}//[0-9]#/}ho command 2> /dev/null)"//[][\(\)]/}:#(ps|COMMAND|-*)}%%\ *}:t} }' else _signals -p fi PK[No[[functions/_pidsnuW+A#compdef pflags pcred pmap pldd psig pstack pfiles pwdx pstop prun pwait ptree # If given the `-m ' option, this tries to complete only pids # of processes whose command line match the `'. local out pids list expl match desc listargs all nm ret=1 _tags processes || return 1 if [[ "$1" = -m ]]; then all=() match="*[[:blank:]]${PREFIX}[0-9]#${SUFFIX}[[:blank:]]*[/[:blank:]]${2}*" shift 2 elif [[ "$PREFIX$SUFFIX" = ([%-]*|[0-9]#) ]]; then all=() match="(*[[:blank:]]|)${PREFIX}[0-9]#${SUFFIX}[[:blank:]]*" else all=(-U) match="*[[:blank:]]*[[/[:blank:]]$PREFIX*$SUFFIX*" nm="$compstate[nmatches]" fi out=( "${(@f)$(_call_program processes ps 2>/dev/null)}" ) desc="$out[1]" out=( "${(@M)out[2,-1]:#${~match}}" ) if [[ "$desc" = (#i)(|*[[:blank:]])pid(|[[:blank:]]*) ]]; then pids=( "${(@)${(@M)out#${(l.${#desc[1,(r)(#i)[[:blank:]]pid]}..?.)~:-}[^[:blank:]]#}##*[[:blank:]]}" ) else pids=( "${(@)${(@M)out##[^0-9]#[0-9]#}##*[[:blank:]]}" ) fi if zstyle -T ":completion:${curcontext}:processes" verbose; then list=( "${(@Mr:COLUMNS-1:)out}" ) desc=(-ld list) else desc=() fi _wanted processes expl 'process ID' \ compadd "$@" "$desc[@]" "$all[@]" -a - pids && ret=0 if [[ -n "$all" ]]; then zstyle -s ":completion:${curcontext}:processes" insert-ids out || out=menu case "$out" in menu) compstate[insert]=menu ;; single) [[ $compstate[nmatches] -ne nm+1 && $compstate[insert] != menu ]] && compstate[insert]= ;; *) [[ ${#:-$PREFIX$SUFFIX} -gt ${#compstate[unambiguous]} ]] && compstate[insert]=menu ;; esac fi return ret PK[L functions/_a2psnuW+A#compdef a2ps # This is for the GNU version of a2ps. if [[ "$words[1]" != "$_cache_a2ps_cmd" ]]; then local descr _cache_a2ps_cmd="$words[1]" descr=( "${(@)${(f@)$(_call_program features LC_ALL=C $words[1] --list=features)// / }:#}" ) _cache_a2ps_values=( "${descr[(r)Known [Ss]tyle [Ss]heets*]#* }" "${descr[(r)Known [Ee]ncodings*]#* }" "${descr[(r)Known [Mm]edia*]#* }" "${descr[(r)Known [Pp]rologues*]#* }" "${descr[(r)Known PostScript Printer Descriptions*]#* }" "${descr[(r)Known [Oo]utputs*]#* }" "${descr[(r)Known [Uu]ser [Oo]ptions*]#* }" "${descr[(r)Known Variables*]#* }" ) fi integer ret=1 local context state line expl typeset -A opt_args _arguments \ '(-E --pretty-print=)'{-E-,--pretty-print=}"[enable pretty-printing]::language:(${_cache_a2ps_values[1]})" \ \*{-D+,--define=}"[set or unset variable]:variable:(${_cache_a2ps_values[8]})" \ '(-d -P --printer)'{-P,--printer=}"[send output to printer]:printer:->printers" \ '(-A --file-align)'{-A,--file-align=}'[specify alignment of separate files]:mode:(virtual rank page sheet)' \ '(-a --pages)'{-a-,--pages=}'[select pages to print]:page range' \ '(-q --quiet --silent -v --verbose)'{-q,--quiet,--silent}'[quiet output]' \ '(-q --quiet --silent -v --verbose)'{-v-,--verbose=}'[verbose output]:level' \ '(-b --header)'{-b-,--header=}'[set the page header]:text' \ '(-g)--highlight-level=:highlight:(none normal heavy)' \ '--list=:topic:(features delegations encodings media prologues printers style-sheets user-options variables)' \ "--user-option=:user option:(${_cache_a2ps_values[7]})" \ {-M,--medium=}":medium:(${_cache_a2ps_values[3]})" \ "--ppd=::printer description:(${_cache_a2ps_values[5]})" \ '--statusdict=:statusdict definition' \ '--setpagedevice=:page device definition' \ '--margin=:margin size (PostScript points)' \ '--toc=:format' \ --{{center,left,right}-title.underlay,{,left-,right-}footer}'=:text' \ '*:input file:_files' -- \ '*\*:toggle:(yes no)' \ '*=DIRECTION:direction:(rows columns)' \ '*=TYPE:type:((r\:CR mac\:CR unix\:LF n\:LF nr\:LFCR rn\:CRLF pc\:CRLF any auto))' \ '--version-control*:version control:(none off t numbered nil existing never simple)' \ '--strip-level*:strip level:((0\:everything\ is\ printed 1\:regular\ comments\ are\ not\ printed 2\:strong\ comments\ are\ not\ printed 3\:no\ comment\ is\ printed))' \ '--sides=*:mode:(simplex duplex tumble)' \ '--non-printable-format*:format:(caret space question-mark octal hexa emacs)' \ "--encoding*:encoding:(${_cache_a2ps_values[2]})" \ "--prologue*::prologue:(${_cache_a2ps_values[4]})" && ret=0 if [[ $state = printers ]]; then _wanted printers expl printer compadd -- ${=_cache_a2ps_values[6]} && ret=0 _printers && ret=0 fi return ret PK[Qhfunctions/_dpkg-buildpackagenuW+A#compdef dpkg-buildpackage _arguments \ '-b[binary-only build, no source]' \ '-B[binary-only build, no source or arch-indep binaries]' \ '-S[source-only build, no binaries]' \ '-s-:source generation:((i\:default a\:force\ inclusion\ of\ original\ source d\:force\ exclusion\ of\ original\ source))' \ '-a-:architecture:(alpha amd64 arm hppa hurd-i386 i386 ia64 m68k mips mipsel powerpc s390 sparc)' \ '-v-:version:' \ '-C-:changes description:_files' \ '-m-:maintainer address:_email_addresses' \ '-e-:maintainer address:_email_addresses' \ '(-d)-D[check build dependencies and conflicts]' \ '(-D)-d[do not check build dependencies and conflicts]' \ '-W[turn certain errors into warnings]' \ '-E[negates previously-set -W]' \ '-nc[do not clean source tree]' \ '-tc[clean the source tree after build]' \ '-r-:gain-root command: _command_names -e' \ '-p-:sign command: _command_names -e' \ '-k-:key ID:' \ '-us[do not sign source package]' \ '-uc[do not sign .changes file]' \ '*-i-:ignore regexp:' \ '*-I-:ignore filename:_files' \ '--admindir=:dpkg database dir:_files -/' \ '(-h --help)'{-h,--help}'[show usage message]' \ '--version[show version]' PK[7F((functions/_xt_session_idnuW+A#autoload _message -e ids 'session ID' PK[ *functions/_sub_commandsnuW+A#autoload local expl if [[ CURRENT -eq 2 ]]; then _wanted commands expl command compadd "$@" else _message 'no more arguments' fi PK[I,hhfunctions/_csupnuW+A#compdef csup _arguments -s \ '-1[disable automatic retries]' \ '-4[force usage of IPv4 addresses]' \ '-6[force usage of IPv6 addresses]' \ '-A[local address to bind to when connecting to the server]:local address:_hosts' \ '-b[base directory]:base directory:_files -/' \ '-c[subdirectory of base for information about collections]:collections directory:_files -/' \ '-d[maximum number of deleted files]:maximum number of deleted files:' \ '-h[server host]:server host:_hosts' \ '-i[include only files and directories matching]:file pattern:' \ '-k[keep temporary copies of failed updates]' \ '-l[lock file]:lock file:_files' \ '-L[verbosity level]:verbosity level:(0 1 2)' \ '-L0[verbosity level 0]' \ '-L1[verbosity level 1]' \ '-L2[verbosity level 2]' \ '-p[server port]:port:_ports' \ '-r[maximum number of retries]:maximum number of retries:' \ '-s[suppress status checks]' \ '-v[print version information]' \ '(-Z)-z[enable compression]' \ '(-z)-Z[disable compression]' \ ':csup file:_files' \ ':destination directory:_files -/' PK[Cefunctions/prompt_pws_setupnuW+A# pws prompt theme prompt_pws_help() { cat <<'EOF' Simple prompt which tries to display only the information you need. - highlighted parenthesised status if last command had non-zero status - bold + if shell is not at top level (may need tweaking if there is another shell in the process history of your terminal) - number of background jobs in square brackets if non-zero - time in yellow on black, with Ding! on the hour. I usually use this in a white on black terminal. EOF } prompt_pws_setup() { PS1='%K{white}%F{red}%(?..(%?%))'\ '%K{black}%F{white}%B%(2L.+.)%(1j.[%j].)'\ '%F{yellow}%(t.Ding!.%D{%L:%M})'\ '%f%k%b%# ' } prompt_pws_setup "$@" PK[b33functions/_expand_wordnuW+A#compdef -K _expand_word complete-word \C-xe _list_expansions list-choices \C-xd # Simple completion front-end implementing expansion. local curcontext="$curcontext" if [[ -z "$curcontext" ]]; then curcontext="expand-word:::" else curcontext="expand-word:${curcontext#*:}" fi _main_complete _expand PK[ׄ[::functions/_mencalnuW+A#compdef mencal local curcontext="$curcontext" state line ret=1 _arguments -C \ '(--monday -m)'{-m,--monday}'[monday as first day of work]' \ '-1[current month]' \ '-3[previous, current, and next month]' \ '-y[all-year calendar]::year:' \ '(--quiet -q)'{-q,--quiet}'[no top information]' \ '(--nocolor -n)'{-n,--nocolor}'[noncolored output]' \ '(--icolor -i)'{-i,--icolor}'[intersection color]:color:(red green blue yellow violet cyan shiny bold)' \ '(-)'{-h,--help}'[display help informaiton]' \ '(-)'{-V,--version}'[print version information]' \ \*{-c,--config}'[config]:options:->option' && ret=0 if [[ $state = option ]]; then _values -s , 'config option' \ '(s start)'{s,start}'[start day]:day' \ '(l length)'{l,length}'[period length]:length' \ '(d duration)'{d,duration}'[menstruation duration]:duration' \ '(n name)'{n,name}'[name of subject]:name' \ '(f file)'{f,file}'[filename]:file:_files' \ '(c color)'{c,color}'[color for menstruation days]:color:(red green blue yellow violet cyan shiny bold)' && ret=0 fi return ret PK[.yBBfunctions/_waitnuW+A#compdef wait _alternative 'processes:: _pids' 'jobs:: _jobs -t' PK[0ufunctions/_correctnuW+A#autoload # This is mainly a wrapper around the more general `_approximate'. # By setting `compstate[pattern_match]' to something unequal to `*' and # then calling `_approximate', we get only corrections, not all strings # with the corrected prefix and something after it. # # Supported configuration keys are the same as for `_approximate', only # starting with `correct'. local ret=1 opm="$compstate[pattern_match]" compstate[pattern_match]='-' _approximate && ret=0 compstate[pattern_match]="$opm" return ret PK[t2functions/_ld_debugnuW+A#compdef -value-,LD_DEBUG,-default- local vals vals=( 'libs[display library search paths]' 'files[show processing of files and libraries]' 'bindings[display symbol binding]' 'reloc[display relocation processing]' 'symbols[display symbol table processing]' 'unused[show unused files]' 'versions[show version processing]' 'help[display help message]' ) case $OSTYPE in solaris*) vals+=( 'basic[provide basic trace information/warnings]' 'cap[display hardware/software capability processing]' 'detail[provide more info in conjunction with other options]' 'demangle[display C++ symbol names in their demangled form]' 'init[display init and fini processing]' 'long[display long object names without truncation]' 'move[display move section processing]' 'segments[display available output segments and address/offset processing]' 'strtab[display information about string table compression]' 'tls[display TLS processing info]' ) ;; linux*) vals+=( 'all[combine all options]' 'statistics[display relocation statistics]' ) ;; esac _values -s , capability $vals PK[(`b  functions/_suffix_alias_filesnuW+A#autoload # Complete files for which a suffix alias exists. local expl pat (( ${#saliases} )) || return 1 if (( ${#saliases} == 1 )); then pat="*.${(kq)saliases}" else local -a tmpa # This is so we can quote the alias names against expansion # without quoting the `|' which needs to be active in the pattern # --- remember that an alias name can be pretty much anything. tmpa=(${(kq)saliases}) pat="*.(${(kj.|.)tmpa})" fi # _wanted is called for us by _command_names _path_files "$@" -g $pat PK[ڿfunctions/VCS_INFO_get_data_cvsnuW+A## vim:ft=zsh ## cvs support by: Frank Terbeck ## Distributed under the same BSD-ish license as zsh itself. setopt localoptions NO_shwordsplit local cvsbranch cvsbase cvsbase="." while [[ -d "${cvsbase}/../CVS" ]]; do cvsbase="${cvsbase}/.." done cvsbase="$(VCS_INFO_realpath ${cvsbase})" cvsbranch=$(< ./CVS/Repository) rrn=${cvsbase:t} cvsbranch=${cvsbranch##${rrn}/} [[ -z ${cvsbranch} ]] && cvsbranch=${rrn} VCS_INFO_formats '' "${cvsbranch}" "${cvsbase}" '' '' '' '' return 0 PK[- functions/_sortnuW+A#compdef sort # zsh completions for GNU sort version 5.97 # limitation: --key does not work exactly right local arguments arguments=( '(-b --ignore-leading-blanks)'{-b,--ignore-leading-blanks}'[ignore leading blanks]' '(-d --dictionary-order)'{-d,--dictionary-order}'[consider only blanks and alphanumeric characters]' '(-f --ignore-case)'{-f,--ignore-case}'[fold lower case to upper case characters]' '(-g --general-numeric-sort)'{-g,--general-numeric-sort}'[compare according to general numeric value]' '(-i --ignore-nonprinting)'{-i,--ignore-nonprinting}'[consider only printable characters]' '(-M --month-sort)'{-M,--month-sort}"[compare (unknown) < 'JAN' < ... < 'DEC']" '(-n --numeric-sort)'{-n,--numeric-sort}'[compare according to string numerical value]' '(-r --reverse)'{-r,--reverse}'[reverse the result of comparisons]' '(-c --check)'{-c,--check}'[check whether input is sorted; do not sort]' '(-k --key)'{-k+,--key=}'[start a key at POS1, end it as POS2 (origin 1)]:key:' '(-m --merge)'{-m,--merge}'[merge already sorted files; do not sort]' '(-o --output)'{-o+,--output=}'[write result to FILE instead of standard output]:filename:_files' '(-s --stable)'{-s+,--stable=}'[stabilize sort by disabling last-resort comparison]' '(-S --buffer-size)'{-S+,--buffer-size=}'[use SIZE for main memory buffer]:size:' '(-t --field-separator)'{-t+,--field-separator=}'[use SEP instead of non-blank to blank transition]:separator:' '(-T --temporary-directory)'{-T+,--temporary-directory=}'[use DIR for temporaries, not $TMPDIR or /tmp; multiple options specify multiple directories]:directory' '(-u --unique)'{-u,--unique}'[with -c, check for strict ordering; without -c, output only the first of an equal run]' '(-z --zero-terminated)'{-z,--zero-terminated}'[end lines with 0 byte, not newline]' --help'[display help and exit]' --version'[output version information and exit]' '*:filename:_files' ) _arguments -s $arguments PK[{"GGfunctions/_arpingnuW+A#compdef arping if _pick_variant iputils=iputils unix -V; then _arguments -s \ '-f[quit on first reply]' \ '-q[be quiet]' \ '-b[keep broadcasting, do not go unicast]' \ '-D[duplicate address detection mode]'\ '-U[unsolicited ARP mode, update your neighbours]' \ '-A[ARP answer mode, update your neighbours]' \ '-V[print version and exit]' \ '-c[how many packets to send]:count' \ '-w[how long to wait for a reply]:timeout' \ '-I[interface]:ethernet interface:_net_interfaces' \ '-s[source ip address]:source IP address:_hosts' \ ':destination:_hosts' else _arguments -s \ '(-)-h[display help information]' \ '-q[only display error messages]' \ '-a[audible ping]' \ '*-v[verbose output]' \ '-r[raw output: only the MAC/IP address displayed]' \ '-R[like -r but shows "the other one"]' \ '-d[find duplicate replies]' \ '(:)-B[255.255.255.255]' \ '-0[source 0.0.0.0]' \ '-b[source 255.255.255.255]' \ '-S[set source IP]:source IP address:_hosts' \ '-T[target IP]:target IP address:_hosts' \ '-p[turn on promiscuous mode]' \ '-s[set source MAC address]:source MAC address' \ '-t[set target MAC address]:target MAC address' \ '-c[send this many requests]:count' \ '-i[interface]:interface:_net_interfaces' \ '-A[only count addresses matching requested address]' \ '(-B):address:_hosts' fi PK[,xtfunctions/_perldocnuW+A#compdef perldoc -value-,PERLDOC,-default- local curcontext="$curcontext" state line expl args ret=1 typeset -A opt_args args=( '*:Perl pod pages:->perl-pods' ) if [[ $service = *PERLDOC* ]]; then compset -q words=( fake "$words[@]" ) (( CURRENT++ )) args=() fi _arguments -C -s -S -A "-*" \ '(- *)-h[print help information]' \ '(- *)-V[display version information]' \ '-v[verbose output]' \ '-t[use plain text output instead of nroff]' \ '-u[show raw Pod source]' \ '*-m[display entire module]:module:_perl_modules' \ '-l[display only filename of the module found]' \ '-F[consider arguments as filenames]' \ '(-q)-f+[view documentation for Perl built-in function]:perl builtin function:->perl-builtin-funcs' \ '(-f)-q+[search question headings in Perl FAQ]:regular expression' \ '(-d)-T[send output direct to stdout and not via pager]' \ '(-T)-d+[specify output file]:output file:_files' \ '-o+[specify output format]:output format:(man nroff pod rtf text tk xml latex)' \ '-M[specifies module to use for formatting]:module:_perl_modules' \ '-w[specify option to formatter]:option' \ '-X[use an index if present]' \ '-n+[specify replacement for nroff]:nroff replacement:_command_names -e' \ '-r[recursive search]' \ '-i[ignore case]' \ "$args[@]" && ret=0 case $state in perl-builtin-funcs) : ${(A)_perl_builtin_funcs:=${(u)${${(M)${(f)"$(_call_program functions \ perldoc -u perlfunc 2>/dev/null)"}:#\=item [a-z]*}#* }%%[^a-z]*}} _wanted functions expl 'perl built-in function' compadd "$@" -a - \ _perl_builtin_funcs && ret=0 ;; perl-pods) if (( $+opt_args[-F] )); then _wanted files expl 'Perl modules and .pods' \ _files -g "*.(pod|pm)(-.)" && ret=0 else _alternative \ 'modules:module: _perl_modules -tP' \ 'pods:base pod: _perl_basepods' \ 'files:module or .pod file:_files -g "*.(pod|pm)(-.)"' && ret=0 fi ;; esac return ret PK[yfunctions/_topgitnuW+A#compdef tg local expl if (( CURRENT == 2 )); then _wanted subcmd expl 'topgit command' compadd create delete export import info patch remote summary update else _files fi PK[.  functions/_read_compnuW+A#compdef -k complete-word \C-x\C-r # This allows an on-the-fly choice of completions. On typing the key # sequence given above, you will be prompted for a string of arguments. If # this string begins with `_', it will be taken as the name of a function to # evaluate to generate the completions; unambiguous strings in the function # name are automatically completed. # # Else it is taken to be a set of arguments for compadd to generate a list # of choices. The possibilities are the same as the flags for generating # completions given in the zshcompwid manual page. Note the arguments are # verbatim: include minus signs, spaces, quotes, etc. # # On subsequent calls, the same completion will be re-performed. To # force a new type of completion to be read, supply a numeric argument. # # For example, # % bindkey | grep rever # Completion: -b # % bindkey | grep reverse-menu-complete _ # # Global variables used: # _read_comp Last completion string read from user # emulate -L zsh setopt localoptions extendedglob nobadpattern unset # xtrace promptsubst # local PS4='%N:%i:$((#key))> ' typeset -g _read_comp if [[ ${+NUMERIC} = 0 && -n $_read_comp ]]; then if [[ $_read_comp = _* ]]; then eval $_read_comp else eval "compadd $_read_comp" fi return fi _read_comp= local key search str str2 newch funcs funcs2 exact msg list integer pos msg="Completion: " zle -R $msg if ! read -k key; then zle -cR '' return 1 fi while [[ '#key' -ne 10 && '#key' -ne 13 ]]; do if [[ '#key' -eq 0 && '#key' -eq 3 || '#key' -eq 7 ]]; then zle -cR '' return 1 fi if [[ ( '#key' -eq 8 || '#key' -eq 127 ) && -n $str ]]; then # delete character str="$str[1,-2]" exact= list=() elif [[ '#key' -eq 21 ]]; then # ^U: delete line str= exact= list=() elif [[ '#key' -eq 4 && $str = _[^\ ]# && $str != *' '* ]]; then # ^D: list completions list=(${$(whence -m "$str*" 2>/dev/null)%: function}) elif [[ ( -n $exact && $key != ' ' ) || '#key & 127' -lt 32 ]]; then # If we've got an exact function, only allow a space after it. # Don't try to insert non-printing characters. if [[ -n $ZBEEP ]]; then print -nb $ZBEEP elif [[ -o beep ]]; then print -n "\a" fi list=() else str="$str$key" if [[ $str = _[^\ ]# ]]; then # Rudimentary completion for function names. # Allow arguments, i.e. don't do this after we've got a space. funcs=(${$(whence -m "$str*" 2>/dev/null)%: function}) if [[ -o autolist && $#str -gt 1 ]]; then list=($funcs) else list=() fi if (( $#funcs == 1 )); then # Exact match; prompt the user for a newline to confirm str=$funcs[1] exact=" (Confirm)" elif (( $#funcs == 0 )); then # We can't call zle beep, because this isn't a zle widget. if [[ -n $ZBEEP ]]; then print -nb $ZBEEP elif [[ -o beep ]]; then print -n "\a" fi str="$str[1,-2]" list=() else # Add characters to the string until a name doesn't # match any more, then backtrack one character to get # the longest unambiguous match. str2=$str pos=$#str2 while true; do (( pos++ )) newch=${funcs[1][pos]} [[ -z $newch ]] && break str2=$str2$newch funcs2=(${funcs##$str2*}) (( $#funcs2 )) && break str=$str2 done fi else exact= fi fi if (( $#list )); then zle -R "$msg$str$exact" $list else zle -cR "$msg$str$exact" fi if ! read -k key; then zle -cR '' return 1 fi done if [[ -z $str ]]; then # string must be non-zero return 1 elif [[ $str = _* ]] && ! whence ${str%% *} >& /dev/null; then # a function must be known to the shell return 1 else # remember the string for re-use _read_comp=$str fi zle -cR '' if [[ $str = _* ]]; then eval $str else eval "compadd $str" fi PK[vfunctions/_rrdtoolnuW+A#compdef rrdtool _arguments \ ':rrdtool command:(create update updatev graph dump restore last lastupdate first help info fetch tune resize xport)' \ '*::subcmd:->subcmd' && return 0 case "$state" in (subcmd) case "$words[1]" in (help) _wanted -V 'subcommands' expl 'subcommand' compadd \ create update updatev graph dump restore last lastupdate \ first help info fetch tune resize xport ;; (*) _files ;; esac ;; esac PK[S8$functions/_mac_files_for_applicationnuW+A#autoload _mac_rsrc_check() { [[ ! -s "$REPLY/..namedfork/rsrc" ]] && return 1 if [[ -x /Developer/Tools/GetFileInfo ]]; then local ftype="$(command /Developer/Tools/GetFileInfo -t $REPLY)" ftype="${ftype//\"/}" [[ -n "$types[(r)$ftype]" ]] else grep --quiet "\(${(j/\|/)types}\)" "$REPLY/..namedfork/rsrc" fi } _mac_parse_info_plist() { # For now, awk is used because builtin function "read" was too slow. # '<' is used for the delimiter because some Info.plist files use CR as # newline but read doesn't treat them as so local s=' BEGIN { RS="<" } /^key>/ { sub(/key>/, ""); reading_key=$0 } /^string>/ { sub(/string>/, "") if (reading_key == "CFBundleTypeExtensions") exts=exts " \"" $0 "\"" if (reading_key == "CFBundleTypeOSTypes") types=types " \"" $0 "\"" } END { print "exts=(" exts ")\ntypes=(" types ")" } ' command awk $s "$app_path/Contents/Info.plist" | while read; do eval "$REPLY" done } # Try to complete files for the specified application. _mac_files_for_application() { local -a opts zparseopts -D -a opts q n 1 2 P: S: r: R: W: X+: M+: F: J+: V+: local app_path _retrieve_mac_apps app_path="${_mac_apps[(r)*/$1(|.app)]:-$1}" local -a glob_patterns glob_patterns=() # Try to get extentions from "Info.plist" XML file. if [[ -f "$app_path/Contents/Info.plist" ]]; then local -a exts types _mac_parse_info_plist if [[ -n "$exts[(r)\*]" ]]; then glob_patterns=( "*" ) else if (( #exts != 0 )); then glob_patterns+=( "*.(${(j/|/)exts})(N)" ) fi if (( #types != 0 )); then glob_patterns+=( "^*.[[:alnum:]]##(.Ne:_mac_rsrc_check:)" ) fi fi else glob_patterns=( "*" ) fi case ${#glob_patterns} in 0) return 1 ;; 1) _files "$opts[@]" -g "$glob_patterns[1]" ;; *) _files "$opts[@]" -g "{${(j/,/)glob_patterns}}" ;; esac } _mac_files_for_application "$@" PK[g5functions/_lddnuW+A#compdef ldd if _pick_variant gnu=GNU solaris --version; then args=( '(- *)--version[display version information]' '(- *)--help[display help information]' '(-v --verbose)'{-v,--verbose}'[include symbol versioning information]' '(-d --data-relocs)'{-d,--data-relocs}'[perform data relocations and report missing objects]' '(-f --function-relocs)'{-f,--function-relocs}'[perform data/function relocations and report missing objects]' '(-u --unused)'{-u,--unused}'[display any unused objects]' ) else args=( -s '(-r)-d[check immediate references]' '(-d)-r[check immediate and lazy references]' '-u[display any unused objects]' '-U[display any unreferenced, or unused dependencies]' '-e[set specified environment variable]:environment variable:(LD_PRELOAD LD_LIBRARY_PATH LD_RUN_PATH LD_DEBUG LD_DEBUG_OUTPUT LD_NOCONFIG LD_NOAUXFLTR)' '-f[check for insecure executable]' '-i[display order of execution of initialization sections]' '-L[enable lazy loading]' '-l[force immediate processing of any filters]' '-s[display search path used]' '-v[displays all dependency relationships]' ) fi _arguments $args \ '*: : _alternative "executables:executable:_files -g \^\*.so\(\*\)" "shared-objects:shared object:_files -g \*.so"' PK[*functions/_diffstatnuW+A#compdef diffstat _arguments \ '-c[prefix each line with hash mark]' \ '-e:error file:_files' \ '-f:histogram format:((0\:concise 1\:normal 2\:dots 3\:dots+normal 4\:value 5\:value+normal 6\:value+dots 7\:value+dots+normal))' \ '-h[help]' \ '-k[suppress merging of filenames in report]' \ '-l[list only the filenames]' \ '-n:minimum width for filenames:' \ '-o:output file:_files' \ '-p:number of path components:' \ '-f:rounding code:((0\:none 1\:round 2\:round+adjustment))' \ '-t[overrides histogram, generates csv output]' \ '-u[suppress sorting of filenames in report]' \ '-v[show progress]' \ '-V[print version number]' \ '-w:maximum width of histogram:' \ '*:file specifications:_files' PK[ Ufunctions/zed-set-file-namenuW+Aemulate -L zsh autoload -Uz read-from-minibuffer zle -K zed-normal-keymap local REPLY read-from-minibuffer "File name: " zed_file_name=$REPLY PK[OyJJ functions/_ipnuW+A#compdef ip # This is based on iproute2-ss061214. # The manual and help text summaries are not consistent with the main # manual text. I have based this on the main manual text, except where # it's obviously deficient. # # Values encoding simple types # local -a subcmd_dev subcmd_dev=(/$'[[:alpha:]]##[[:digit:]]##(\.[[:digit:]]##)#\0'/ ':interfaces:network interface:_net_interfaces') local -a subcmd_onoff subcmd_onoff=(/$'(on|off)\0'/ ':onoff:state (on or off):(on off)') local -a subcmd_string subcmd_string=(/$'[^\0]#\0'/ ':string:arbitrary string:( )') local -a subcmd_number subcmd_number=(/$'[0-9]##\0'/ ':number:decimal number:( )') local xp='[[:xdigit:]][[:xdigit:]]' local -a subcmd_lladdr subcmd_lladdr=(/"${xp}:${xp}:${xp}:${xp}:${xp}:${xp}"$'\0'/ ':lladdress:link layer (MAC) address:( )') local -a subcmd_ipaddr subcmd_ipaddr=( /$'(<->(.<->(.<->(.<->|)|)|)|[:[:xdigit]]#:[:[:xdigit:]]#)(|/<->)\0'/ ':ipaddress:IP address (v4 or v6) with optional /:( )' ) local -a subcmd_ipaddrs local PATH=$PATH PATH=/sbin:$PATH subcmd_ipaddrs=( /$'(<->(.<->(.<->(.<->|)|)|)|[:[:xdigit]]#:[:[:xdigit:]]#)(|/<->)\0'/ ":ipaddress:IP address (v4 or v6) currently set:( $(ip addr show | sed -n 's/^ *inet6* \([0-9a-f\.:/]*\) .*$/\1/p') )" ) local -a subcmd_scope _regex_words scope "IP address scope" \ 'global:address globally valid' \ 'site:address valid for site (IPv6)' \ 'link:address valid for single link' \ 'host:address valid for this host' subcmd_scope=("$reply[@]") local -a subcmd_nud _regex_words nud "Neighbour Unreachability Detection state" \ 'permanent:valid forever' \ 'noarp:valid, not validated, removed if expired' \ 'reachable:valid until reachability timeout' \ 'stale:valid but suspicious' subcmd_nud=("$reply[@]") local -a subcmd_rttype _regex_words route-type "Route type" \ 'unicast:real point-to-point route' \ 'unreachable:generate Host Unreachable messages' \ 'blackhole:silently discard' \ 'prohibit:generate Communication Administratively Prohibited messages' \ 'local:Loopback route' \ 'broadcast:destinations are broadcast addresses' \ 'throw:used with policy rules, generate Net Unreachable if no route' \ 'nat:Network Address Translation route' \ 'anycast:anycast addresses, not implemented' \ 'multicast:multicast routing, not present in normal tables' subcmd_rttype=("$reply[@]") local -a subcmd_route # Route type is optional in route. # There's an overall default but then the whole thing is missed # out, and it's marked as optional anyway. subcmd_route=("(" $subcmd_rttype "|" ")" $subcmd_ipaddr) local -a subcmd_tos _regex_words tos "type of service" \ 'lowdelay:low latency' \ 'throughput:high bulk throughput' \ 'reliability:high reliability' subcmd_tos=("(" "$reply[@]" "|" /$'(|0x)[[:xdigit:]]##\0'/ ":hex-number:8-bit hex number:( )" ")") local -a subcmd_lockmtu subcmd_lockmtu=("(" /$'lock\0'/ ":lock:lock:(lock)" "|" ")" $subcmd_number ) local -a subcmd_nexthop _regex_words nexthop 'nexthop route keyword' \ 'via:specify nexthop router:$subcmd_ipaddr' \ 'dev:sepcify output device:$subcmd_dev' \ 'weight:specify relative quality of route:$subcmd_number' subcmd_nexthop=("$reply[@]" "#") local -a subcmd_rtproto _regex_words rtprotocol 'route protocol' \ 'redirect:installed from ICMP redirect' \ 'kernel:installed automatically by kernel' \ 'boot:installed during boot sequence' \ 'static:installed by adminstrator' \ 'ra:installed by Router Discovery protocol' subcmd_rtprotocol=("$reply[@]") local -a subcmd_rttable _regex_words rttable 'routing table' \ 'local:local routes' \ 'main:main routing table' \ 'default:default routing table' \ 'unspec:unspecified routing table' subcmd_rttable=("(" "$reply[@]" "|" $subcmd_number ")") local -a subcmd_rtrealm subcmd_rtrealms _regex_words -t / rtrealm 'routing realm' \ 'cosmos:everywhere' subcmd_rtrealms=("(" "$reply[@]" "|" /$'[0-9]##/'/ ':number:decimal number:( )' ")") _regex_words rtrealm 'routing realm' \ 'cosmos:everywhere' subcmd_rtrealm=("(" "$reply[@]" "|" $subcmd_number ")") subcmd_rtrealms+=($subcmd_rtrealm) local -a subcmd_rtselector _regex_words rtselmod 'routing selector modifier' \ 'root:select minimum route prefix length to match' \ 'match:select maximum route prefix length to match' \ 'exact:select exact prefix length to match' subcmd_rtselector=("(" "$reply[@]" "|" ")" $subcmd_ipaddr) local -a subcmd_family _regex_words family 'protocol family' \ 'inet:IPv4' \ 'inet6:IPv6' \ 'link:local, no networking protocol' subcmd_family=("$reply[@]") local -a subcmd_ruletypes _regex_words ruletype 'rule type' \ 'unicast:rule applies to a route' \ 'blackhole:rule silently drops packet' \ 'unreachable:rule generates Network Unreachable messages' \ 'prohibit:rule generates Communication Administratively Prohibited messages' \ 'nat:rule prescribes translation of source IP address' subcmd_ruletypes=("$reply[@]") local -a subcmd_tunnelmode _regex_words tunnelmode 'tunnel mode' \ 'ipip:IPv4 in IPv4 tunnel' \ 'sit:Simple Internet Transition - IPv6 in IPv4 tunnel' \ 'gre:Generic Route Encapsulation - IPv4/IPv6 in IPv4 tunnel' subcmd_tunnelmode=("$reply[@]") local -a subcmd_files subcmd_files=(/$'[^\0]##\0'/ ':file:file name:_files') # # The ip top-level commands. First link # local -a link_set_cmds _regex_words \ link-set-commands 'link set commands' \ 'dev:specify device:$subcmd_dev' \ 'u*p:change state to up' \ 'do*wn:change state do down' \ 'ar*p:change ARP flag on device:$subcmd_onoff' \ 'mu*lticast:change MULTICAST flag on device:$subcmd_onoff' \ 'pr*omisc:set promiscious mode:$subcmd_onoff' \ 'dy*namic:change DYNAMIC flag on device:$subcmd_onoff' \ 'n*ame:change name of device:$subcmd_string' \ 'txq*ueuelen:specify length of transmit queue:$subcmd_number' \ 'txql*en:specify length of transmit queue:$subcmd_number' \ 'm*tu:specify maximum transmit unit:$subcmd_number' \ 'ad*dress:specify unicast link layer (MAC) address:$subcmd_lladdr' \ 'br*oadcast:specify broadcast link layer (MAC) address:$subcmd_lladdr' \ 'brd:specify broadcast link layer (MAC) address:$subcmd_lladdr' \ 'p*eer:specify peer link layer (MAC) address:$subcmd_lladdr' # can complete interface with no dev, subcommands can repeat... link_set_cmds=("(" $subcmd_dev "|" ")" "$reply[@]" "#" ) local -a link_show_cmds _regex_words link-show-commands 'link show commands' \ 'dev:specify device:$subcmd_dev' \ 'up:limit display to running devices' link_show_cmds=("(" $subcmd_dev "|" ")" "$reply[@]" "#" ) local -a link_cmds _regex_words \ link-commands "link command" \ 'h*elp:show help for command' \ 'se*t:change device attributes:$link_set_cmds' \ 'sh*ow:display device attributes:$link_show_cmds' link_cmds=("$reply[@]") # # addr # local -a addr_add_cmds # TODO: broadcast can take + or = _regex_words addr-add-commands "addr add/remove/change/replace commands" \ 'dev:specify device:$subcmd_dev' \ 'lo*cal:specify local IP address:$subcmd_ipaddr' \ 'p*eer:specify peer IP address (point-to-point):$subcmd_ipaddr' \ 'b*roadcast:specify broadcast IP address:$subcmd_ipaddr' \ 'la*bel:specify tag for device:$subcmd_string' \ 's*cope:specify scope for address:$subcmd_scope' # can complete IP address with no keyword addr_add_cmds=("(" $subcmd_ipaddr "|" ")" "$reply[@]" "#" ) local -a addr_del_cmds addr_del_cmds=("(" $subcmd_ipaddrs "|" "$reply[@]" ")" "#" ) local -a addr_show_cmds # TODO: broadcast can take + or = _regex_words addr-show-commands "addr show commands" \ 'dev:specify device:$subcmd_dev' \ 's*cope:specify scope for address:$subcmd_scope' \ 't*o:limit to given IP address/prefix:$subcmd_ipaddr' \ 'la*bel:list tags matching glob patter:$subcmd_string' \ 'dynamic:list addresses from stateless configuration (IPv6)' \ 'permanent:list non-dynamic addresses (IPv6)' \ 'tentative:list addresses failing duplicate address detection (IPv6)' \ 'deprecated:list deprecated addresses (IPv6)' \ 'primary:list only primary addresses' \ 'secondary:list only secondary addresses' # can complete device with no keyword addr_show_cmds=("(" $subcmd_dev "|" ")" "$reply[@]" "#" ) local -a addr_cmds _regex_words \ addr-commands "addr command" \ 'h*elp:show help for command' \ 'a*dd:add new protocol address:$addr_add_cmds' \ 'c*hange:change existing protocol address:$addr_add_cmds' \ 'r*eplace:add or update protocol address:$addr_add_cmds' \ 'd*elete:delete protocol address:$addr_del_cmds' \ 's*how:show protocol address:$addr_show_cmds' \ 'f*lush:flush protocol address:$addr_show_cmds' addr_cmds=("$reply[@]") # # neigh # local -a neigh_add_cmds _regex_words neigh-add-commands "neighbour add command" \ 't*o:add new neighbour IP address:$subcmd_ipaddr' \ 'dev:specify network device:$subcmd_dev' \ 'l*ladr:specify link layer (MAC) address or null:$subcmd_lladdr' \ 'n*ud:specify neighbour unreachability detection state:$subcmd_nud' # to-address without keyword can appear first neigh_add_cmds=( "(" $subcmd_ipaddr "|" ")" "$reply[@]" "#") local -a neigh_del_cmds _regex_words neigh-add-commands "neighbour delete command" \ 't*o:remove neighbour IP address:$subcmd_ipaddr' \ 'dev:specify network device:$subcmd_dev' neigh_del_cmds=( "(" $subcmd_ipaddr "|" ")" "$reply[@]" "#") local -a neigh_show_cmds _regex_words neigh-show-commands "neighbour show command" \ 't*o:select neighbours by prefix:$subcmd_ipaddr' \ 'dev:select neighbours by device:$subcmd_dev' \ 'u*nused:only list unused neighbours' \ 'n*ud:only list neighbours in given state:$subcmd_nud' neigh_show_cmds=( "(" $subcmd_ipaddr "|" ")" "$reply[@]" "#" ) local -a neigh_cmds _regex_words \ neigh-commands "neigh command" \ 'h*elp:show help for command' \ 'a*dd:add new neighbour entry:$neigh_add_cmds' \ 'c*hange:change existing neighbour entry:$neigh_add_cmds' \ 'r*eplace:add or change neighbour entry:$neigh_add_cmds' \ 'd*elete:delete neighbour entry:$neigh_del_cmds' \ 's*how:list neighbour entries:$neigh_show_cmds' \ 'f*lush:flush neighbour entries:$neigh_show_cmds' neigh_cmds=("$reply[@]") # # route # local -a route_add_cmds _regex_words route-add-commands "route add/change/replace command" \ 'to:route destination prefix:$subcmd_route' \ 'tos:type of service:$subcmd_tos' \ 'ds*field:type of service:$subcmd_tos' \ 'me*tric:preference value of route:$subcmd_number' \ 'pre*ference:preference value of route:$subcmd_number' \ 'ta*ble:select table by ID:$subcmd_rttable' \ 'dev:select device:$subcmd_dev' \ 'v*ia:select nexthop router:$subcmd_ipaddr' \ 'sr*c:select preferred source address:$subcmd_ipaddr' \ 're*alm:select routing realm:$subcmd_rtrealm' \ 'mtu:select maximum transport unit:$subcmd_lockmtu' \ 'w*indow:select maximal window in bytes:$subcmd_number' \ 'rtt:select round trip time estimate:$subcmd_number' \ 'rttv*ar:select initial round trip variance estimate:$subcmd_number' \ 'ss*thresh:select initial slow start threshold estimate:$subcmd_number' \ 'cw*nd:select clamp for congestion window (only if locked):$subcmd_number' \ 'in*itcwnd:select max initial cwnd in MSS:$subcmd_number' \ 'ad*vmss:select maximal segment size advertised:$subcmd_number' \ 're*ordering:select maximal reordering for path:$subcmd_number' \ 'ne*xthop:select nexthop of multipath route:$subcmd_nexthop' \ 'sc*ope:select scope of destinations:$subcmd_scope' \ 'pro*tocol:select routing protocol identifier:$subcmd_rtprotocol' \ 'onl*ink:pretend nexthop is directly attached' \ 'eq*ualize:allow packet by packet randomization' # route can appear with no "to" route_add_cmds=("(" $subcmd_route "|" ")" "$reply[@]" "#") local -a route_show_cmds _regex_words route-show-commands "route show command" \ 'to:select route via prefix:$subcmd_rtselector' \ 'tos:type of service:$subcmd_tos' \ 'ta*ble:select table by ID:$subcmd_rttable' \ 'cl*oned:list only dynamically forked routes' \ 'ca*ched:list only dynamically forked routes' \ 'f*rom:select route via source address prefix:$subcmd_rtselector' \ 'p*rotocol:select routing protocol identifier:$subcmd_rtprotocol' \ 'sc*ope:select scope of destinations:$subcmd_scope' \ 'ty*pe:route type:$subcmd_rttype' \ 'dev:select device:$subcmd_dev' \ 'v*ia:select nexthop router:$subcmd_ipaddr' \ 'sr*c:select route via source prefix:$subcmd_ipaddr' \ 'realm:select routing realm:$subcmd_rtrealm' \ 'realms:select from/to routing realms:$subcmd_rtrealms' # route selector can appear with no "to" route_show_cmds=("(" $subcmd_rtselector "|" ")" "$reply[@]" "#") local -a route_get_cmds _regex_words route-get-commands "route get commands" \ 'to:route destination:$subcmd_ipaddr' \ 'f*rom:route source:$subcmd_ipaddr' \ 'tos:select type of service:$subcmd_tos' \ 'ds*field:type of service:$subcmd_tos' \ 'iif:select input interface (device):$subcmd_dev' \ 'oif:select output interface (device):$subcmd_dev' \ 'c*onnected:use preferred address as source' route_get_cmds=("(" $subcmd_ipaddr "|" ")" "$reply[@]" "#") local -a route_cmds _regex_words \ route-commands "route command" \ 'h*elp:show help for command' \ 'a*dd:add new network route:$route_add_cmds' \ 'c*hange:change existing network route:$route_add_cmds' \ 'r*eplace:add or change network route:$route_add_cmds' \ 'd*elete:delete network route:$route_add_cmds' \ 's*how:list network routes:$route_show_cmds' \ 'f*lush:flush network routes:$route_show_cmds' \ 'g*et:get a single network route:$route_get_cmds' route_cmds=("$reply[@]") # # rule # local -a rule_add_cmds _regex_words rule-add-commands 'ip rule add/delete commands' \ 'ty*xpe:type of rule:$subcmd_ruletypes' \ 'fr*om:select source prefix:$subcmd_ipaddr' \ 'to:select destination prefix:$subcmd_ipaddr' \ 'iif:select input interface (device):$subcmd_dev' \ 'tos:select type of service:$subcmd_tos' \ 'ds*field:select type of service:$subcmd_tos' \ 'fw*mark:select fwmark:$subcmd_string' \ 'pr*iority:select unique priority for rule:$subcmd_number' \ 'ta*ble:select routing table by ID:$subcmd_rttable' \ 're*alms:select from/to routing realms:$subcmd_rtrealms' \ 'nat:select base of IP block to translate:$subcmd_ipaddr' rule_add_cmds=("(" $subcmd_ruletypes "|" ")" "$reply[@]" "#") local -a rule_cmds _regex_words \ rule-commands "rule command" \ 'h*elp:show help for command' \ 'a*dd:insert a new routing rule:$rule_add_cmds' \ 'd*elete:delete a routing rule:$rule_add_cmds' \ 'f*lush:flush rules and dump deleted rules' \ 's*how:list routing rules' rule_cmds=("$reply[@]") # # tunnel # local -a tunnel_add_cmds _regex_words tunnel-add-commands 'tunnel add/change/delete commands' \ 'na*me:select tunnel device name:$subcmd_dev' \ 'm*ode:select tunnel mode:$subcmd_tunnelmode' \ 'r*emote:select remote endpoint address:$subcmd_ipaddr' \ 'l*ocal:select local address:$subcmd_ipaddr' \ 'ttl:set fixed time to live, 1 to 255 or 0 (inherit):$subcmd_number' \ 'tos:select type of service:$subcmd_tos' \ 'ds*field:select type of service:$subcmd_tos' \ 'dev:select device to bind tunnel to:$subcmd_dev' \ 'no*pmtudisc:disable path maximum transport unit discovery' \ 'ik*ey:set input key for GRE tunnel:$subcmd_ipaddr' \ 'ok*ey:set output key for GRE tunnel:$subcmd_ipaddr' \ 'k*ey:set bidirectional key for GRE tunnel:$subcmd_ipaddr' \ 'ic*sum:enable input checksums for GRE tunnel' \ 'oc*sum:enable output checksums for GRE tunnel' \ 'c*sum:enable bidirectional checksums for GRE tunnel' \ 'is*eq:serialize input packets on GRE tunnel' \ 'os*eq:serialize output packets on GRE tunnel' \ 's*eq:serialize packets bidirectionally on GRE tunnel' # name is default... we always complete it as an interface, # although that's not really right for "add". tunnel_add_cmds=("$reply[@]" "#") local -a tunnel_cmds _regex_words \ tunnel-commands "tunnel command" \ 'h*elp:show help for command' \ 'a*dd:add a new IP tunnel:$tunnel_add_cmds' \ 'c*hange:change an existing IP tunnel:$tunnel_add_cmds' \ 'd*elete:destroy an IP tunnel:$tunnel_add_cmds' \ 's*how:list IP tunnels' tunnel_cmds=("$reply[@]") # # maddr # local -a maddr_add_cmds _regex_words maddr-add-commands "maddr add/delete command" \ 'a*ddress:select link layer (MAC) address:$subcmd_lladdr' \ 'dev:select device to bind multicast address to:$subcmd_dev' maddr_add_cmds=("(" $subcmd_ipaddr "|" ")" "$reply[@]" "#") local -a maddr_show_cmds _regex_words maddr-show-commands 'maddr show command' \ 'dev:select device with multicast address(es):$subcmd_dev' # device is default argument but if given the "dev" is useless maddr_show_cmds=("(" $subcmd_dev "|" "$reply[@]" ")") local -a maddr_cmds _regex_words \ maddr-commands "maddr command" \ 'h*elp:show help for command' \ 'a*dd:add multicast address:$maddr_add_cmds' \ 'd*elete:delete multicast address:$maddr_add_cmds' \ 's*how:list multicast addresses:$maddr_show_cmds' maddr_cmds=("$reply[@]") # # mroute # local -a mroute_show_cmds _regex_words mroute-show-comnands "mroute show command" \ 'to:select destination prefix:$subcmd_ipaddr' \ 'iif:select input interface (device):$subcmd_dev' \ 'from:select source prefix:$subcmd_ipaddr' mroute_show_cmds=("(" $subcmd_ipaddr "|" ")" "$reply[@]") local -a mroute_cmds _regex_words \ mroute-commands "mroute command" \ 'h*elp:show help for command' \ 's*how:list multicast routing cache entries:$mroute_show_cmds' mroute_cmds=("$reply[@]") # # monitor # local -a monitor_cmds _regex_words \ monitor-commands "monitor command" \ 'h*elp:show help for command' \ 'all:monitor all changes' \ 'link:monitor changes to links' \ 'address:monitor changes to addresses' \ 'route:monitor changes to routes' \ 'file:read rtmon-generated log:$subcmd_files' monitor_cmds=("$reply[@]") # # Global argument handling # # Arguments to _regex_arguments, built up in array $args. local -a args reply args=( # Command word. Don't care what that is. /$'[^\0]#\0'/ ) _regex_words options "ip options" \ '-s*tatistics:output statistics' \ '-f*amily:select protocol family:$subcmd_family' \ '-4:IPv4' \ '-6:IPv6' \ '-0:link protocol, no networking' \ '-o*neline:output one record per line' \ '-r*esolve:use system resolver for DNS names' args+=("$reply[@]" "#") _regex_words \ commands "ip command" \ 'l*ink:configure network device:$link_cmds' \ 'a*ddr:manage protocol address:$addr_cmds' \ 'r*oute:manage routing table:$route_cmds' \ 'ru*le:manage routing policy database:$rule_cmds' \ 'n*eigh:manage neighbour/ARP tables:$neigh_cmds' \ 't*unnel:configure tunnel:$tunnel_cmds' \ 'm*addr:manage multicast addresses:$maddr_cmds' \ 'mr*oute:manage multicast routing cache:$mroute_cmds' \ 'mo*nitor:monitor state:$monitor_cmds' args+=("$reply[@]") _regex_arguments _ip "${args[@]}" _ip "$@" PK[l%3^^functions/_echotinuW+A#compdef echoti local expl _wanted arguments expl 'terminal capability' compadd -k terminfo PK[i8^functions/_tilde_filesnuW+A#autoload # Complete files and expand tilde expansions in it. if [[ ( -o magicequalsubst && "$IPREFIX" = *\= ) || $argv[(I)-W*] -ne 0 ]]; then _files "$@" return fi case "$PREFIX" in \~/*) IPREFIX="${IPREFIX}${HOME}/" PREFIX="${PREFIX[3,-1]}" _files "$@" -W "${HOME}" ;; \~*/*) local user="${PREFIX[2,-1]%%/*}" if (( $+userdirs[$user] )); then user="$userdirs[$user]" elif (( $+nameddirs[$user] )); then user="$nameddirs[$user]" else _message "unknown user \`$user'" return 1 fi IPREFIX="${IPREFIX}${user%/}/" PREFIX="${PREFIX#*/}" _files "$@" -W "$user" ;; \~*) compset -P '?' _users "$@" ;; *) _files "$@" ;; esac PK[lje~~functions/_calendarnuW+A#compdef calendar if [[ $+functions[calendar] -eq 1 && -z $precommands[(r)command] ]]; then # The shell function is loaded, and we're not instructed to # use an external command, so complete that. _arguments \ '-a[show all calendar items]' \ '-b[brief, display first line only]' \ '-d[move events to done file]' \ '-D[never move events to done file]' \ '-r[show all remaining items from start or now]' \ '-s[use sched to schedule a warning]' \ '-v[verbose]' \ '-B[select number of lines to display]:lines: ' \ '-C[select calendar file]:calendar file:_path_files' \ '-n[select max number of events]:max number of events: ' \ '-S[select show programme]:show programme:_command_names' \ '1:date/time: ' \ '(-r)2:end date/time: ' else # This is only one particular version of calendar. # Some variant of BSD, I think. _arguments \ '-a[process files of all users]' \ '-A[print today and the following num days]:number of days:' \ '-b[enforce special KOI8 date calculation mode]' \ '-B[print today and the previous num days]:number of days:' \ '-f[use file as the default calendar]:calendar file:_files' \ '-l[print today and the following num days]:number of days:' \ '-w[print today and the following num days only if today is Friday]:number of days:' \ '-t[act as though today is the date specified]:date:' fi PK[A$functions/_dvinuW+A#compdef dvips dvibook dviconcat dvicopy dvidvi dviselect dvitodvi dvitype local expl args args=( '-i[specify input file]:input DVI file:_files -g "*.(dvi|DVI)(-.)"' \ '-o[specify output file]:output DVI file:_files -g "*.(dvi|DVI)(-.)"' \ ':input DVI file:_files -g "*.(dvi|DVI)(-.)"' \ ':output DVI file:_files -g "*.(dvi|DVI)(-.)"' ) case "$service" in dvips) _arguments \ '-a[make three passes]' \ '(-B)-A[print only odd numbered pages]' \ '(-A)-B[print only even numbered pages]' \ '(-c -C)-b[select number of copies (duplicating body)]:number of copies' \ '(-b -C)-c[select number of copies]:number of copies' \ '(-b -c)-C[select number of copies (collated)]:number of copies' \ '-d[set debug flags]:debug flags' \ '(-X -Y)-D[set resolution]:resolution in dots per inch' \ '-e[set maximum character offset]:maximum character offset' \ '-E[generate EPSF file]' \ '(-o)-f[write to stdout]' \ '-F[append control-D]' \ '-G[shift low chars to higher position]' \ '-h[specify additional header file]:postscript header file:_files -g "*.(#i)(ps|eps)(-.)"' \ '-i[one file per section]' \ '-j[download fonts partially]' \ '-k[print crop marks]' \ '-K[include postscript comments]' \ '(-pp)-l[specify last page to print]:number of last page' \ '-m[specify manual feed for printer]' \ '-M[no automatic font generation]' \ '(-pp)-n[specify maximum number of pages to print]:maximum number of pages' \ '-N[turn off structured comments]' \ '(-f)-o[specify output file name]:output file name:_files -g "*.(#i)(ps|eps)(-.)"' \ '-O[specify offset of origin]:offset of origin (,)' \ '(-p -l -n)-pp[specify which pages to print]:list of pages or ranges to print:' \ '(-pp)-p[specify first page to print]:number of first page' \ '-P+[specify printer]:printer name' \ '-q[quiet operation]' \ '-r[reverse order of pages]' \ '-R[run securely]' \ '-s[enclose output in save/restore pair]' \ '-S[set maximum number of pages per section]:maximum number of pages per section' \ '(-T)*-t[specify paper type]:paper type:(letter legal ledger a4 a3 landscape)' \ '(-t)-T[set paper size]:paper size (,)' \ '-u:PS mapfile:' \ '-U[disable string param trick]' \ '-v[print version number and quit]' \ '-V[send downloadable PS fonts as PK]' \ '-x[set magnification ratio]:magnification ratio (per mille)' \ '(-D)-X[set horizontal resolution]:horizontal resolution' \ '-y[multiply by dvi magnification]' \ '(-D)-Y[set vertical resolution]:vertical resolution' \ '-z[hyper PS]' \ '-Z[compress bitmapped fonts]' \ ':input file:_files -g "*.(dvi|DVI)(-.)"' ;; dvibook) _arguments -s \ '-q[quiet operation]' \ '-s-[specify signature size]:signature size' \ "$args[@]" ;; dviconcat) _arguments \ '-m[specify magnification]:magnification factor' \ '-o[specify output file]:output DVI file:_files -g "*.(dvi|DVI)(-.)"' \ '*:input DVI file:_files -g "*.(dvi|DVI)(-.)"' ;; dvidvi) _arguments -s \ '-q[quiet operation]' \ '-r[reverse order of pages]' \ '(-i -x)-f[select first page]:number of first page:' \ '(-i -x)-l[select last page]:number of last page:' \ '(-i -x)-n[select number of pages]:maximum number of pages:' \ '(-f -l -n)-i[specify included pages]:list of included pages:' \ '(-f -l -n)-x[specify excluded pages]:list of excluded pages:' \ ':input DVI file:_files -g "*.(dvi|DVI)(-.)"' \ ':output DVI file:_files -g "*.(dvi|DVI)(-.)"' ;; dviselect) _arguments -s \ '-s[silent operation]' \ ':list of pages:' \ "$args[@]" ;; dvitodvi) _arguments -s \ '-q[quiet operation]' \ '-w-[set w dimension specifier]:width for dimension specifier:' \ '-h-[set h dimension specifier]:height for dimension specifier:' \ ':page specifications:' \ "$args[@]" ;; *) _description files expl 'DVI file' _files "$expl[@]" -g '*.(dvi|DVI)(-.)' ;; esac PK[Xql$functions/narrow-to-region-invisiblenuW+A# As narrow-to-region, but replaces the text outside the editable region # with `...' if it was non-empty. Can be used directly as a widget. autoload -Uz narrow-to-region narrow-to-region -p '...' -P '...' -n PK[nTfunctions/_global_tagsnuW+A#autoload local expl tags tags=( $(_call_program global-tags global --completion $PREFIX 2>/dev/null) ) _wanted global-tags expl 'tag' compadd -M 'm:{a-zA-Z}={A-Za-z}' -a "$@" - tags PK[Afunctions/_sccsnuW+A#compdef sccs admin cdc comb delta get help prs prt rmdel sact sccsdiff unget val what (( $+functions[_sccs_files] )) || _sccs_files() { local dir expl ret=1 pref=$PREFIX ipref=$IPREFIX dir="${(M)PREFIX##*/}$finalpath" [[ $~dir = (.|..|)/* ]] || dir="${PROJECTDIR:-~+}/$dir" compset -P "*/" _wanted file expl file compadd "$@" - $~dir/s.*(N.:t:s/s.//) && ret=0 PREFIX="$pref" IPREFIX="$ipref" _wanted sccs-files expl 'sccs file' _files -W ${PROJECTDIR:-~+} \ -g 's.*(-.)' && ret=0 return ret } local curcontext="$curcontext" state line ret=1 typeset -A opt_args local subcmds ropt copt sfiles finalpath subcmds=( 'admin:modify the flags or checksum of an sccs history file' 'cdc:annotate the commentary of an sccs delta' 'check:check for files currently being edited' 'clean:remove files that can be retrieved from sccs history' 'comb:generate scripts to combine deltas' 'create:create (initialize) history files' 'deledit:check file in and straight out again' 'delget:check file in and maintain read-only copy' 'delta:check in changes' 'diffs:compare working copy with version in sccs history' 'edit:retrieve file for editing (check out)' "enter:like create, but omits the final 'sccs get'" 'fix:revise a (leaf) delta' 'get:retrieve a version from the sccs history' 'help:get information on sccs commands and error messages' {info,tell}':list files being edited' 'print:print history of specified files' 'prs:display delta table for an sccs file' 'prt:display the delta table, but omit the MR field' 'rmdel:remove specified delta from history file' 'sact:show editing activity status of an sccs file' 'sccsdiff:compare two versions from sccs history' {unedit,unget}':undo check out' 'val:validate history file' 'what:display any ID keyword strings in a file' ) ropt='-r+[specify sccs delta id]:sccs delta id' copt='-c+[specify date]:date-stamp' sfiles=':file:_files -g "s.*(-.)"' if [[ $service = sccs ]]; then _arguments -C -A "-*" \ '-r[run with real and not effective user ID]' \ '-d+[specify root prefix]:root prefix:_directories' \ '-p+[specify subdirectory of history file]:path to history file:_directories' \ '*::command:->subcmd' && ret=0 if (( CURRENT == 1 )); then _describe -t commands 'sccs command' subcmds && ret=0 fi (( ret )) || return 0 service="$words[1]" sfiles=':file:_sccs_files' curcontext="${curcontext%:*}-$service:" fi finalpath="${opt_args[-p]:-SCCS}" case $service in admin) _arguments "$ropt" "$sfiles" \ '-b[force encoding of binary data]' \ '-h[check structure of s.file]' \ '-n[create a new history file]' \ '-z[recompute file checksum]' \ '-a+[add access for a user or group]:user or group:_users' \ '-e+[erase access for a user or group]:user or group:_users' \ '-d+[delete flag from file]:flag' \ '-f+[set specified flag]:flag' \ '-i+[initialise history from specified file]:file:_files' \ '-m+[insert specified MR numbers into commentary]' \ '-t+[insert descriptive text from specified file]:file:_files' \ '-y+[specify comment for initial delta]' ;; cdc) _arguments "$ropt" "$sfiles" \ '-m+[specify MR numbers to add/delete in delta comment]' \ '-y+[specify the comment]:comment' \ ;; check|info|tell) _arguments "$sfiles" \ '-b[ignore branches]' \ '(-U)-u+[restrict to files being modified by specified user]::user:_users' \ '(-u)-U[restrict to files being modified by current user]' ;; clean) _arguments '-b[ignore branches]' ;; comb) _arguments "$sfiles" \ '-o[access reconstructed file at delta to be created]' \ '-s[generate script that will produce a report]' \ '-p+[specify SID of oldest delta to preserve]:sccs delta id' '-c+[specify list of deltas to preserve]:sccs delta list' ;; sact|print) _sccs_files;; create|enter) _files;; deledit|delget|delta) _arguments '-s[silent]' '-y+[specify delta commentary]:comment' ;; diffs) _diff_options diff "$sfiles" "$ropt" "$copt" \ '-C[output a context diff]' ;; edit|get) _arguments "$sfiles" "$ropt" "$copt" \ '-e[retrieve for editing]' \ '-k[retrieve writable copy without checking out]' \ '-m[precede each line with the delta in which it was added]' \ '-p[produce retrieved version on standard output]' \ '-s[silent]' ;; fix) _arguments "$ropt" "$sfiles";; help) [[ $PREFIX$SUFFIX = [0-9]# ]] && _message -e message-codes "sccs message code" subcmds+=( "stuck:help on help" ) _describe -t commands 'sccs command' subcmds ;; prs) _arguments "$sfiles" "$ropt" "$copt" \ '-a[include all deltas including those marked removed]' \ '-e[display delta info for all deltas earlier than that specified]' \ '-l[display delta info for all deltas later than that specified]' \ '-d+[specify format of report]:data spec' ;; prt) _arguments "$sfiles" "$copt" \ '-a[include all deltas including those marked removed]' \ '-b[print the body of the s.file]' \ '-d[print delta table entries]' \ '(-d -i -u -f -t)-e[everything - imply other options]' \ '-i[print serial numbers of included, excluded and ignored deltas]' \ '-s[print first line only of delta table entries]' \ '-t[print descriptive text held in s.file]' \ '-u[print usernames of users allowed to make deltas]' \ '-r+[exclude delta entries newer than date]:date-time' \ '-y+[exclude delta entries prior to sid]' ;; rmdel) _arguments "$ropt" "$sfiles";; sccsdiff) _diff_options diff "$ropt" "$sfiles";; unedit|unget) _arguments "$sfiles" "$ropt" \ '-s[silent]' \ '-n[retain the retrieved version]' ;; val) _arguments "$sfiles" "$ropt" \ '-s[silent]' \ '-m+[compare specified name with the ID keyword in the s.file]:name' \ '-y+[compare specified type with the ID keyword]:type' ;; what) _arguments '-s[stop after first occurrence]' '*:file:_files';; *) _message "unknown sccs command: $service";; esac PK[+gfunctions/_fusermountnuW+A#compdef fusermount local expl context state line typeset -A opt_args _arguments \ '-h[display help information]' \ '-V[display version information]' \ '-o[specify mount options]:mount options:_fuse_values "mount options"' \ '-u[unmount a fuse mount]' \ '-z[unmount lazily (work even when if the resource is still busy)]' \ '-q[suppress nonessential output]' \ ':mount point:->mountpoint' && return 0 typeset -a mtpts case "$state" in (mountpoint) if [[ $+opt_args[-u] -eq 0 ]]; then _files -/ else mtpts=(${${${"${(f)$(< /etc/mtab)}"}#* }%% *}) _canonical_paths mounted 'mounted filesystem' $mtpts fi ;; esac PK[!7 functions/_wajignuW+A#compdef wajig local curcontext="$curcontext" state line cmds argno ret=1 _arguments -C -s \ '(- 1 *)'{-h,--help}'[print usage message]' \ '(- 1 *)--version[display version information]' \ '(-q --quiet)'{-q,--quiet}'[do everything quietly]' \ '(-s --simulate)'{-s,--simulate}"[trace but don't execute]" \ '(-t --teaching)'{-t,--teaching}'[trace the sequence of commands performed]' \ '(-v --verbose)'{-v,--verbose}'[increase (or set) the level of verbosity]' \ '1: :->cmds' \ '*: :->args' && ret=0 case $state in cmds) cmds=( ${${(M)${(f)"$(wajig commands 2>/dev/null)"}:# [^-]*}/(#b) ([^ ]#) #(*)/$match[1]:$match[2]:l} ) _describe -t commands 'wajig command' cmds && ret=0 ;; args) (( argno = $#line-1 )) case ${line[1]:gs/-/} in autoalts|autoalternatives|updatealts) ((argno==1)) && _wanted alternatives expl alternative \ _files -W /var/lib/dpkg/alternatives && ret=0 ;; listfiles|repackage|package) ((argno==1)) || break ;& hold|large|readme|reconfigure|reinstall|remove|removedepend|showremove|size?|upgrade) _wanted package expl 'package' _deb_packages installed && ret=0 ;; purgedepend) ((argno==1)) && _wanted package expl 'package' _deb_packages xinstalled && ret=0 ;; purge) _wanted package expl 'package' _deb_packages xinstalled && ret=0 ;; autoinstall|force|showinstall|installr|recommended|installrs|installs|suggested|install/*) _wanted package expl 'package' _deb_packages uninstalled && ret=0 ;; install) _alternative \ 'packages:package:_deb_packages uninstalled' \ 'files:package file:_files -g "*.deb(-.)"' && ret=0 ;; bug|bugs|dependents|geturl) ((argno==1)) || break ;& available|build|builddepend|changelog|describe|whatis|detail|details|show|news|policy|download|source|status|recdownload) _wanted package expl 'package' _deb_packages available && ret=0 ;; unhold) _wanted package expl 'package' _deb_packages held && ret=0 ;; filedownload|downloadfile|fileinstall|installfile|fileremove|removefile|indfile) ((argno==1)) && _files && ret=0 ;; whichpkg) _files ;; rpminstall|rpmtodeb|rpm2deb) ((argno==1)) && _files -g '*.rpm(-.)' && ret=0 ;; searchapt) _wanted distributions expl distribution \ compadd stable testing unstable && ret=0 ;; reload|restart|start|stop) ((argno==1)) && _services && ret=0 ;; esac ;; esac return ret PK[vfunctions/_tcpsysnuW+A#compdef tcp_open local context line expl nm=$compstate[nmatches] local -a state argargs sesslist local -A opt_args case $service in (tcp_open) argargs=( '(-a -f -l)-s[open session(s)]' '(-a -f -s)-l[open list of sessions]' '(-f -s -l)-a[open session for accept on fd]:fd:->fd' '(-a -s -l)-f[open session for accept on fd]:fd:->fd' '-q[quiet mode]' '-z[no zle handler]' ) if [[ -n $words[(R)-(a|f)*] ]]; then argargs+=(':session:->session') elif [[ -n $words[(R)-(l|s)*] ]]; then argargs+=('*:session:->session') else argargs+=(':host:->host' ':port:->port' '*:session:->session') fi _arguments -C $argargs ;; esac while (( $#state )); do case "$state[1]" in (host) _hosts ;; (port) _ports ;; (sessionlist) compset -P '*,' ;& (session) sesslist=(${${${(f)"$(<~/.ztcp_sessions)"}:#[[:space:]]#\#*}/ /:}) _describe -t sessions 'TCP session' sesslist && return ;; esac shift state done PK[9Dާ functions/_path_commandsnuW+A#autoload (( $+functions[_path_commands_caching_policy] )) || _path_commands_caching_policy() { local file local -a oldp dbfiles # rebuild if cache is more than a week old oldp=( "$1"(Nmw+1) ) (( $#oldp )) && return 0 dbfiles=(/usr/share/man/index.(bt|db|dir|pag)(N) \ /usr/man/index.(bt|db|dir|pag)(N) \ /var/cache/man/index.(bt|db|dir|pag)(N) \ /var/catman/index.(bt|db|dir|pag)(N) \ /usr/share/man/*/whatis(N)) for file in $dbfiles; do [[ $file -nt $1 ]] && return 0 done return 1 } _call_whatis() { case "$(whatis --version)" in (whatis from *) local -A args zparseopts -D -A args s: r: apropos "${args[-r]:-"$@"}" | fgrep "($args[-s]" ;; (*) whatis "$@";; esac } _path_commands() { local need_desc expl ret=1 if zstyle -t ":completion:${curcontext}:" extra-verbose; then local update_policy first if [[ $+_command_descriptions -eq 0 ]]; then first=yes typeset -A -g _command_descriptions fi zstyle -s ":completion:${curcontext}:" cache-policy update_policy [[ -z "$update_policy" ]] && zstyle ":completion:${curcontext}:" \ cache-policy _path_commands_caching_policy if ( [[ -n $first ]] || _cache_invalid command-descriptions ) && \ ! _retrieve_cache command-descriptions; then local line for line in "${(f)$(_call_program command-descriptions _call_whatis -s 1 -r .\\\*\; _call_whatis -s 6 -r .\\\* 2>/dev/null)}"; do [[ -n ${line:#(#b)([^ ]#) #\([^ ]#\)( #\[[^ ]#\]|)[ -]#(*)} ]] && continue; [[ -z $match[1] || -z $match[3] || -z ${${match[1]}:#*:*} ]] && continue; _command_descriptions[$match[1]]=$match[3] done _store_cache command-descriptions _command_descriptions fi (( $#_command_descriptions )) && need_desc=yes fi if [[ -n $need_desc ]]; then typeset -a dcmds descs cmds matches local desc cmd sep compadd "$@" -O matches -k commands for cmd in $matches; do desc=$_command_descriptions[$cmd] if [[ -z $desc ]]; then cmds+=$cmd else dcmds+=$cmd descs+="$cmd:$desc" fi done zstyle -s ":completion:${curcontext}:" list-separator sep || sep=-- zformat -a descs " $sep " $descs descs=("${(@r:COLUMNS-1:)descs}") _wanted commands expl 'external command' \ compadd "$@" -ld descs -a dcmds && ret=0 _wanted commands expl 'external command' compadd "$@" -a cmds && ret=0 else _wanted commands expl 'external command' compadd "$@" -k commands && ret=0 fi return $ret } _path_commands "$@" PK[functions/zstyle+nuW+A# This makes defining styles a bit simpler by using a single `+' as a # special token that allows one to append a context name to the # previously used context name. Like this: # # zstyle+ ':foo:bar' style1 value1 \ # + ':baz' style2 value2 \ # + ':frob' style3 value3 # # This defines style1 with value1 for the context :foo:bar as usual. # But it also defines styles2 with value2 for the context :foo:bar:baz # and style3 with value3 for :foo:bar:frob. # Of course, any of the sub-contexts after the plus signs may be # empty strings to re-use the previous context unchanged. # # If you don't want to change all your calls to `zstyle' to use # `zstyle+' you can use an alias `alias zstyle=zstyle+' and make sure # the completion functions are autoloaded without alias expansion (the # -U option to the autoload builtin). The completion system normally # loads its functions with without alias expansion. case "$1" in -*) zstyle "$@";; *) setopt localoptions noksharrays integer i local context="$1" 1='' for ((i=2; $#; ++i)); do if [[ $i -gt $# || "$argv[i]" == '+' ]]; then zstyle "$context${(@)argv[1,i-1]}" shift "i > $# ? $# : i" # Stupid shift error on i > $# i=1 fi done;; esac PK[c  functions/_zftpnuW+A#compdef -p zf* # Completion for zftp builtin and zf* functions. The functions # zfcd_match and zfget_match (also used for old-style completion) # need to be installed for remote file and directory completion to work. # emulate -L zsh # Don't try any more completion after this. _compskip=all local subcom expl curcontext="${curcontext}" if [[ $service = zftp ]]; then if [[ $CURRENT -eq 2 ]]; then _wanted commands expl sub-command \ compadd open params user login type ascii binary mode put \ putat get getat append appendat ls dir local remote mkdir rmdir \ session rmsession return fi subcom=$words[2] curcontext="${curcontext/:zftp:/:zftp-${words[2]}:}" else subcom=$service fi case $subcom in *(cd|ls|dir)) # complete remote directories [[ -z ${functions[zfcd_match]} ]] && autoload -Uz zfcd_match _tags directories && zfcd_match $PREFIX $SUFFIX ;; *(get(|at)|gcp|delete|remote)) # complete remote files [[ -z ${functions[zfget_match]} ]] && autoload -Uz zfget_match _tags files && zfget_match $PREFIX $SUFFIX ;; *(put(|at)|pcp)) # complete local files _files ;; *(open|anon|params)) # complete hosts: should do cleverer stuff with user names _hosts ;; *(goto|mark)) # complete bookmarks. First decide if ncftp mode is go. if [[ $words[2] = -*n* ]]; then if [[ -f ~/.ncftp/bookmarks ]]; then _wanted bookmarks expl bookmark \ compadd - $(awk -F, 'NR > 2 { print $1 }' ~/.ncftp/bookmarks) fi else if [[ -f ${ZFTP_BMFILE:=${ZDOTDIR:-$HOME}/.zfbkmarks} ]]; then _wanted bookmarks expl bookmark \ compadd - $(awk '{print $1}' $ZFTP_BMFILE) fi fi ;; *session) # complete sessions, excluding the current one. _wanted sessions expl 'another FTP session' \ compadd - ${$(zftp session):#$ZFTP_SESSION} ;; *transfer) # complete arguments like sess1:file1 sess2:file2 if [[ $PREFIX = *:* ]]; then # complete file in the given session _tags files || return 1 local sess=${PREFIX%%:*} oldsess=$ZFTP_SESSION compset -p $(( $#sess + 1 )) [[ -n $sess ]] && zftp session $sess zfget_match $PREFIX $SUFFIX [[ -n $sess && -n $oldsess ]] && zftp session $oldsess else # note here we can complete the current session _wanted sessions expl 'FTP session' compadd -S : - $(zftp session) fi ;; *) # dunno... try ordinary completion after all. _compskip='' return 1 ;; esac PK[functions/VCS_INFO_adjustnuW+A## vim:ft=zsh ## Written by Frank Terbeck ## Distributed under the same BSD-ish license as zsh itself. setopt localoptions NO_shwordsplit [[ -n ${vcs_comm[overwrite_name]} ]] && vcs=${vcs_comm[overwrite_name]} return 0 PK[:E[ functions/vcs_infonuW+A## vim:ft=zsh:foldmethod=marker ## ## vcs_info - provide version control information ## ## Written by Frank Terbeck ## ## This file and all corresponding files in Functions/VCS_Info/ are ## distributed under the same BSD-ish license as zsh itself. ## setopt localoptions noksharrays extendedglob NO_shwordsplit local file func sys local -a static_functions static_functions=( VCS_INFO_adjust VCS_INFO_bydir_detect VCS_INFO_check_com VCS_INFO_formats VCS_INFO_get_cmd VCS_INFO_hook VCS_INFO_maxexports VCS_INFO_nvcsformats VCS_INFO_quilt VCS_INFO_realpath VCS_INFO_reposub VCS_INFO_set vcs_info_lastmsg vcs_info_printsys vcs_info_setsys ) for func in ${static_functions} ; do autoload -Uz ${func} done VCS_INFO_set --nvcs '-preinit-' vcs_info_setsys # and now, finally create the real vcs_info function vcs_info () { emulate -L zsh setopt extendedglob NO_warn_create_global [[ -r . ]] || return 0 local pat local -i found retval local -a enabled disabled dps local -x usercontext vcs rrn quiltmode LC_MESSAGES local -ix maxexports local -ax msgs local -Ax vcs_comm hook_com backend_misc user_data LC_MESSAGES=C if [[ -n ${LC_ALL} ]]; then local -x LANG LANG=${LC_ALL} local -x LC_ALL fi vcs='-init-'; rrn='-all-'; quiltmode='addon' usercontext=${1:-default} VCS_INFO_hook "start-up" retval=$? if (( retval == 1 )); then return 0 elif (( retval == 2 )); then VCS_INFO_set --nvcs return 0 fi zstyle -a ":vcs_info:${vcs}:${usercontext}:${rrn}" "enable" enabled (( ${#enabled} == 0 )) && enabled=( all ) if [[ -n ${(M)enabled:#(#i)none} ]] ; then [[ -n ${vcs_info_msg_0_} ]] && VCS_INFO_set --clear return 0 fi if [[ -n ${(M)enabled:#(#i)all} ]] ; then enabled=( ${VCS_INFO_backends} ) zstyle -a ":vcs_info:${vcs}:${usercontext}:${rrn}" "disable" disabled fi zstyle -a ":vcs_info:${vcs}:${usercontext}:${rrn}" "disable-patterns" dps for pat in ${dps} ; do if [[ ${PWD} == ${~pat} ]] ; then [[ -n ${vcs_info_msg_0_} ]] && VCS_INFO_set --clear return 0 fi done VCS_INFO_maxexports (( found = 0 )) for vcs in ${enabled} ; do [[ -n ${(M)disabled:#${vcs}} ]] && continue if (( ${+functions[VCS_INFO_detect_${vcs}]} == 0 )) ; then printf 'vcs_info: configured unknown backend: '\''%s'\''\n' ${vcs} printf 'vcs_info: use '\''vcs_info_printsys'\'' to find supported systems.\n' continue fi vcs_comm=() VCS_INFO_get_cmd VCS_INFO_detect_${vcs} && (( found = 1 )) && break done (( found == 0 )) && { vcs='-quilt-'; quiltmode='standalone' VCS_INFO_quilt standalone || VCS_INFO_set --nvcs return 0 } VCS_INFO_hook "pre-get-data" retval=$? if (( retval == 1 )); then return 0 elif (( retval == 2 )); then VCS_INFO_set --nvcs return 0 fi VCS_INFO_get_data_${vcs} || { VCS_INFO_set --nvcs return 1 } VCS_INFO_set return 0 } vcs_info "$@" PK[n!@functions/_signalsnuW+A#autoload # Options (only in separate words): # # -a use all signals (even the pseudo-signals) # -p needs a `-' prefix # -s SIG prefix allowed # # A `-' or `--' as the first argument is ignored. local expl last minus pre sigs zparseopts -D -K -E 'p=minus' 'a=last' 's=pre' if [[ -z "$last" ]]; then last=-3 else last=-1 fi [[ -n "$minus" ]] && minus='-' [[ "$1" = -(|-) ]] && shift if [[ -z "$minus" ]] || ! zstyle -T ":completion:${curcontext}:signals" prefix-needed || [[ -prefix -* ]]; then local disp tmp if zstyle -t ":completion:${curcontext}:signals" prefix-hidden; then tmp=( "${(@)signals[1,last]}" ) disp=(-d tmp) else disp=() fi if [[ -n "$pre" && $PREFIX = ${minus}S* ]]; then sigs=( "${minus}SIG${(@)^signals[1,last]}" ) (( $#disp )) && tmp=( "$tmp[@]" "${(@)signals[1,last]}" ) else sigs=() fi _wanted signals expl signal \ compadd "$@" "$disp[@]" -M 'm:{a-z}={A-Z}' - \ "${minus}${(@)^signals[1,last]}" "$sigs[@]" fi PK[<functions/prompt_elite_setupnuW+A# Created by KrON from windowmaker on IRC # Changed by Spidey 08/06 # Converted to zsh prompt theme by prompt_elite_help () { cat < []] The default colors are red and blue respectively. This theme is intended for use with a black background. Recommended fonts for this theme: either UTF-8, or nexus or vga or similar. If you don't have any of these, the 8-bit characters will probably look stupid. EOH } prompt_elite_setup () { local text=${1:-'red'} local punctuation=${2:-'blue'} if [[ $1 == '8bit' ]]; then shift local -A schars autoload -Uz prompt_special_chars prompt_special_chars fi PS1="%F{$text}$schars[332]$schars[304]%F{$punctuation}(%F{$text}%n%F{$punctuation}@%F{$text}%m%F{$punctuation})%F{$text}-%F{$punctuation}(%F{$text}%D{%I:%M%P}%F{$punctuation}-:-%F{$text}%D{%m}%F{$punctuation}%F{$text}/%D{%d}%F{$punctuation})%F{$text}$schars[304]-%F{$punctuation}$schars[371]%F{$text}-$schars[371]$schars[371]%F{$punctuation}$schars[372]$prompt_newline%F{$text}$schars[300]$schars[304]%F{$punctuation}(%F{$text}%1~%F{$punctuation})%F{$text}$schars[304]$schars[371]%F{$punctuation}$schars[372]%f" PS2="> " prompt_opts=(cr subst percent) } prompt_elite_preview () { if (( ! $#* )); then prompt_preview_theme elite print prompt_preview_theme elite green yellow else prompt_preview_theme elite "$@" fi } prompt_elite_setup "$@" PK[pÛЎ functions/_elinksnuW+A#compdef elinks # ELinks 0.12pre5 local curcontext="$curcontext" state line ret=1 typeset -A opt_args _arguments -C -A '-*' \ '*-anonymous[restrict to anonymous mode]::boolean:(0 1)' \ '*-auto-submit[autosubmit first form]::boolean:(0 1)' \ '*-base-session[clone internal session with given ID]:ID number:' \ '*-config-dir[name of directory with configuration file]:configuration directory:_files -/' \ '(- 1)-config-dump[print default configuration file to stdout]' \ '*-config-file[name of configuration file]:configuration file:_files' \ '*-default-mime-type[MIME type assumed for unknown document types]:MIME type:_mime_types' \ '*-default-keys[ignore user-defined keybindings]::boolean:(0 1)' \ '*-dump[print formatted versions of given URLs to stdout]::boolean:(0 1)' \ '*-dump-charset[codepage to use with -dump]:codepage:' \ '-dump-color-mode[color mode used with -dump]:color mode:((-1\:standard\ dump\ mode 0\:mono\ mode 1\:16\ color\ mode 2\:88\ color\ mode 3\:256\ color\ mode 4\:true\ color\ mode))' \ '*-dump-width[width of document formatted with -dump]:width:' \ '*-eval[evaluate configuration file directive]:configuration option:' \ '*-force-html[interpret documents of unknown types as HTML]' \ '(- 1)-'{\?,h,help}'[print usage help and exit]' \ '*-localhost[only permit local connections]::boolean:(0 1)' \ '(- 1)-long-help[print detailed usage help and exit]' \ '(- 1)-config-help[print help for configuration options]' \ '(- 1)-lookup[look up specified host]:host:_hosts' \ '*-no-connect[run as separate instance]::boolean:(0 1)' \ "*-no-home[don't use files in ~/.elinks]::boolean:(0 1)" \ '*-no-numbering[disable link numbering in dump output]::boolean:(0 1)' \ '*-no-references[disable printing of link references in dump output]::boolean:(0 1)' \ '*-remote[control an already running ELinks]:*:command:->remote' \ '*-session-ring[connect to session ring with given ID]:ID number:' \ '*-source[print the source of given URLs to stdout]::boolean:(0 1)' \ '(1)*-stdin[read document from stdin]::boolean:(0 1)' \ '*-touch-files[touch files in ~/.elinks when running with -no-connect/-session-ring]::boolean:(0 1)' \ '*-verbose[verbose level]:verbosity level:((0\:serious\ errors 1\:serious\ errors\ and\ warnings 2\:all\ messages ))' \ '(- 1)-version[print version information and exit]' \ '1:URL:->url' && ret=0 if [[ "$state" = url ]]; then local -a bookmarks local file=${opt_args[-config-dir]:-${ELINKS_CONFDIR:-~/.elinks}}/bookmarks if [[ -s $file ]]; then bookmarks=( ${${${(f)"$(< $file)"}#* }%% *} ) fi _alternative \ 'files:file:_files' \ 'bookmarks:bookmark:compadd -a bookmarks' \ 'urls:URL:_urls' && ret=0 elif [[ "$state" = remote ]]; then local -a commands commands=( ping openURL addBookmark infoBox xfeDoCommand ) _alternative \ 'commands:command:compadd -a commands' \ 'urls:URL:_urls' && ret=0 fi return ret PK[<!functions/modify-current-argumentnuW+A# Take an expression suitable for interpolation in double quotes that # performs a replacement on the parameter "ARG". Replaces the # shell argument (which may be a quoted string) under or before the # cursor with that. Ensure the expression is suitable quoted. # # For example, to uppercase the entire shell argument: # modify-current-argument '${(U)ARG}' # To strip the current quoting from the word (whether backslashes or # single, double or dollar quotes) and use single quotes instead: # modify-current-argument '${(qq)${(Q)ARG}}' # Retain most options from the calling function for the eval. # Reset some that might confuse things. setopt localoptions noksharrays multibyte local -a reply integer REPLY REPLY2 autoload -Uz split-shell-arguments split-shell-arguments # Can't do this unless there's some text under or left of us. (( REPLY < 2 )) && return 1 # Get the index of the word we want. if (( REPLY & 1 )); then # Odd position; need previous word. (( REPLY-- )) # Pretend position was just after the end of it. (( REPLY2 = ${#reply[REPLY]} + 1 )) fi # Length of all characters before current. # Force use of character (not index) counting and join without IFS. integer wordoff="${(cj..)#reply[1,REPLY-1]}" # Replacement for current word. This could do anything to ${reply[REPLY]}. local ARG="${reply[REPLY]}" repl eval repl=\"$1\" # New line: all words before and after current word, with # no additional spaces since we've already got the whitespace # and the replacement word in the middle. BUFFER="${(j..)reply[1,REPLY-1]}${repl}${(j..)reply[REPLY+1,-1]}" # Keep cursor at same position in replaced word. # Redundant here, but useful if $repl changes the length. # Limit to the next position after the end of the word. integer repmax=$(( ${#repl} + 1 )) # Remember CURSOR starts from offset 0 for some reason, so # subtract 1 from positions. (( CURSOR = wordoff + (REPLY2 > repmax ? repmax : REPLY2) - 1 )) PK[Q*5~%~%functions/_main_completenuW+A#autoload # The main loop of the completion code. This is what is called when # completion is attempted from the command line. # In case non-standard separators are in use. local IFS=$' \t\n\0' # If you want to complete only set or unset options for the unsetopt # and setopt builtin, un-comment these lines: # # local _options_set _options_unset # # _options_set=(${(k)options[(R)on]}) # _options_unset=(${(k)options[(R)off]}) # # This is needed because completion functions may set options locally # which makes the output of setopt and unsetopt reflect a different # state than the global one for which you are completing. eval "$_comp_setup" local func funcs ret=1 tmp _compskip format nm call match min max i num\ _completers _completer _completer_num curtag _comp_force_list \ _matchers _matcher _c_matcher _matcher_num _comp_tags _comp_mesg \ mesg str context state line opt_args val_args curcontext="$curcontext" \ _last_nmatches=-1 _last_menu_style _def_menu_style _menu_style sel \ _tags_level=0 \ _saved_exact="${compstate[exact]}" \ _saved_lastprompt="${compstate[last_prompt]}" \ _saved_list="${compstate[list]}" \ _saved_insert="${compstate[insert]}" \ _saved_colors="$ZLS_COLORS" \ _saved_colors_set=${+ZLS_COLORS} # _precommand sets this to indicate we are following a precommand modifier local -a precommands typeset -U _lastdescr _comp_ignore _comp_colors [[ -z "$curcontext" ]] && curcontext=::: zstyle -s ":completion:${curcontext}:" insert-tab tmp || tmp=yes if [[ ( "$tmp" = *pending(|[[:blank:]]*) && PENDING -gt 0 ) || ( "$tmp" = *pending=(#b)([0-9]##)(|[[:blank:]]*) && PENDING -ge $match[1] ) ]]; then compstate[insert]=tab return 0 fi if [[ "$compstate[insert]" = tab* ]]; then { [[ "$tmp" = (|[[:blank:]]*)(yes|true|on|1)(|[[:blank:]]*) ]] && { [[ "$curcontext" != :* || -z "$compstate[vared]" ]] || zstyle -t ":completion:vared${curcontext}:" insert-tab } } && return 0 compstate[insert]="${compstate[insert]//tab /}" fi # Special completion contexts after `~' and `='. if [[ -z "$compstate[quote]" ]]; then if [[ -o equals ]] && compset -P 1 '='; then compstate[context]=equal elif [[ "$PREFIX" != */* && "$PREFIX[1]" = '~' ]]; then compset -p 1 compstate[context]=tilde fi fi # Initial setup. _setup default _def_menu_style=( "$_last_menu_style[@]" # We can't really do that because the current value of $MENUSELECT # may be the one set by this function. # There is a similar problem with $ZLS_COLORS in _setup. # ${MENUSELECT+select${MENUSELECT:+\=$MENUSELECT}} ) _last_menu_style=() if zstyle -s ":completion:${curcontext}:default" list-prompt tmp; then LISTPROMPT="$tmp" zmodload -i zsh/complist fi if zstyle -s ":completion:${curcontext}:default" select-prompt tmp; then MENUPROMPT="$tmp" zmodload -i zsh/complist fi if zstyle -s ":completion:${curcontext}:default" select-scroll tmp; then MENUSCROLL="$tmp" zmodload -i zsh/complist fi # Get the names of the completers to use in the positional parameters. if (( $# )); then if [[ "$1" = - ]]; then if [[ $# -lt 3 ]]; then _completers=() else _completers=( "$2" ) call=yes fi else _completers=( "$@" ) fi else zstyle -a ":completion:${curcontext}:" completer _completers || _completers=( _complete _ignored ) fi # And now just call the completer functions defined. _completer_num=1 # Call the pre-functions. funcs=( "$compprefuncs[@]" ) compprefuncs=() for func in "$funcs[@]"; do "$func" done for tmp in "$_completers[@]"; do if [[ -n "$call" ]]; then _completer="${tmp}" elif [[ "$tmp" = *:-* ]]; then _completer="${${tmp%:*}[2,-1]//_/-}${tmp#*:}" tmp="${tmp%:*}" elif [[ $tmp = *:* ]]; then _completer="${tmp#*:}" tmp="${tmp%:*}" else _completer="${tmp[2,-1]//_/-}" fi curcontext="${curcontext/:[^:]#:/:${_completer}:}" zstyle -t ":completion:${curcontext}:" show-completer && zle -R "Trying completion for :completion:${curcontext}" zstyle -a ":completion:${curcontext}:" matcher-list _matchers || _matchers=( '' ) _matcher_num=1 _matcher='' for _c_matcher in "$_matchers[@]"; do if [[ "$_c_matcher" == +* ]]; then _matcher="$_matcher $_c_matcher[2,-1]" else _matcher="$_c_matcher" fi _comp_mesg= if [[ -n "$call" ]]; then if "${(@)argv[3,-1]}"; then ret=0 break 2 fi elif "$tmp"; then ret=0 break 2 fi (( _matcher_num++ )) done [[ -n "$_comp_mesg" ]] && break (( _completer_num++ )) done curcontext="${curcontext/:[^:]#:/::}" if [[ $compstate[old_list] = keep ]]; then # We are keeping the old list of matches, so keep the # number of matches we found last time rather than the # number just generated. nm=$_lastcomp[nmatches] else nm=$compstate[nmatches] fi if [[ $compstate[old_list] = keep || nm -gt 1 ]]; then [[ _last_nmatches -ge 0 && _last_nmatches -ne nm ]] && _menu_style=( "$_last_menu_style[@]" "$_menu_style[@]" ) tmp=$(( compstate[list_lines] + BUFFERLINES + 1 )) _menu_style=( "$_menu_style[@]" "$_def_menu_style[@]" ) if [[ "$compstate[list]" = *list && tmp -gt LINES && ( -n "$_menu_style[(r)select=long-list]" || -n "$_menu_style[(r)(yes|true|on|1)=long-list]" ) ]]; then compstate[insert]=menu elif [[ "$compstate[insert]" = "$_saved_insert" ]]; then if [[ -n "$compstate[insert]" && -n "$_menu_style[(r)(yes|true|1|on)=long]" && tmp -gt LINES ]]; then compstate[insert]=menu else sel=( "${(@M)_menu_style:#(yes|true|1|on)*}" ) if (( $#sel )); then min=9999999 for i in "$sel[@]"; do if [[ "$i" = *\=[0-9]* ]]; then num="${i#*\=}" [[ num -lt 0 ]] && num=0 elif [[ "$i" != *\=* ]]; then num=0 else num=9999999 fi [[ num -lt min ]] && min="$num" (( min )) || break done fi sel=( "${(@M)_menu_style:#(no|false|0|off)*}" ) if (( $#sel )); then max=9999999 for i in "$sel[@]"; do if [[ "$i" = *\=[0-9]* ]]; then num="${i#*\=}" [[ num -lt 0 ]] && num=0 elif [[ "$i" != *\=* ]]; then num=0 else num=9999999 fi [[ num -lt max ]] && max="$num" (( max )) || break done fi if [[ ( -n "$min" && nm -ge min && ( -z "$max" || nm -lt max ) ) || ( -n "$_menu_style[(r)auto*]" && "$compstate[insert]" = automenu ) ]]; then compstate[insert]=menu elif [[ -n "$max" && nm -ge max ]]; then compstate[insert]=unambiguous elif [[ -n "$_menu_style[(r)auto*]" && "$compstate[insert]" != automenu ]]; then compstate[insert]=automenu-unambiguous fi fi fi if [[ "$compstate[insert]" = *menu* ]]; then [[ "$MENUSELECT" = 00 ]] && MENUSELECT=0 if [[ -n "$_menu_style[(r)no-select*]" ]]; then unset MENUSELECT elif [[ -n "$_menu_style[(r)select=long*]" ]]; then if [[ tmp -gt LINES ]]; then zmodload -i zsh/complist MENUSELECT=00 fi fi if [[ "$MENUSELECT" != 00 ]]; then sel=( "${(@M)_menu_style:#select*}" ) if (( $#sel )); then min=9999999 for i in "$sel[@]"; do if [[ "$i" = *\=[0-9]* ]]; then num="${i#*\=}" [[ num -lt 0 ]] && num=0 elif [[ "$i" != *\=* ]]; then num=0 else num=9999999 fi [[ num -lt min ]] && min="$num" (( min )) || break done zmodload -i zsh/complist MENUSELECT="$min" else unset MENUSELECT fi fi if [[ -n "$MENUSELECT" ]]; then if [[ -n "$_menu_style[(r)interactive*]" ]]; then MENUMODE=interactive elif [[ -n "$_menu_style[(r)search*]" ]]; then if [[ -n "$_menu_style[(r)*backward*]" ]]; then MENUMODE=search-backward else MENUMODE=search-forward fi else unset MENUMODE fi fi fi elif [[ nm -lt 1 && -n "$_comp_mesg" ]]; then compstate[insert]='' compstate[list]='list force' elif [[ nm -eq 0 && -z "$_comp_mesg" && $#_lastdescr -ne 0 && $compstate[old_list] != keep ]] && zstyle -s ":completion:${curcontext}:warnings" format format; then compstate[list]='list force' compstate[insert]='' tmp=( "\`${(@)^_lastdescr:#}'" ) case $#tmp in 1) str="$tmp[1]";; 2) str="$tmp[1] or $tmp[2]";; *) str="${(j:, :)tmp[1,-2]}, or $tmp[-1]";; esac _setup warnings zformat -f mesg "$format" "d:$str" "D:${(F)${(@)_lastdescr:#}}" compadd -x "$mesg" fi [[ "$_comp_force_list" = always || ( "$_comp_force_list" = ?* && nm -ge _comp_force_list ) ]] && compstate[list]="${compstate[list]//messages} force" if [[ "$compstate[old_list]" = keep ]]; then if [[ $_saved_colors_set = 1 ]]; then ZLS_COLORS="$_saved_colors" else unset ZLS_COLORS fi elif (( $#_comp_colors )); then ZLS_COLORS="${(j.:.)_comp_colors}" else unset ZLS_COLORS fi # Now call the post-functions. funcs=( "$comppostfuncs[@]" ) comppostfuncs=() for func in "$funcs[@]"; do "$func" done _lastcomp=( "${(@kv)compstate}" ) _lastcomp[nmatches]=$nm _lastcomp[completer]="$_completer" _lastcomp[prefix]="$PREFIX" _lastcomp[suffix]="$SUFFIX" _lastcomp[iprefix]="$IPREFIX" _lastcomp[isuffix]="$ISUFFIX" _lastcomp[qiprefix]="$QIPREFIX" _lastcomp[qisuffix]="$QISUFFIX" _lastcomp[tags]="$_comp_tags" return ret PK[D8functions/_postfixnuW+A#compdef postsuper _postfix_queue_id() { compadd ${${(M)${(f)"$(postqueue -p)"}:#(#s)([0-9A-F]##)*}/(#s)(#b)([0-9A-F]##)*/$match[1]} } case $service in (postsuper) _arguments -C \ '-p[purge old tempfiles]' \ '-s[structure check and repair]' \ '-v[verbose]' \ '-c[configdir]:config dir:_files -/' \ '-d[delete]:queue id:_postfix_queue_id' \ '-h[hold]:queue id:_postfix_queue_id' \ '-H[release]:queue id:_postfix_queue_id' \ '-r[requeue]:queue id:_postfix_queue_id' \ '1:queue:(hold incoming active deferred)' ;; esac PK[cH 99functions/_globalnuW+A#compdef global local cmds="(-c --completion -f --file -g --grep -I --idutils -p --print-dbpath -P --path -u --update --version --help)" _arguments \ "$cmds"{-c,--completion}'[completion on prefix]:prefix:' \ "$cmds"{-f,--file}'[print function definitions in file]' \ "$cmds"{-g,--grep}'[print all lines which match pattern using grep]:pattern' \ "$cmds"{-I,--idutils}'[print all lines which match pattern using id-utils]:pattern' \ "$cmds"{-p,--print-dbpath}'[print location of GTAGS]' \ "$cmds"{-P,--path}'[print paths matching pattern]:pattern:' \ "$cmds"{-u,--update}'[locate tag files and update incrementally]' \ '(-a --absolute)'{-a,--absolute}'[print absolute path names]' \ '(-e --regexp :)'{-e,--regexp}'[specify pattern]:pattern:_global_tags' \ '(-G --basic-regexp :)'{-G,--basic-regexp}'[specify basic regexp to use]:word:_global_tags' \ '(-i --ignore-case)'{-i,--ignore-case}'[ignore case in patterns]' \ '(-l --local)'{-l,--local}'[print just objects which exist under the current directory]' \ '(-n --nofilter)'{-n,--nofilter}'[suppress sort filter and path conversion filter]' \ '(-o --other)'{-o,--other}'[search in other files, not just source files (with -g)]' \ '(-q --quiet)'{-q,--quiet}'[quiet mode]' \ '(-r --reference --rootdir)'{-r,--reference,--rootdir}'[find object references instead of definitions]' \ '(-s --symbol)'{-s,--symbol}'[find symbols instead of function names]:pattern' \ '(-t --tags)'{-t,--tags}'[output in standard ctags format]' \ '(-T --through -s -r -l)'{-T,--through}'[search through all tag files in GTAGSLIBPATH]' \ '(-v --verbose)'{-v,--verbose}'[verbose mode]' \ '(-x --cxref)'{-x,--cxref}'[additionally list line number and contents]' \ '(- :)--version[display version information]' \ '(- :)--help[display help information]' \ ':word:_global_tags' PK[Nfunctions/_ulimitnuW+A#compdef ulimit [[ $PREFIX = u* ]] && compadd unlimited && return 0 _arguments -s \ '-H[set hard limits]' \ '-S[set soft and hard limits (with -H)]' \ '(-H -S -c -d -f -l -m -n -s -t *)-a[list all current resource limits]' \ '-c[core dump size limit]:max core dump size (512-byte blocks)' \ '-d[maximum size of data segment]:maximum size of data segment (K-bytes)' \ '-f[size of largest file allowed]:size of largest file allowed (512-byte blocks)' \ '-l[maximum size of locked in memory]:maximum size of locked in memory (K-bytes)' \ '-m[maximum size of physical memory]:maximum size of physical memory (K-bytes)' \ '-n[maximum no. of open file descriptors]:maximum no. of open file descriptors' \ '-s[stack size limit]:stack size limit (K-bytes)' \ '-t[maximum cpu time per process]:maximum cpu time per process (seconds)' \ '-u[processes available to the user]:processes' \ '-v[maximum size of virtual memory]:maximum size of virtual memory (K-bytes)' \ '*:size of largest file allowed' PK[,functions/_lintiannuW+A#compdef lintian lintian-info local line cmds ret=1 case "$service" in (lintian) _arguments -s \ '(-c -r -u -C -R -S -X --check --check-part --dont-check-part --remove --remove-lab --setup-lab --unpack)'{-S,--setup-lab}'[setup or update the laboratory]' \ '(-c -r -u -C -R -S -X --check --check-part --dont-check-part --remove --remove-lab --setup-lab --unpack)'{-R,--remove-lab}'[remove the laboratory directory]' \ '(-c -r -u -C -R -S -X --check --check-part --dont-check-part --remove --remove-lab --setup-lab --unpack)'{-c,--check}'[run all checks over the specified packages]' \ '(-c -r -u -C -R -S -X --check --check-part --dont-check-part --remove --remove-lab --setup-lab --unpack)'{-C,--check-part}'[run only the specified checks]:checks:_values -s , "lintian checks" binaries bin changelog-file chg conffiles cnf control-file dctrl control-files ctl copyright-file cpy cruft deb deb-format dfmt debconf dc debdiff dif debian-readme drm debhelper dh description des etcfiles etc fields fld files fil huge-usr-share hus infofiles info init.d ini manpages man md5sums md5 menus men menu-format mnf perl prl po-debconf pd scripts scr shared-libs shl spelling splr standards-version std' \ '(-c -r -u -C -R -S -X --check --check-part --dont-check-part --remove --remove-lab --setup-lab --unpack)'{-X,--dont-check-part}'[run only the specified checks]:checks:_values -s , "lintian checks" binaries bin changelog-file chg conffiles cnf control-file dctrl control-files ctl copyright-file cpy cruft deb deb-format dfmt debconf dc debdiff dif debian-readme drm debhelper dh description des etcfiles etc fields fld files fil huge-usr-share hus infofiles info init.d ini manpages man md5sums md5 menus men menu-format mnf perl prl po-debconf pd scripts scr shared-libs shl spelling splr standards-version std' \ '(-c -r -u -C -R -S -X --check --check-part --dont-check-part --remove --remove-lab --setup-lab --unpack)'{-u,--unpack}'[unpack up to unpack level]' \ '(-c -r -u -C -R -S -X --check --check-part --dont-check-part --remove --remove-lab --setup-lab --unpack)'{-r,--remove}'[clean packages up to current unpack level]' \ '(-h --help)'{-h,--help}'[help]' \ '(-v --verbose)'{-v,--verbose}'[verbose]' \ '(-V --version)'{-V,--version}'[version]' \ '(-d --debug)'{-d,--debug}'[debug]' \ '--print-version[print unadorned version number]' \ '(-i --info)'{-i,--info}'[print info about violations]' \ '(-I --display-info)'{-I,--display-info}'[also display informational tags]' \ '(-l --unpack-level)'{-l,--unpack-level}'[unpack level]:default unpack level:(0 1 2 none basic contents)' \ '(-o --no-override)'{-o,--no-override}'[do not use the overrides file]' \ '--show-overrides[output tags that have been overridden]' \ '--color:when:(never always auto)' \ '(-U --unpack-info)'{-U,--unpack-info}'[collect informations]:infos:_values -s , "collectibles" changelog-file copyright-file debfiles debian-readme diffstat doc-base-files file-info init.d md5sums menu-files objdump-info override-file scripts source-control-file' \ '(-m --md5sums)'{-m,--md5sums}'[check md5sums when processing a .changes file]' \ '--allow-root[override warning when run with superuser privileges]' \ '--cfg:config file:_files' \ '--lab:laboratory dir:_files -/' \ '--archivedir:archive directory:_files -/' \ '--dist:distribution:(woody sarge sid)' \ '--section:release:(main contrib non-free)' \ '--arch:architecture:(alpha arm hppa hurd-i386 i386 ia64 m68k mips mipsel powerpc s390 sparc)' \ '--root:root directory:_files -/' \ '(-a --all)'{-a,--all}'[check all packages in the distribution]' \ '(-b --binary)'{-b,--binary}'[the following packages are binary]' \ '(-s --source)'{-s,--source}'[the following packages are source]' \ '--udeb[the following packages are udebs]' \ '(-p --packages-file)'{-p,--packages-file}'[process packages listed in file]:list:_files' \ '*:package:_files -g "*.(changes|deb|dsc)"' && return 0 ;; (lintian-info) _arguments -C '1: :->cmds' '*: :->args' && ret=0 case $state in (cmds) cmds=( {-t,--tags}':print long description of arguments' {-a,--annotate}':annotate override entries from stdin' ) _describe -t commands 'lintian-info command' cmds && ret=0 ;; (args) case $line[1] in -t|--tags) _wanted tag expl 'tag' compadd $(command awk '/^Tag:/ { print $2 }' /usr/share/lintian/checks/*.desc) && ret=0 ;; esac ;; esac ;; esac return ret PK[@NPO  functions/_printnuW+A#compdef print local state expl line eflag pflag # -e flag available only after -R eflag="${words[1,CURRENT-1][(r)-*R*]:+-e[enable escapes]}" # -p flag only relevant if we have a coprocess (:>&p) 2>/dev/null && pflag='(-s -u -z)-p[print arguments to input of coprocess]' _arguments -C -s -A "-*" -S \ '(-f)-r[ignore escape conventions of echo]' \ '(-r -b -f -m -s -l -N -o -O -i -c -u -p -z -D -P)-R[emulate BSD echo (no escapes, -n & -e flags only)]' \ '-b[recognise bindkey escape sequences]' \ '-m[remove arguments matching specified pattern]' \ '(-r -n -R -l -N -c)-f+[print arguments as for the printf builtin]:format' \ '(-u -p -z)-s[place results in the history list]' \ '(-c -f)-n[do not add a newline to the result]' \ '(-N -c -f)-l[print arguments separated by newlines]' \ '(-n -l -c -f)-N[print arguments separated and terminated by nulls]' \ '(-O)-o[sort arguments in ascending order]' \ '(-o)-O[sort arguments in descending order]' \ '-i[case-insensitive sorting]' \ '(-n -l -N -f -s -z)-a[with -c/-C, print arguments across before down]' \ '(-n -l -N -f -C -s -z)-c[print arguments in columns]' \ '(-n -l -N -f -c -s -z)-C+[print arguments in specified number of columns]:columns' \ '(-s -p -z)-u+[specify file descriptor to print arguments to]:file descriptor:_file_descriptors' \ '(-s -p -u)-z[push arguments onto editing buffer stack]' \ '-D[substitute any arguments which are named directories using ~ notation]' \ '-P[perform prompt expansion]' \ $pflag $eflag '*:default:_default' PK[ 9_ _ functions/_completenuW+A#autoload # Generate all possible completions. Note that this is not intended as # a normal completion function, but as one possible value for the # completer style. local comp name oldcontext ret=1 service typeset -T curcontext="$curcontext" ccarray oldcontext="$curcontext" # If we have a user-supplied context name, use only that. if [[ -n "$compcontext" ]]; then if [[ "${(t)compcontext}" = *array* ]]; then local expl _wanted values expl value compadd -a - compcontext elif [[ "${(t)compcontext}" = *assoc* ]]; then local expl tmp i tmp=() for i in "${(@k)compcontext[(R)*[^[:blank:]]]}"; do tmp=( "$tmp[@]" "${i}:${compcontext[$i]}" ) done tmp=( "$tmp[@]" "${(k@)compcontext[(R)[[:blank:]]#]}" ) _describe -t values value tmp elif [[ "$compcontext" = *:*:* ]]; then local tag="${${compcontext%%:*}:-values}" local descr="${${${compcontext#${tag}:}%%:*}:-value}" local action="${compcontext#${tag}:${descr}:}" expl ws ret=1 case "$action" in \ #) _message -e "$tag" "$descr";; \(\(*\)\)) eval ws\=\( "${action[3,-3]}" \) _describe -t "$tag" "$descr" ws;; \(*\)) eval ws\=\( "${action[2,-2]}" \) _wanted "$tag" expl "$descr" compadd -a - ws;; \{*\}) _tags "$tag" while _tags; do while _next_label "$tag" expl "$descr"; do eval "$action[2,-2]" && ret=0 done (( ret )) || break done;; \ *) eval ws\=\( "$action" \) _tags "$tag" while _tags; do while _next_label "$tag" expl "$descr"; do "$ws[@]" done (( ret )) || break done;; *) eval ws\=\( "$action" \) _tags "$tag" while _tags; do while _next_label "$tag" expl "$descr"; do "$ws[1]" "$expl[@]" "${(@)ws[2,-1]}" done (( ret )) || break done;; esac else ccarray[3]="$compcontext" comp="$_comps[$compcontext]" [[ -n "$comp" ]] && eval "$comp" fi return fi # An entry for `-first-' is the replacement for `compctl -T' comp="$_comps[-first-]" if [[ -n "$comp" ]]; then service="${_services[-first-]:--first-}" ccarray[3]=-first- eval "$comp" && ret=0 if [[ "$_compskip" = all ]]; then _compskip= return ret fi fi # If we are inside `vared' and we don't have a $compcontext, we treat # this like a parameter assignment. Which it is. [[ -n $compstate[vared] ]] && compstate[context]=vared # For arguments and command names we use the `_normal' function. ret=1 if [[ "$compstate[context]" = command ]]; then curcontext="$oldcontext" _normal -s && ret=0 else # Let's see if we have a special completion definition for the other # possible contexts. local cname="-${compstate[context]:s/_/-/}-" ccarray[3]="$cname" comp="$_comps[$cname]" service="${_services[$cname]:-$cname}" # If not, we use default completion, if any. if [[ -z "$comp" ]]; then if [[ "$_compskip" = *default* ]]; then _compskip= return 1 fi comp="$_comps[-default-]" service="${_services[-default-]:--default-}" fi [[ -n "$comp" ]] && eval "$comp" && ret=0 fi _compskip= return ret PK[ǥS functions/_multi_partsnuW+A#autoload # This gets two arguments, a separator (which should be only one # character) and an array. As usual, the array may be given by it's # name or literal as in `(foo bar baz)' (words separated by spaces in # parentheses). # The parts of words from the array that are separated by the # separator character are then completed independently. local sep pref npref i tmp2 group expl menu pre suf opre osuf orig cpre local opts sopts matcher imm typeset -U tmp1 matches # Get the options. zparseopts -D -a sopts \ 'J+:=group' 'V+:=group' 'X+:=expl' 'P:=opts' 'F:=opts' \ S: r: R: q 1 2 n f 'M+:=matcher' 'i=imm' sopts=( "$sopts[@]" "$opts[@]" ) if (( $#matcher )); then matcher="${matcher[2]}" else matcher= fi # Get the arguments, first the separator, then the array. The array is # stored in `tmp1'. Further on the array `matches' will always contain # those words from the original array that still match everything we have # tried to match while we walk through the string from the line. sep="$1" if [[ "${2[1]}" = '(' ]]; then tmp1=( ${=2[2,-2]} ) else tmp1=( "${(@P)2}" ) fi # In `pre' and `suf' we will hold the prefix and the suffix from the # line while we walk through them. The original string are used # temporarily for matching. pre="$PREFIX" suf="$SUFFIX" opre="$PREFIX" osuf="$SUFFIX" orig="$PREFIX$SUFFIX" # Special handling for menu completion? [[ $compstate[insert] = (*menu|[0-9]*) || -n "$_comp_correct" || ( $#compstate[pattern_match] -ne 0 && "$orig" != "${orig:q}" ) ]] && menu=yes # In `pref' we collect the unambiguous prefix path. pref='' # If the string from the line matches at least one of the strings, # we use only the matching strings. compadd -O matches -M "r:|${sep}=* r:|=* $matcher" -a tmp1 (( $#matches )) || matches=( "$tmp1[@]" ) while true; do # Get the prefix and suffix for matching. if [[ "$pre" = *${sep}* ]]; then PREFIX="${pre%%${sep}*}" SUFFIX="" else PREFIX="${pre}" SUFFIX="${suf%%${sep}*}" fi # Check if the component for some of the possible matches is equal # to the string from the line. If there are such strings, we directly # use the stuff from the line. This avoids having `foo' complete to # both `foo' and `foobar'. if [[ -n "$PREFIX$SUFFIX" || "$pre" = ${sep}* ]]; then tmp1=( "${(@M)matches:#${PREFIX}${SUFFIX}${sep}*}" ) else tmp1=() fi if (( $#tmp1 )); then npref="${PREFIX}${SUFFIX}${sep}" else # No exact match, see how many strings match what's on the line. builtin compadd -O tmp1 -M "r:|${sep}=* r:|=* $matcher" - "${(@)${(@)matches%%${sep}*}:#}" [[ $#tmp1 -eq 0 && -n "$_comp_correct" ]] && compadd -O tmp1 -M "r:|${sep}=* r:|=* $matcher" - "${(@)${(@)matches%%${sep}*}:#}" if [[ $#tmp1 -eq 1 ]]; then # Only one match. If there are still separators from the line # we just accept this component. Otherwise we insert what we # have collected, probably giving it a separator character # as a suffix. if [[ "$pre$suf" = *${sep}* ]]; then npref="${tmp1[1]}${sep}" else matches=( "${(@M)matches:#${tmp1[1]}*}" ) PREFIX="${cpre}${pre}" SUFFIX="$suf" if [[ $#imm -ne 0 && $#matches -eq 1 ]] || zstyle -t ":completion:${curcontext}:" expand suffix; then compadd "$group[@]" "$expl[@]" "$sopts[@]" \ -M "r:|${sep}=* r:|=* $matcher" - $pref$matches else if (( $matches[(I)${tmp1[1]}${sep}*] )); then compadd "$group[@]" "$expl[@]" -p "$pref" -r "$sep" -S "$sep" "$opts[@]" \ -M "r:|${sep}=* r:|=* $matcher" - "$tmp1[1]" else compadd "$group[@]" "$expl[@]" -p "$pref" "$sopts[@]" \ -M "r:|${sep}=* r:|=* $matcher" - "$tmp1[1]" fi fi return fi elif (( $#tmp1 )); then local ret=1 tt local -a mm # More than one match. First we get all strings that match the # rest from the line. PREFIX="$pre" SUFFIX="$suf" compadd -O matches -M "r:|${sep}=* r:|=* $matcher" -a matches if [[ "$pre" = *${sep}* ]]; then PREFIX="${cpre}${pre%%${sep}*}" SUFFIX="${sep}${pre#*${sep}}${suf}" else PREFIX="${cpre}${pre}" SUFFIX="$suf" fi for tt in $tmp1 do mm+=( "${(@M)matches:#$tt*}" ) done matches=( $mm ) if ! zstyle -t ":completion:${curcontext}:" expand suffix || [[ -n "$menu" || -z "$compstate[insert]" ]]; then # With menu completion we add only the ambiguous component with # the prefix collected and a separator for the matches that # have more components. tmp2="$pre$suf" if [[ "$tmp2" = *${sep}* ]]; then tmp2=(-s "${sep}${tmp2#*${sep}}") else tmp2=() fi compadd "$group[@]" "$expl[@]" -r "$sep" -S "$sep" "$opts[@]" \ -p "$pref" "$tmp2[@]" -M "r:|${sep}=* r:|=* $matcher" - \ "${(@)${(@)${(@M)matches:#*${sep}}%%${sep}*}:#}" && ret=0 (( $matches[(I)${sep}*] )) && compadd "$group[@]" "$expl[@]" -S '' "$opts[@]" \ -p "$pref" \ -M "r:|${sep}=* r:|=* $matcher" - "$sep" && ret=0 compadd "$group[@]" "$expl[@]" -r "$sep" -S "$sep" "$opts[@]" \ -p "$pref" "$tmp2[@]" -M "r:|${sep}=* r:|=* $matcher" - \ "${(@)${(@)${(@M)matches:#*?${sep}?*}%%${sep}*}:#}" && ret=0 compadd "$group[@]" "$expl[@]" -S '' "$opts[@]" -p "$pref" "$tmp2[@]" \ -M "r:|${sep}=* r:|=* $matcher" - \ "${(@)matches:#*${sep}*}" && ret=0 else # With normal completion we add all matches one-by-one with # the unmatched part as a suffix. This will insert the longest # unambiguous string for all matching strings. compadd "$group[@]" "$expl[@]" "$opts[@]" \ -p "$pref" -s "${i#*${sep}}" \ -M "r:|${sep}=* r:|=* $matcher" - \ "${(@)${(@)${(@M)matches:#*${sep}*}%%${sep}*}:#}" && ret=0 compadd "$group[@]" "$expl[@]" -S '' "$opts[@]" -p "$pref" \ -M "r:|${sep}=* r:|=* $matcher" - \ "${(@)matches:#*${sep}*}" && ret=0 fi return ret else # We are here if no string matched what's on the line. In this # case we insert the expanded prefix we collected if it differs # from the original string from the line. { ! zstyle -t ":completion:${curcontext}:" expand prefix || [[ "$orig" = "$pref$pre$suf" ]] } && return 1 PREFIX="${cpre}${pre}" SUFFIX="$suf" if [[ -n "$suf" ]]; then compadd "$group[@]" "$expl[@]" -s "$suf" "$sopts[@]" \ -M "r:|${sep}=* r:|=* $matcher" - "$pref$pre" else compadd "$group[@]" "$expl[@]" -S '' "$opts[@]" \ -M "r:|${sep}=* r:|=* $matcher" - "$pref$pre" fi return fi fi # We just accepted and/or expanded a component from the line. We # remove it from the matches (using only those that have a least # the skipped string) and ad it the `pref'. matches=( "${(@)${(@)${(@M)matches:#${npref}*}#*${sep}}:#}" ) pref="$pref$npref" # Now we set `pre' and `suf' to their new values. if [[ "$pre" = *${sep}* ]]; then cpre="${cpre}${pre%%${sep}*}${sep}" pre="${pre#*${sep}}" elif [[ "$suf" = *${sep}* ]]; then cpre="${cpre}${pre}${suf%%${sep}*}${sep}" pre="${suf#*${sep}}" suf="" else # The string from the line is fully handled. If we collected an # unambiguous prefix and that differs from the original string, # we insert it. PREFIX="${opre}${osuf}" SUFFIX="" if [[ -n "$pref" && "$orig" != "$pref" ]]; then if [[ "$pref" = *${sep}*${sep} ]]; then compadd "$group[@]" "$expl[@]" "$opts[@]" \ -p "${pref%${sep}*${sep}}${sep}" -S "$sep" \ -M "r:|${sep}=* r:|=* $matcher" - "${${pref%${sep}}##*${sep}}" elif [[ "$pref" = *${sep}* ]]; then compadd "$group[@]" "$expl[@]" -S '' "$opts[@]" \ -p "${pref%${sep}*}${sep}" \ -M "r:|${sep}=* r:|=* $matcher" - "${pref##*${sep}}" else compadd "$group[@]" "$expl[@]" -S '' "$opts[@]" \ -M "r:|${sep}=* r:|=* $matcher" - "$pref" fi fi return fi done PK[{^22functions/_oscnuW+A#compdef osc # # Copyright (C) 2009,2010 Holger Macht # # This file is released under the GPLv2. # # Based on the the zsh guide from http://zsh.dotsrc.org/Guide/zshguide06.html # # Toggle verbose completions: zstyle ':completion:*:osc:*' verbose no # zstyle ':completion:*:osc-subcommand:*' verbose no # # Use the variables $ZSH_OSC_BUILD_TARGETS_EXTRA and $ZSH_OSC_PROJECTS_EXTRA to # extend the list of possible completions in your ~/.zshrc like that: # export OSC_PROJECTS_EXTRA="Base:System Base:shells" # # version 0.2 # OSC_BUILD_TARGETS="openSUSE_10.2 openSUSE_10.3 openSUSE_11.0 openSUSE_11.1 openSUSE_11.2 openSUSE_11.3 openSUSE_Factory" OSC_PROJECTS="openSUSE:Factory openSUSE:11.2 openSUSE:11.3 openSUSE:11.1 openSUSE:11.0 openSUSE:10.3" # user defined variables $OSC_BUILD_TARGETS_EXTRA and # $OSC_PROJECTS_EXTRA can add to the project/build target list OSC_BUILD_TARGETS="$OSC_BUILD_TARGETS $ZSH_OSC_BUILD_TARGETS_EXTRA" OSC_PROJECTS="$OSC_PROJECTS $ZSH_OSC_PROJECTS_EXTRA" # Main dispatcher _osc() { if (( CURRENT > 2 )) && [[ ${words[2]} != "help" ]]; then # Remember the subcommand name local cmd=${words[2]} # Set the context for the subcommand. curcontext="${curcontext%:*:*}:osc-subcommand" # Narrow the range of words we are looking at to exclude `osc' (( CURRENT-- )) shift words # Run the completion for the subcommand if [ "$cmd" = "submitreq" -o "$cmd" = "sr" ]; then _osc_cmd_submitreq elif [ "$cmd" = "getbinaries" ]; then _osc_cmd_getbinaries elif [ "$cmd" = "checkout" -o "$cmd" = "co" -o "$cmd" = "branch" ]; then _osc_cmd_checkout elif [ "$cmd" = "buildlog" -o "$cmd" = "buildinfo" -o "$cmd" = "bl" ]; then _osc_cmd_buildlog else _osc_cmd_do $cmd fi else local hline local -a cmdlist local tag=0 _call_program help-commands osc help | while read -A hline; do # start parsing with "commands:" [[ $hline[1] = "commands:" ]] && tag=1 # stop parsing at the line starting with "For" [[ $hline[1] = "For" ]] && tag=0 [[ $tag = 0 ]] && continue # all commands have to start with lower case letters [[ $hline[1] =~ ^[A-Z] ]] && continue (( ${#hline} < 2 )) && continue # ${hline[1]%,} truncates the last ',' cmdlist=($cmdlist "${hline[1]%,}:${hline[2,-1]}") done _describe -t osc-commands 'osc command' cmdlist fi } _osc_cmd_getbinaries() { _arguments \ '1:PROJECT:( `echo $OSC_PROJECTS` )' \ '2:PACKAGE:(PACKAGE)' \ '3:REPOSITORY:( `echo $OSC_BUILD_TARGETS` )' \ '4:ARCHITECTURE:(i586 x86_64)' } _osc_cmd_checkout() { _arguments \ '1:PROJECT:( `echo $OSC_PROJECTS` )' \ '2:PACKAGE:(PACKAGE)' } _osc_cmd_buildlog() { _arguments \ '1:REPOSITORY:( `echo $OSC_BUILD_TARGETS` )' \ '2:ARCHITECTURE:(i586 x86_64)' } _osc_cmd_submitreq() { local hline local -a cmdlist local tag=0 _call_program help-commands osc help $cmd | while read -A hline; do # start parsing from "usage:" [[ $hline[1] = "usage:" ]] && tag=1 [[ $tag = 0 ]] && continue if [[ $hline[1] =~ ^osc ]]; then shift hline; shift hline elif ! [[ $hline[1] =~ ^- ]]; then # Option has to start with a '-' or 'osc submitrequest' continue fi (( ${#hline} < 2 )) && continue cmdlist=($cmdlist "${hline[1]%,}:${hline[2,-1]}") done _describe -t osc-commands 'osc command' cmdlist } _osc_cmd_do() { local hline local -a cmdlist local tag=0 # only start completion if theres some '-' on the line if ! [ "$words[2]" = "-" ]; then _complete return fi _call_program help-commands osc help $cmd | while read -A hline; do # start parsing from "Options:" [[ $hline[1] = "Options:" ]] && tag=1 [[ $tag = 0 ]] && continue # Option has to start with a '-' [[ $hline[1] =~ ^- ]] || continue (( ${#hline} < 2 )) && continue cmdlist=($cmdlist "${hline[1]%,}:${hline[2,-1]}") done if [ -n "$cmdlist" ]; then _describe -t osc-commands 'osc command' cmdlist else _complete fi } # Code to make sure _osc is run when we load it _osc "$@" PK[+PP functions/_gsnuW+A#compdef gs ghostscript if compset -N --; then if [[ CURRENT -eq 1 ]]; then _pspdf else _message -e arguments 'userdict ARGUMENTS' return 1 fi else local curcontext="$curcontext" state line expl ret=1 typeset -A opt_args _x_arguments -C \ '-q[quiet startup]' \ '-g-[set device size]:device size (x):' \ '-r-[set resolution]:resolution ( or x):' \ '-I[add to library file search path]:directory:_dir_list' \ \*-{d,D}'-[define name with definition]:def:->dname' \ \*-{s,S}'-[define name with value]:def:->sname' \ '*:PostScript or PDF file:_pspdf' && ret=0 case "$state" in dname) if [[ "$PREFIX" = *\=* ]]; then _message -e definition-values 'systemdict definition value' else _wanted names expl 'systemdict definition name' \ compadd -M 'm:{a-z}={A-Z}' - \ DISKFONTS NOCACHE NOBIND NODISPLAY NOPAUSE PLATFONTS SAFER \ WRITESYSTEMDICT && ret=0 fi ;; sname) if compset -P '*='; then case "$IPREFIX" in *DEVICE\=) _wanted devices expl 'ghostscript device' \ compadd - "${(@)${=${$(_call_program devices gs -h)##* devices:}%%Search path:*}:#}" && ret=0 ;; *OutputFile\=) _description files expl 'output file' _files "$expl[@]" && ret=0 ;; *) _message -e values 'systemdict value' return 1 esac else _wanted names expl 'systemdict name' \ compadd -S\= -M 'm:{a-z}={A-Z}' - DEVICE OutputFile && ret=0 fi ;; esac return ret fi PK[@\< < functions/_rpmbuildnuW+A#compdef rpmbuild local -a cmds b_cmds t_cmds options b_options cmds=(--rebuild --recompile) b_cmds=(-ba -bb -bp -bc -bi -bl -bs) t_cmds=(-ta -tb -tp -tc -ti -tl -ts) options=(--quiet -v -vv --verbose --rcfile --pipe --dbpath -r --root --buildroot --clean --nobuild --nodeps --nodigest --nosignature --macros --rmsource --rmspec --short-circuit --sign --target -D --define -E --eval --with --without --debug --bcond --install-build-tree) b_options=(--clean --nobuild --nodeps --nodigest --nosignature --rmsource --rmspec --short-circuit --sign --target --debug --with --without) _arguments \ "($cmds $b_cmds $t_cmds)"{-ba,-ta}'[build binary and source packages]' \ "($cmds $b_cmds $t_cmds)"{-bb,-tb}'[build a binary package]' \ "($cmds $b_cmds $t_cmds)"{-bp,-tp}'[execute the "%prep" stage]' \ "($cmds $b_cmds $t_cmds)"{-bc,-tc}'[do the "%build" stage]' \ "($cmds $b_cmds $t_cmds)"{-bi,-ti}'[do the "%install" stage]' \ "($cmds $b_cmds $t_cmds)"{-bl,-tl}'[do a "list check"]' \ "($cmds $b_cmds $t_cmds)"{-bs,-ts}'[build just the source package]' \ "($cmds $b_cmds $t_cmds * $b_options $options)"{-\?,--help}'[show help message]' \ "($cmds $b_cmds $t_cmds * $b_options $options)"--querytags'[display known query tags]' \ "($cmds $b_cmds $t_cmds * $b_options)"--showrc'[display final rpmrc and macro configuration]' \ "($cmds $b_cmds $t_cmds * $b_options $options)"--usage'[display brief usage message]' \ "($cmds $b_cmds $t_cmds * $b_options $options)"--version'[print the version of rpm being used]' \ "(-v --verbose -vv)"--quiet'[print as little as possible]' \ "(-v --verbose --quiet)"{-v,--verbose}'[print verbose information]' \ "(-v --verbose --quiet)"-vv'[print lots of ugly debugging information]' \ --rcfile'[RC files]:RC files:_files -S\:' \ --macros'[macros files]:macros files:_files -S\:' \ --pipe'[command to pipe the output of rpm to]:command' \ --dbpath'[set database directory]:database directory:_files -/' \ "(-r --root)"{-r,--root}'[root file system tree]:chroot directory:_files -/' \ --buildroot'[override the BuildRoot]:BuildRoot directory:_files -/' \ --clean'[remove the build tree after the packages are made]' \ --nobuild'[do not execute any build stages (for spec testing purposes]' \ --nodeps'[do not verify build dependencies]' \ --nodigest"[don't verify package digest(s)]" \ --nosignature"[don't verify package signature(s)]" \ --rmsource'[remove the sources after the build]' \ --rmspec'[remove the spec file after the build]' \ --short-circuit'[skip straight to specified stage (-bc, -bi or -bb in PLD Linux]' \ --sign'[embed a GPG signature]' \ --target='[set target platform]:arch-vendor-os:' \ {'*-D','*--define='}'[define MACRO with value EXPR]:MACRO EXPR' \ {'*-E','*--eval='}'[print macro expansion of EXPR]:EXPR' \ '*--with[enable configure option for build]:option' \ '*--without[disable configure option for build]:option' \ "($cmds $b_cmds $t_cmds * $b_options)"--bcond'[find all --with/--without values]' \ --debug'[build packages with debug information]' \ "($cmds $b_cmds $t_cmds * $b_options)"--install-build-tree'[make all needed dirs for building binary rpms]' \ "(--clean $b_cmds $t_cmds --rebuild)"--recompile'[recompile source package]' \ "(--clean $b_cmds $t_cmds --recompile)"--rebuild'[rebuild source package]' \ "*:file:_files -g '(#i)*.(spec|srpm|tgz|tar|tar.gz|tar.bz2)(-.)'" && ret=0 PK[ԍ)functions/zfparamsnuW+A# function zfparams { emulate -L zsh [[ $curcontext = :zf* ]] || local curcontext=:zfparams if [[ $# -eq 1 && $1 = - ]]; then # Delete existing parameter set. local sess=$ZFTP_SESSION key key=${zfconfig[fcache_$sess]} [[ -n $key ]] && unset $key for key in fcache lastloc lastdir curdir otherdir otherargs lastuser; do unset "zfconfig[${key}_${sess}]" done elif (( $# > 0 )); then # Set to prompt for any user or password if not given. # Don't worry about accounts here. (( $# < 2 )) && 2='?' if (( $# < 3 )); then if [[ $2 = '?'* ]]; then 3="?Password on ${1}: " else 3="?Password for ${2##\\?} on ${1}: " fi fi fi zftp params $* # } PK[ifunctions/_iconvnuW+A#compdef iconv local expl curcontext="$curcontext" state line ret=1 local LOCPATH="${LOCPATH:-/usr/lib/nls/loc}" local -U codeset if _pick_variant gnu=GNU unix --version; then local exargs="--list -? --help --usage --version -V" _arguments -C -S -s \ "(-f --from-code $exargs)"{-f+,--from-code=}'[specify code set of input file]:code set:->codeset' \ "(-t --to-code $exargs)"{-t+,--to-code=}'[specify code set for output]:code set:->codeset' \ '(- 1)--list[list all character code sets]' \ "($exargs)-c[omit invalid characters from output]" \ "(-o --output $exargs)"{-o+,--output=}'[specify output file]:output file:_files' \ "(-s --silent --verbose $exargs)"{-s,--silent}'[suppress warnings]' \ "(-s --silent $exargs)--verbose[print progress information]" \ '(-)'{-\?,--help}'[display help information]' \ '(-)--usage[display a short usage message]' \ '(-)'{-V,--version}'[print program version]' \ '1:input file:_files' && return 0 if [[ $state = codeset ]]; then if compset -P '*/'; then _wanted option expl option compadd "$@" /TRANSLIT && ret=0 else _wanted codesets expl 'code set' compadd "$@" \ -M 'm:{a-zA-Z}={A-Za-z} r:|-=* r:|=*' \ ${${${(f)"$(_call_program codesets iconv --list)"}## #}%//} && ret=0 fi fi return ret else _arguments -C \ '-f[specify code set of input file]:code set:->codeset' \ '-t[specify code set for output]:code set:->codeset' \ '1:file:_files' && return 0 if [[ $state = codeset ]]; then if [[ -f /usr/lib/iconv/iconv_data ]]; then # IRIX & Solaris codeset=( ${${(f)"$( 1 )); then print "Usage: zfmark [bookmark]" >&2 return 1 fi if [[ -n $ZFTP_HOST ]]; then bkmarks[$1]="${ZFTP_USER}@${ZFTP_HOST}:${ZFTP_PWD}" elif [[ -n $zfconfig[lastloc_$ZFTP_SESSION] ]]; then bkmarks[$1]="${zfconig[lastuser_$ZFTP_SESSION]}@\ ${zfconfig[lastloc_$ZFTP_SESSION]}" else print "No current or recent ZFTP session to bookmark." >&2 return 1 fi for line in ${(ko)bkmarks}; do print -r- "$line ${bkmarks[$line]}" done >$ZFTP_BMFILE PK[St  functions/define-composed-charsnuW+A# This is not a widget function, it is only a helper for insert-composed-char # to cut down on resident memory use. emulate -L zsh setopt cbases # The associative array zsh_accent_chars is indexed by the # accent. The values are sets of character / Unicode pairs for # the character with the given accent. The Unicode value is # a hex index with no base discriminator; essentially a UCS-4 index # with the leading zeroes suppressed. typeset -gA zsh_accented_chars # Save quite a lot of space by using short names internally. local -A z local a b # grave a=\! z[$a]="\ A C0 E C8 I CC O D2 U D9 a E0 e E8 i EC o F2 u F9 N 1F8 n 1F9 \ " # acute a=\' z[$a]="\ A C1 E C9 I CD O D3 U DA Y DD a E1 e E9 i ED o F3 u FA y FD C 106 c 107 \ L 139 l 13A N 143 n 144 R 154 r 155 S 15A s 15B Z 179 z 17A \ " # circumflex a=\> z[$a]="\ A C2 E CA I CE O D4 U DB a E2 e EA i EE o F4 u FB C 108 c 109 G 11C g 11d \ H 124 h 125 J 134 j 135 S 15C s 15D W 174 w 175 Y 176 y 177 \ " # tilde a=\? z[$a]="\ A C3 E 1EBC N D1 O D5 a E3 e 1EBD n F1 o F5 I 128 i 129 U 168 u 169 \ " # macron (d-, D- give eth) a=- z[$a]="\ A 100 a 101 d F0 D D0 E 112 e 113 I 12a i 12b O 14C o 14D U 16A u 16B \ " # breve a=\( z[$a]="\ A 102 a 103 E 114 e 115 G 11E g 11F I 12C i 12D O 14E o 14F U 16C u 16D " # dot above, small i with no dot, or l with middle dot a=. z[$a]="\ \ C 10A c 10b E 116 e 117 G 120 g 121 I 130 i 131 L 13F l 140 Z 17B z 17C \ " # diaeresis / Umlaut a=: z[$a]="\ A C4 E CB I CF O D6 U DC a E4 e EB i EF o F6 u FC y FF Y 178 \ " # cedilla a=, z[$a]="\ C C7 c E7 G 122 g 123 K 136 k 137 L 13B l 13C N 145 n 146 R 156 r 157 \ S 15E s 15F T 162 t 163 \ " # underline (_) would go here # stroke through a=/ z[$a]="\ O D8 o F8 D 110 d 111 H 126 h 127 L 141 l 142 T 166 t 167 b 180 \ " # double acute a=\" z[$a]="\ O 150 o 151 U 170 u 171\ " # ogonek a=\; z[$a]="\ A 104 a 105 E 118 e 119 I 12E i 12F U 172 u 173 \ " # caron a=\< z[$a]="\ C 10C c 10D D 10E d 10F E 11A e 11B L 13D l 13E N 147 n 148 R 158 r 159 \ S 160 s 161 T 164 t 165 Z 17D z 17E \ " # ring above a=0 z[$a]="\ A C5 a E5 U 16E u 16F \ " # hook above a=2 z[$a]="\ A 1EA2 a 1EA3 E 1EBA e 1EBA \ " # horn, also right quotation marks a=9 z[$a]="\ O 1A0 o 1A1 U 1Af u 1b0 ' 2019 . 201A \" 201D : 201E \ " # left quotation marks a=6 z[$a]="\ ' 2018 \" 201C \ " # reversed quotation marks for convenience a=\' z[$a]+=" \ 9 201B \ " a=\" z[$a]+=" \ 9 201F \ " # ligature with E a=E z[$a]="\ A C6 O 152 \ " # ligature with e a=e z[$a]="\ a E6 o 153 \ " # ligature with J a=J z[$a]="\ I 132 \ " # ligature with j a=j z[$a]="\ i 133 \ " # eszett a=s z[$a]="\ s DF \ " # upper case thorn a=H z[$a]="\ T DE \ " # lower case thorn a=h z[$a]="\ t FE \ " # Arabic characters a=\+ z[$a]+=" \ , 60C ; 61B ? 61F a 627 b 628 t 62A g 62C x 62E d 62F r 631 z 632 s 633 \ c 635 e 639 i 63A + 640 f 641 q 642 k 643 l 644 m 645 n 646 h 647 w 648 \ j 649 y 64A : 64B \" 64C = 64D / 64E ' 64F 1 650 3 651 0 652 p 67E v 6A4 \ " a=\' z[$a]+=" H 621" z[a]+=" \ 0 6F0 1 6F1 2 6F2 3 6F3 4 6F4 5 6F5 6 6F6 7 6F7 8 6F8 9 6F9 \ " z[d]+=" d 636" z[f]+=" g 6AF" z[H]+=" a 623 w 624 y 626 z 638" z[h]+=" a 625" z[j]+=" t 637" z[k]+=" t 62B h 62D d 630" z[M]+=" a 622" z[m]+=" t 629" z[n]+=" s 634" z[S]+=" a 670" # Cyrillic characters a=\= z[$a]+=" \ A 410 B 411 V 412 G 413 D 414 E 415 Z 417 I 418 J 419 K 41A L 41B \ M 41C N 41D O 41E P 41F R 420 S 421 T 422 U 423 F 424 H 425 C 426 \ Y 42B \ a 430 b 431 v 432 g 433 d 434 e 435 z 437 i 438 j 439 k 43A l 43B \ m 43C n 43D o 43E p 43F r 440 s 441 t 442 u 443 f 444 h 445 c 446 \ y 44B \ " z[%]+=" \ D 402 G 403 J 408 V 40E Z 416 C 427 S 428 z 436 c 447 s 448 \ d 452 g 453 j 458 v 45E \ " z[A]+=" J 42F" z[a]+=" j 44F" z[c]+=" S 429 s 449" z[E]+=" I 404 J 42D" z[e]+=" j 44D i 454" z[I]+=" I 406 Y 407" z[i]+=" i 456 y 457" z[J]+=" L 409 N 40A K 40C" z[j]+=" l 459 n 45A k 45C" z[O]+=" I 401" z[o]+=" i 451" z[S]+=" D 405" z[s]+=" T 40B d 455 t 45B" z[U]+=" J 42E" z[u]+=" j 44E" z[Z]+=" D 40F" z[z]+=" d 45F" a=\" z[$a]+=" = 42A % 42C" a=\' z[$a]+=" = 44A % 44C" z[3]+=" \ Y 462 y 463 O 46A o 46B F 472 f 473 V 474 v 475 C 480 c 481 \ G 490 g 491 \ " # Greek characters a=% z[$a]+=" \ A 386 E 388 Y 389 I 38A O 38C U 38E W 38F \ a 3Ac e 3Ad y 3Ae i 3AF \ o 3CC u 3CD w 3CE ' 3F4 \ " a=\* z[$a]+=" \ A 391 B 392 G 393 D 394 E 395 Z 396 Y 397 H 398 I 399 K 39A L 39B \ M 39C N 39D C 39E O 39F P 3A0 R 3A1 S 3A3 T 3A4 U 3A5 F 3A6 X 3A7 \ Q 3A8 W 3A9 J 3AA V 3Ab \ a 3B1 b 3B2 g 3B3 d 3B4 e 3B5 z 3B6 y 3b7 h 3B8 i 3B9 k 3Ba l 3BB \ m 3BC n 3BD c 3BE o 3BF p 3C0 r 3C1 s 3C3 t 3C4 u 3C5 f 3C6 x 3C7 \ q 3C8 w 3C9 j 3CA v 3CB \ " a=3 z[$a]+=" \ i 390 u 3B0 T 3DA t 3DB M 3DC m 3DD K 3DE k 3DF P 3E0 p 3E1 j 3F5 \ " z[s]+=" * 3C2" z[G]+=" ' 3D8 , 3D9" # Hebrew characters a=+ z[$a]+=" \ A 5D0 B 5D1 G 5D2 D 5D3 H 5D4 W 5D5 Z 5D6 X 5D7 J 5D9 K 5DB L 5Dc M 5dE \ N 5E0 S 5E1 E 5E2 P 5E4 Q 5E7 R 5E8 T 5EA \ " a=j z[$a]+=" T 5D8 Z 5E5" a=% z[$a]+=" K 5DA M 5DD N 5DF P 5E3 " a=J z[$a]+=" Z 5e6" a=h z[$a]+=" S 5e9" typeset -i 16 -Z 4 ia typeset -i 16 -Z 6 iuni # Extended width characters ^A, ^B, ... (not RFC1345) for (( ia = 0x21; ia < 0x7f; ia++ )); do (( iuni = ia + 0xff00 - 0x20 )) eval a="\$'\\x${ia##0x}'" z[$a]+=" ^ ${iuni##0x}" done # Card suits: here first character is the interesting one for a b in S 2660 H 2661 D 2662 C 2663; do z[$a]+=" c $b" done # Music: ditto for a b in d 2669 8 266a 2 266b b 266d x 266e X 266f; do z[$a]+=" M $b" done # Remaining characters are handled as separate pairs. # We need to remember that the assoc array is keyed by the second character. # Left square bracket a=\( z[$a]+=" < 5B" # Reverse solidus (backslash to you and me). a=/ z[$a]+=" / 5C" # Right square bracket, circumflex a=\> z[$a]+=" ) 5D ' 5E" # Grave a a=\! z[$a]+=" ' 60" # diglyphys for (usually) standard characters {, |, }, ~ a=\! z[$a]+=" ( 7B" z[$a]+=" ! 7C" a=\) z[$a]+=" ! 7D" a=\? z[$a]+=" ' 7E" # non-breaking space z[S]+=" N A0" # inverted exclamation mark z[I]+=" ! A1" # cent z[t]+=" C A2" # pound sterling z[d]+=" P A3" # currency z[u]+=" C A4" # yen z[e]+=" Y A5" # broken bar z[B]+=" B A6" # section z[E]+=" S A7" # lonely diaeresis z[:]+=" ' A8" # copyright z[o]+=" C A9" # spanish feminine ordinal z[a]+=" - AA" # left guillemet a=\< z[$a]+=" < AB" z[O]+=" N AC" # soft hyphen z[-]+=" - AD" # registered z[g]+=" R AE" # lonely macron z[m]+=" ' AF" # degree z[G]+=" D B0" # +/- z[-]+=" + B1" # superscripts z[S]+=" 2 B2 3 B3" # lonely acute a=\' z[$a]+=" ' B4" # micro z[y]+=" M B5" # pilcrow (paragraph) z[I]+=" P B6" # Middle dot z[M]+=" . B7" # Lonely cedilla z[,]+=" ' B8" # Superscript one z[S]+=" 1 B9" # spanish masculine ordinal z[o]+=" - BA" # right guillemet a=\> z[$a]+=" > BB" # fractions z[4]+=" 1 BC 3 BE" z[2]+=" 1 BD" # inverted question mark z[I]+=" ? BF" # multiplication z[X]+=" * D7" # division z[:]+=" - F7" # kra z[k]+=" k 138" # apostrophe n z[n]+=" ' 149" # Lappish ng z[G]+=" N 14A" z[g]+=" n 14B" # OI z[I]+=" O 1A2" z[i]+=" o 1A3" # yr z[r]+=" y 1A6" # ezh z[D]+=" E 1B7" # euro (I invented this but it's logical) z[u]+=" E 20AC" # hyphen z[1]+=" - 2010" # en dash z[N]+=" - 2013" # em dash z[M]+=" - 2014" # horizontal bar, vertical and horizontal ellipsis z[3]+=" - 2015 : 22EE . 22EF" # double vertical line, double low line z[2]+=" ! 2016 = 2017" # dagger and double dagger z[-]+=" / 2020" z[=]+=" / 2021" # per mille z[0]+=" % 2030" # For all, partial derivative, there exists, empty set z[A]+=" F 2200" z[P]+=" d 2202" z[E]+=" T 2203" z[0]+=" / 2205" # Increment, del (nabla), element of, contains, product, sum z[E]+=" D 2206" z[B]+=" N 2207" z[-]+=" ( 2208" a=\) z[$a]+=" - 220b" z[P]+=" * 220F" z[Z]+=" + 2211" # Minus, minus or plus, asterisk, ring, bullet z[2]+=" - 2212" z[+]+=" - 2213" z[-]+=" * 2217" z[b]+=" O 2218 S 2219" # square root, proportional to, infinity z[T]+=" R 221A" a=\( z[$a]+=" 0 221D" z[0]+=" 0 221E" # Female and male z[m]+=" F 2640" z[l]+=" M 2642" zsh_accented_chars=("${(kv)z[@]}") PK[=functions/zflsnuW+A# function zfls { emulate -L zsh [[ $curcontext = :zf* ]] || local curcontext=:zfls # directory hack, see zfcd if [[ $1 = $HOME || $1 = $HOME/* ]]; then 1="~${1#$HOME}" fi zfautocheck -d zftp ls $* # } PK[\gNfunctions/_x_selection_timeoutnuW+A#autoload local x="$argv[(I)-X]" if (( x )); then _message -r "$argv[x + 1]" else _message -e values 'selection timeout' fi PK[JJfunctions/_ztodonuW+A#compdef ztodo _ztodo_entries() { local -a entries entries=(${${${${(f)"$(_call_program ztodo-entry ztodo list)"}#[[:space:]]##}/:[[:space:]]##/:}%:[[:space:]]#}) _describe -t ztodo-entry 'todo entry' entries "$@" } local -a args reply args=( /$'[^\0]#\0'/ ) local -a todo_entry todo_entry=( /$'[^\0]#\0'/ ':ztodo-entry:todo entry:_ztodo_entries' ) _regex_words \ commands "ztodo command" \ 'add:add entry' \ 'del:delete entry:$todo_entry' \ 'clear:clear todo list' \ 'list:show todo list' args+=("$reply[@]") _regex_arguments _ztodo "${args[@]}" _ztodo "$@" PK[Q;functions/_typesetnuW+A#compdef autoload declare export functions integer float local readonly typeset local expl state line func i use curcontext="$curcontext" local fopts="-f -k -z" local popts="-A -E -F -L -R -T -Z -a -g -h -H -i -l -r -x" local -A allargs opt_args local -a args allargs=( A "($fopts -E -F -L -R -T -U -Z -a -i -m)-A[specify that arguments refer to associative arrays]" E "($fopts -A -F -L -R -T -U -Z -a -i -m)-E[floating point, use engineering notation on output]" F "($fopts -A -E -L -R -T -U -Z -a -i -m)-F[floating point, use fixed point decimal on output]" L "($fopts -A -E -F -i)-L+[left justify and remove leading blanks from value]:width" R "($fopts -A -E -F -i)-R+[right justify and fill with leading blanks]:width" T "($fopts -A -E -F -a -g -h -i -l -m -t)-T[tie scalar to array]" U '(-A -E -F -i)-U[keep array values unique and suppress alias expansion for functions]' Uf '-U[suppress alias expansion for functions]' Up '(-E -F -i)-+U[keep array values unique]' X '+X[immediately autoload function]' Z "($fopts -A -E -F -i)-Z+[right justify and fill with leading zeros]:width" a "($fopts -A -E -F -T -i)-a[specify that arguments refer to arrays]" f "($popts)-f[specify that arguments refer to functions]" g "($fopts -T)-+g[do not restrict parameter to local scope]" h "($fopts -T)-+h[hide specialness of parameter]" H "($fopts -T)-+H[hide value of parameter in listings]" i "($fopts -A -E -F -T)-+i[represent internally as an integer]" k "($popts -w -z)-+k[mark function for ksh-style autoloading]" l "($popts -T)-l[convert the value to lowercase]" m '(-A -E -F -T -i)-m[treat arguments as patterns]' p '-p[output parameters in form of calls to typeset]' r '(-f)-+r[mark parameters as readonly]' t '(-T)-+t[tag parameters and turn on execution tracing for functions]' tf '(-T)-+t[turn on execution tracing for functions]' tp '(-T)-+t[tag parameters]' u '-u[convert the value to uppercase or mark function for autoloading]' uf '-u[mark function for autoloadling]' up '-u[convert the value to uppercase]' w '(-k -z)-w[specify that arguments refer to files compiled with zcompile]' x "($fopts)-+x[export parameter]" z "($popts -k -w)-+z[mark function for zsh-style autoloading]" ) use="AEFHLRTUZafghiklmprtuxz" case ${service} in autoload) use="UXktwz" func=f ;; float) use="EFHghlprtux";; functions) use="Ukmtuz" func=f ;; integer) use="Hghilprtux" allargs[i]='-i[specify arithmetic base for output]' \ ;; readonly) use="${use/r/}" ;; local) use="${use/[fkz]/}" ;& export) use="${${use//[gkz]/}/x/}" ;; esac [[ -z "${words[(r)-*[aA]*]}" ]] || func=p [[ -z "${words[(r)-*f*]}" ]] || func=f for ((i=1;i<=$#use;++i)); do args+=( ${allargs[${use[$i]}${${(s::)use[$i]}[(r)[Uut]]:+$func}]} ) done _arguments -C -s -A "-*" -S "${args[@]}" '*::vars:= ->vars_eq' if [[ "$state" = vars_eq ]]; then if [[ $func = f ]]; then if (( $+opt_args[-w] ));then _wanted files expl 'zwc file' _files -g '*.zwc(-.)' elif [[ $service = autoload || -n $opt_args[(i)-[uU]] ]]; then args=(${^fpath}/*(:t)) # Filter out functions already loaded or marked for autoload. args=(${args:#(${(kj.|.)~functions})}) _wanted functions expl 'shell function' compadd -a args else _functions fi elif [[ "$PREFIX" = *\=* ]]; then compstate[parameter]="${PREFIX%%\=*}" compset -P 1 '*=' _value elif (( $+opt_args[-a] || $+opt_args[-A] )); then _parameters -q elif (( $+opt_args[-T] )); then _arguments \ ':scalar parameter:_parameters -g "*scalar*" -q -S "="' \ ':array parameter:_parameters -g "*array*"' \ ':separator character' else _parameters -q -S '=' fi fi PK[JC functions/_gzipnuW+A#compdef gzip gunzip gzcat=gunzip -redirect-,<,gunzip=gunzip -redirect-,>,gzip=gunzip -redirect-,<,gzip=gzip -value-,GZIP,-default- local decompress files expl curcontext="$curcontext" state line ret=1 typeset -A opt_args files=( '*:files:->files' ) case "$service" in *GZIP*) compset -q words=( fake "$words[@]" ) (( CURRENT++ )) files=() ;& gunzip|zcat) decompress=yes ;& gzip) _arguments -C -s -S \ '(--to-stdout --stdout)-c[write on standard output]' \ '(-c --stdout)--to-stdout[write on standard output]' \ '(-c --to-stdout)--stdout[write on standard output]' \ '(--decompress --uncompress)-d[decompress]' \ '(-d --uncompress)--decompress[decompress]' \ '(-d --decompress)--uncompress[decompress]' \ '(--force)-f[force overwrite]' \ '(-f)--force[force overwrite]' \ '(--help)-h[display help message]' \ '(-h)--help[display help message]' \ '(--list)-l[list compressed file contents]' \ '(-l)--list[list compressed file contents]' \ '(--license)-L[display software license]' \ '(-L)--license[display software license]' \ '(--no-name)-n[do not save or restore the original name and time stamp]' \ '(-n)--no-name[do not save or restore the original name and time stamp]' \ '(--name)-N[save or restore the original name and time stamp]' \ '(-N)--name[save or restore the original name and time stamp]' \ '(--quiet --silent)-q[suppress all warnings]' \ '(-q --silent)--quiet[suppress all warnings]' \ '(-q --quiet)--silent[suppress all warnings]' \ '(--recursive)-r[operate recursively on directories]' \ '(-r)--recursive[operate recursively on directories]' \ '(--suffix)-S+[specify suffix for compressed files]:suffix:' \ '(-S)--suffix=[specify suffix for compressed files]:suffix:' \ '(--test)-t[test compressed file integrity]' \ '(-t)--test[test compressed file integrity]' \ '(--verbose)-v[verbose mode]' \ '(-v)--verbose[verbose mode]' \ '(--version)-V[display version number]' \ '(-V)--version[display version number]' \ '( -1 -2 -3 -4 -5 -6 -7 -8 -9 --best)--fast' \ '(--fast -2 -3 -4 -5 -6 -7 -8 -9 --best)-1' \ '(--fast -1 -3 -4 -5 -6 -7 -8 -9 --best)-2' \ '(--fast -1 -2 -4 -5 -6 -7 -8 -9 --best)-3' \ '(--fast -1 -2 -3 -5 -6 -7 -8 -9 --best)-4' \ '(--fast -1 -2 -3 -4 -6 -7 -8 -9 --best)-5' \ '(--fast -1 -2 -3 -4 -5 -7 -8 -9 --best)-6' \ '(--fast -1 -2 -3 -4 -5 -6 -8 -9 --best)-7' \ '(--fast -1 -2 -3 -4 -5 -6 -7 -9 --best)-8' \ '(--fast -1 -2 -3 -4 -5 -6 -7 -8 --best)-9' \ '(--fast -1 -2 -3 -4 -5 -6 -7 -8 -9 )--best' \ "$files[@]" && ret=0 ;; esac case "$state" in files) (( $+opt_args[-d] || $+opt_args[--decompress] || $+opt_args[--uncompress] || $+opt_args[-l] || $+opt_args[--list] || $+opt_args[-t] || $+opt_args[--test] )) && decompress=yes if (( $+opt_args[-r] || $+opt_args[--recursive] )); then if [[ -z "$decompress" ]]; then _description directories expl 'directory to compress' _files "$expl[@]" -/ && return else _description directories expl 'compressed directory' _files "$expl[@]" -/ && return fi else if [[ -z "$decompress" ]]; then _description files expl 'file to compress' _files "$expl[@]" -g '^*.(([tT]|)[gG]|)[zZ](-.)' && return else _description files expl 'compressed file' _files "$expl[@]" -g '*.(([tT]|)[gG]|)[zZ](-.)' && return fi fi ;; esac return ret PK[w!@functions/_history_modifiersnuW+A#autoload # Complete history-style modifiers; the first : will have # been matched and compset -p 1'd. # The single argument is the type of context: # h history # q glob qualifier # p parameter local -a list local type=$1 delim expl integer global while true; do if [[ -n $PREFIX ]]; then local char=$PREFIX[1] global=0 compset -p 1 case $char in ([hretpqQxlu\&]) # single character modifiers ;; (s) # match delimiter string delimiter string delimiter if [[ -z $PREFIX ]]; then _delimiters modifier-s return fi delim=$PREFIX[1] compset -p 1 if ! compset -P "[^${delim}]#${delim}[^${delim}]#${delim}"; then if compset -P "[^${delim}]#${delim}"; then _message "replacement string" else _message "original string" fi return fi ;; (g) global=1 continue ;; esac # modifier completely matched, see what's next. compset -P : && continue # if there's something other than colon next, bummer [[ -n $PREFIX ]] && return 1 list=("\::modifier") [[ $type = q ]] && list+=("):end of qualifiers") # strictly we want a normal suffix if end of qualifiers _describe -t delimiters "delimiter" list -Q -S '' return else list=( "s:substitute string" "&:repeat substitution" ) if (( ! global )); then list+=( "a:absolute path" "A:absolute path resolving symbolic links" "g:globally apply s or &" "h:head - strip trailing path element" "t:tail - strip directories" "r:root - strip suffix" "e:leave only extension" "Q:strip quotes" "l:lower case all words" "u:upper case all words" ) [[ $type = h ]] && list+=( "p:print without executing" "x:quote words, breaking on whitespace" ) [[ $type = [hp] ]] && list+=("q:quote to escape further substitutions") fi _describe -t modifiers "modifier" list -Q -S '' return fi done PK[??functions/_perl_modulesnuW+A#compdef pmpath pmvers pmdesc pmload pmexp pmeth pmls pmcat pman pmfunc podgrep podtoc podpath # # _perl_modules - zsh completion function # # Adam Spiers # # Calculate all installed Perl modules. The result is cached # for future use. # # Options: # # -t[types]: indicate file types; currently the only one is -tP, # to include .pod files as well as modules. # # --perl-hierarchy=...: restrict results to modules under this hierarchy. # Note that this does not affect the filesystem searching or caching, # which always collect all results on the premise that anyone using # completion of Perl modules will use the results in various contexts, # so this only affects the results compadd'd. # # --strip-prefix: when using --perl-hierarchy, strip off that prefix when # passing to compadd. # # All other options passed onto compadd. # # Available styles: # # * try-to-use-pminst # # Set this if you have pminst and want to use it. The zsh code # actually produces better results because pminst misses modules of # the form Foo/bar/Baz.pm through its clumsy -d && /^[A-Z]/ && prune # algorithm (the zsh code does almost the same, but only misses # modules which don't begin with an uppercase letter). _perl_modules () { # Set a sensible default caching policy. This has to be done inside # this function otherwise we wouldn't know the context for the style. local update_policy sufpat=".pm" with_pod local restrict_hierarchy='' local -i strip_perl_prefix zstyle -s ":completion:${curcontext}:" cache-policy update_policy if [[ -z "$update_policy" ]]; then zstyle ":completion:${curcontext}:" cache-policy \ _perl_modules_caching_policy fi if [[ -n $argv[(r)--perl-hierarchy=*] ]]; then restrict_hierarchy="${argv[(r)--perl-hierarchy=*]#--perl-hierarchy=}" restrict_hierarchy="${restrict_hierarchy%::}::" argv[(r)--perl-hierarchy=*]=() fi if [[ -n $argv[(r)--strip-prefix] ]]; then strip_perl_prefix=1 argv[(r)--strip-prefix]=() fi if [[ -n $argv[(r)-tP] ]]; then argv[(r)-tP]=() sufpat="(.pm|.pod)" with_pod=_with_pod fi local perl=${words[1]%doc} perl_modules if whence $perl >/dev/null; then perl_modules=_${${perl//[^[:alnum:]]/_}#_}_modules$with_pod elif (( ${+commands[perl]} )); then perl=perl perl_modules=_perl_modules$with_pod else perl= perl_modules=_unknown_perl_modules$with_pod fi if ( [[ ${(P)+perl_modules} -eq 0 ]] || _cache_invalid $perl_modules ) && ! _retrieve_cache ${perl_modules#_}; then if zstyle -t ":completion:${curcontext}:modules" try-to-use-pminst && (( ${+commands[pminst]} )); then set -A $perl_modules $(pminst) else local inc libdir new_pms if [[ ${+perl} -eq 1 ]]; then inc=( $( $perl -e 'print "@INC"' ) ) else # If perl isn't there, one wonders why the user's trying to # complete Perl modules. Maybe her $path is wrong? _message "didn't find perl on \$PATH; guessing @INC ..." inc=( /usr/lib/perl5{,/{site_perl/,}<5->.([0-9]##)}(N) ${(s.:.)PERL5LIB} ) fi typeset -agU $perl_modules # $perl_modules is global, no duplicates set -A $perl_modules for libdir in $inc; do # Ignore cwd - could be too expensive e.g. if we're near / if [[ $libdir == '.' ]]; then continue; fi # Find all modules if [[ -d $libdir && -x $libdir ]]; then new_pms=( $libdir/{[A-Z]*/***/,}*${~sufpat}~*blib* ) new_pms=( "${(@)new_pms##$libdir/##}" ) fi # Convert to Perl nomenclature new_pms=( ${new_pms:r:fs#/#::#} ) set -A $perl_modules $new_pms ${(P)perl_modules} done fi _store_cache ${perl_modules#_} $perl_modules fi # Nothing above here should have filtered the results per-caller, so that # the cache is always complete. From here on, it's safe to filter. local -a perl_subset if [[ -n $restrict_hierarchy ]]; then perl_subset=( ${(PM)perl_modules:#${restrict_hierarchy}*} ) if (( strip_perl_prefix )); then perl_subset=( ${perl_subset#$restrict_hierarchy} ) fi perl_modules=perl_subset fi local expl _wanted modules expl 'Perl module' compadd "$@" -a - $perl_modules } _perl_modules_caching_policy () { local _perllocals local -a oldp # rebuild if cache is more than a week old oldp=( "$1"(mw+1) ) (( $#oldp )) && return 0 _perllocals=( /usr/lib/perl5/**/perllocal.pod ) if (( $#_perllocals )); then for pod in $_perllocals; do [[ "$pod" -nt "$1" ]] && return 0 done fi return 1 } _perl_modules "$@" PK[Fׇfunctions/_xwitnuW+A#compdef xwit local word=$'[^\0]#\0' local nul=$'\0' local guard='-_xwit_guard ${match[1]%?}' _xwit_guard () { local opt="$1" o (( no[$opt]-- )) for o in ${=eo[$opt]}; do no[$o]=0 done : } _xwit_compopts () { local expl local opt tmp tmp=() for opt in ${(k)no[(R)*~0]} do if (( $+desc[$opt] )); then tmp=("$tmp[@]" "$opt:$desc[$opt]") else tmp=("$tmp[@]" "$opt") fi done _describe -o options tmp -- || _describe -o options allopts -- # compadd "$expl[@]" - ${(k)no[(R)*~0]} || # compadd "$expl[@]" - ${(k)no} } _regex_arguments _xwit_parse \ "/$word/" \ \( "/-display$nul/" "$guard" "/$word/" ':option-display:display:_x_display' \ \| "/-(sync|pop|open|iconify|unmap|root|current|select|(no|)(save|backingstore|saveunder))$nul/" "$guard" \ \| "/-resize$nul/" "$guard" \ "/$word/" ':option-resize-width:width:' \ "/$word/" ':option-resize-height:height:' \ \| "/-rows$nul/" "$guard" "/$word/" ':option-rows:rows:' \ \| "/-columns$nul/" "$guard" "/$word/" ':option-columns:columns:' \ \| "/-move$nul/" "$guard" \ "/$word/" ':option-move-x:x:' \ "/$word/" ':option-move-y:y:' \ \| "/-rmove$nul/" "$guard" \ "/$word/" ':option-rmove-x:x:' \ "/$word/" ':option-rmove-y:y:' \ \| "/-warp$nul/" "$guard" \ "/$word/" ':option-warp-x:x:' \ "/$word/" ':option-warp-y:y:' \ \| "/-rwarp$nul/" "$guard" \ "/$word/" ':option-rwarp-x:x:' \ "/$word/" ':option-rwarp-y:y:' \ \| "/-colormap$nul/" "$guard" \ "/$word/" ':option-colormap:colormapid:_x_colormapid' \ \| "/-(name|label)$nul/" "$guard" \ "/$word/" ':option-name:name:_x_name' \ \| "/-iconname$nul/" "$guard" \ "/$word/" ':option-name:iconname:_x_name' \ \| "/-bitmap$nul/" "$guard" \ "/$word/" ':option-bitmap:bitmap file:_files -g *.xbm\(-.\)' \ \| "/-mask$nul/" "$guard" \ "/$word/" ':option-mask:mask file:_files -g *.xbm\(-.\)' \ \| "/-iconmove$nul/" "$guard" \ "/$word/" ':option-iconmove-x:x:' \ "/$word/" ':option-iconmove-y:y:' \ \| "/-id$nul/" "$guard" "/$word/" ':option-id:window id:_x_window' \ \| "/-(no|)keyrepeat$nul/" "$guard" \ \( "/[0-9]##$nul/" ':option-keyrepeat-keycode:keycode:{[[ -prefix [0-9]# ]] && _message -e keycodes keycode}' \ \( "/-$nul/" "/[0-9]##$nul/" \ ':option-keyrepeat-last-keycode:last keycode:{[[ -prefix [0-9]# ]] && _message -e keycodes "last keycode"}' \| \) \) \# \ \| "/-names$nul/" "$guard" \ "/$word/" ':option-names:window name:_x_window -n' \# \ \| "/[]/" ':options:option:_xwit_compopts' \ \) \# _xwit () { local expl allopts typeset -A desc no eo desc=( -display 'specify display' -sync 'synchronous mode' -pop 'pop up window' -open 'pop up window' -iconify 'iconify window' -unmap 'iconify window by unmapping' -root 'select the root window' -current 'select the window under current pointer' -select 'select the window interactively' -save 'activate screen saver' -backingstore 'enable backingstore' -saveunder 'enable saveunder' -nosave 'reset screen saver' -nobackingstore 'disable backingstore' -nosaveunder 'disable saveunder' -resize 'resize window' -rows 'resize window rows' -columns 'resize window columns' -move 'move window' -rmove 'move window relatively' -warp 'warp pointer' -rwarp 'warp pointer relatively' -colormap 'install colormap' -name 'specify window name' -label 'specify window name' -iconname 'specify icon name' -bitmap 'specify icon bitmap' -mask 'specify icon mask' -iconmove 'move icon' -id 'select the window by window-ID' -keyrepeat 'enable keyrepeat' -nokeyrepeat 'disable keyrepeat' -names 'select the window by name' ) no=( -display 1 -sync 1 -pop 1 -open 0 -iconify 1 -unmap 1 -root 1 -current 1 -select 1 -save 1 -backingstore 1 -saveunder 1 -nosave 1 -nobackingstore 1 -nosaveunder 1 -resize 1 -rows 1 -columns 1 -move 1 -rmove 1 -warp 1 -rwarp 1 -colormap 1 -name 1 -label 0 -iconname 1 -bitmap 1 -mask 1 -iconmove 1 -id 1 -keyrepeat 1 -nokeyrepeat 1 -names 1 ) allopts=() for opt in ${(k)no} do if (( $+desc[$opt] )); then allopts=("$allopts[@]" "$opt:$desc[$opt]") else allopts=("$allopts[@]" "$opt") fi done eo=( -root '-root -current -select -id -names' -current '-root -current -select -id -names' -select '-root -current -select -id -names' -id '-root -current -select -id -names' -names '-root -current -select -id -names' ) _xwit_parse } _xwit "$@" PK[3UUfunctions/VCS_INFO_get_data_p4nuW+A## vim:ft=zsh ## perforce support by: Phil Pennock ## Distributed under the same BSD-ish license as zsh itself. # XXX: This soooo needs to be cached setopt localoptions extendedglob local p4base a b local -A p4info local -xA hook_com ${vcs_comm[cmd]} info | while IFS=: read a b; do p4info[${a// /_}]="${b## #}"; done p4base=${vcs_comm[basedir]} # We'll use the client name as the branch; close enough. local p4branch change # We'll use the latest change number to which the hierarchy from # here down is synced as the revision. # I suppose the following might be slow on a tortuous client view. change="${${$(${vcs_comm[cmd]} changes -m 1 ...\#have)##Change }%% *}" zstyle -s ":vcs_info:${vcs}:${usercontext}:${rrn}" branchformat p4branch || p4branch="%b:%r" hook_com=( branch "${p4info[Client_name]}" revision "${change}" ) if VCS_INFO_hook 'set-branch-format' "${p4branch}"; then zformat -f p4branch "${p4branch}" "b:${hook_com[branch]}" "r:${hook_com[revision]}" else p4branch=${hook_com[branch-replace]} fi hook_com=() VCS_INFO_formats '' "${p4branch}" "${p4base}" '' '' "$change" '' return 0 PK['ppfunctions/_graphicsmagicknuW+A#compdef gm local state line expl formats curcontext="$curcontext" typeset -A opt_args formats=jpg:jpeg:tiff:miff:ras:bmp:cgm:dcx:ps:eps:fig:fits:fpx:gif:mpeg:pbm:pgm:ppm:pcd:pcl:pdf:pcx:png:rad:rgb:rgba:rle:sgi:html:shtml:tga:ttf:uil:xwd:xbm:xpm:yuv if (( $# )); then _files "$@" -g "*.(#i)(${~formats//:/|})(-.)" return fi if (( CURRENT == 2 )); then compadd animate benchmark compare composite conjure convert display help identify import mogrify montage version else case "$words[2]" in (display) _arguments -M 'm:{a-z}={A-Z}' \ '*-backdrop[use full screen]' \ '*-background:color:_x_color' \ '*-border:border size (x)' \ '*-bordercolor:color:_x_color' \ '*-borderwidth:geometry' \ '*-cache[specify memory available to the pixel cache]:memory (MB)' \ '*-colormap:colormap type:(shared private)' \ '*-colors:preferred number of colors' \ '*-colorspace:colorspace type:(GRAY OHTA RGB Transparent XYZ YCbCr YIQ YPbPr YUV CMYK)' \ '*-comment:comment string' \ '*-compress:image compression type:(None BZip Fax Group4 JPEG LZW RunlengthEncoded Zip)' \ '*-contrast[enhance contrast]' \ '*+contrast[reduce contrast]' \ '*-crop:crop image (x{+-}{+-}{%%})' \ '*-debug' \ '*-delay:delay for next image (1/100ths of a second)' \ '*-density:image resolution (x in pixels)' \ '*-despeckle[reduce speckles in image]' \ '*-display:display:_x_display' \ '*-dispose:GIF disposal method:((0:no\ disposal 1\:don'\''t\ dispose\ between\ frames 2\:overwrite\ frame\ with\ background\ color 3\:overwrite\ with\ previous\ frame))' \ '*-dither[apply dithering]' \ '*-edge:edge detection factor (0.0 - 99.9%%)' \ '*-endian:image endianess:(MSB LSB)' \ '*+endian' \ '*-enhance[enhance noisy image]' \ '*-filter:filter type for resizing:(Point Box Triangle Hermite Hanning Hamming Blackman Gaussian Quadratic Cubic Catrom Mitchell Lanczos Bessel Sinc)' \ '*-flip[vertical mirror image]' \ '*-flop[horizontal mirror image]' \ '*-font:font:_x_font' \ '*-foreground:color:_x_color' \ '*-frame:border dimensions (x++)' \ '*-gamma[gamma correction level]:gamma correction level ( or //)' \ '*+gamma[gamma correction level (don'\''t change pixels)]:gamma correction level ( or //)' \ '*-geometry:window geometry (x{+-}{+-}{%%}{!}{<}{>})' \ '(- *)-help[display help information]' \ '*-iconGeometry:geometry:_x_geometry' \ '*-iconic' \ '*-immutable[disallow image modifications]' \ '*-interlace:interlacing scheme:(None Line Plane Partition)' \ '*-label:label string' \ '*-magnify:factor' \ '*-map:colormap type for display:(best default gray red green blue)' \ '*-matte[store matte channel]' \ '*-mattecolor:color:_x_color' \ '*-monochrome[transform to black and white]' \ '*-name:image name' \ '*-negate[invert image]' \ '*+negate[invert only grayscale]' \ '*-noop' \ '*-page:geometry of image canvas (x{+-}{+-}{%%}{!}{<}{>}):(11x17 Ledger Legal Letter LetterSmall ArchE ArchD ArchC ArchB ArchA A0 A1 A2 A3 A4 A4Small A5 A6 A7 A8 A9 A10 B0 B1 B2 B3 B4 B5 C0 C1 C2 C3 C4 C5 C6 Flsa Flse HalfLetter)' \ '*-quality:JPEG/MIFF/PNG compression level' \ '*-raise:3-D edges (raised)' \ '*+raise:3-D edges (lowered)' \ '*-remote:remote command (file name):_imagemagick' \ '*-roll:image roll offset ({+-}{+-})' \ '*-rotate:rotation (degrees{<}{>})' \ '*-sample:scale factors (x)' \ '*-sampling_factor:sampling factor (x)' \ '*-scenes:image scene number' \ '*-segment:cluster pixel number' \ '*-shared_memory' \ '*-sharpen:sharpening factor (0.0 - 99.9%%)' \ '*-size:image size (x+)' \ '*-text_font:font:_x_font' \ '*-texture:background texture image:_imagemagick' \ '*-title:image title' \ '*-treedepth:color reduction tree depth' \ '*-trim' \ '*-update:redisplay test time (seconds)' \ '*-use_pixmap' \ '*-verbose' \ '*-visual:visual to use for display:(StaticGray GrayScale StaticColor PseudoColor TrueColor DirectColor default)' \ '*-window:window ID to display image in:_x_window' \ '*-window_group' \ '*-write:output filename:_files' \ '*:picture file:_imagemagick' && return ;; (animate) _arguments -M 'm:{a-z}={A-Z}' \ '*-backdrop[use full screen]' \ '*-background:color:_x_color' \ '*-bordercolor:color:_x_color' \ '*-borderwidth:geometry' \ '*-cache[specify memory available to the pixel cache]:memory (MB)' \ '*-chop:x{+-}{+-}' \ '*-colormap:colormap type:(Shared Private)' \ '*-colors:preferred number of colors' \ '*-colorspace:colorspace type:(GRAY OHTA RGB Transparent XYZ YCbCr YIQ YPbPr YUV CMYK)' \ '*-crop:crop image (x{+-}{+-})' \ '*-debug' \ '*-delay:delay for next image (1/100ths of a second)' \ '*-density:image resolution (x in pixels)' \ '*-depth:image depth:(8 16)' \ '*-display:display:_x_display' \ '*-dither[apply dithering]' \ '*-font:font:_x_font' \ '*-foreground:color:_x_color' \ '*-gamma[gamma correction level]:gamma correction level ( or //)' \ '*+gamma[gamma correction level (don'\''t change pixels)]:gamma correction level ( or //)' \ '*-geometry:window geometry (x{+-}{+-}{%%}{!}{<}{>})' \ '(- *)-help[display help information]' \ '*-iconGeometry:geometry:_x_geometry' \ '*-iconic' \ '*-interlace:interlacing scheme:(None Line Plane Partition)' \ '*-map:colormap type for display:(best default gray red green blue)' \ '*-matte[store matte channel]' \ '*-mattecolor:color:_x_color' \ '*-monochrome[transform to black and white]' \ '*-name:image name' \ '*-noop' \ '*-pause:delay (seconds)' \ '*-remote:remote command (file name):_imagemagick' \ '*-rotate:rotation (degrees{<}{>})' \ '*-scenes:image scene number' \ '*-shared_memory' \ '*-size:image size (x+)' \ '*-text_font:font:_x_font' \ '*-title:image title' \ '*-treedepth:color reduction tree depth' \ '*-trim' \ '*-verbose[print image information]' \ '*-visual:visual to use for display:(StaticGray GrayScale StaticColor PseudoColor TrueColor DirectColor default)' \ '*-window:window ID to display image in:_x_window' \ '*:picture file:_imagemagick' && return ;; (import) _x_arguments -M 'm:{a-z}={A-Z}' \ '-adjoin[join images]' \ '-border:border size (x):' \ '-bordercolor:color:_x_color' \ '-cache[specify memory available to the pixel cache]:memory (MB)' \ '-colors:preferred number of colors' \ '-colorspace:colorspace type:(GRAY OHTA RGB Transparent XYZ YCbCr YIQ YPbPr YUV CMYK)' \ '-comment:comment string' \ '-crop:crop image (x{+-}{+-}{%%})' \ '-debug' \ '-delay:delay for next image (1/100ths of a second)' \ '-density:resolution in pixels of image (x)' \ '-depth:image depth:(8 16)' \ '-descend[descend window hierarchy]' \ '-dispose:GIF disposal method:((0:no\ disposal 1\:don'\''t\ dispose\ between\ frames 2\:overwrite\ frame\ with\ background\ color 3\:overwrite\ with\ previous\ frame))' \ '-dither[apply dithering]' \ '(+endian)-endian:image endianess:(MSB LSB)' \ '(-endian)+endian' \ '-frame[include window manager frame]' \ '(- *)-help[display help information]' \ '-interlace:interlacing scheme:(None Line Plane Partition)' \ '-label:label string' \ '-monochrome[transform to black and white]' \ '-negate[invert image]' \ '+negate[invert only grayscale]' \ '-page:geometry of image canvas (x{+-}{+-}{%%}{!}{<}{>}):(11x17 Ledger Legal Letter LetterSmall ArchE ArchD ArchC ArchB ArchA A0 A1 A2 A3 A4 A4Small A5 A6 A7 A8 A9 A10 B0 B1 B2 B3 B4 B5 C0 C1 C2 C3 C4 C5 C6 Flsa Flse HalfLetter)' \ '-pause:delay (seconds)' \ '-ping' \ '-pointsize:Postscript font size' \ '-quality:JPEG/MIFF/PNG compression level' \ '-resize:size (x{%%}{@}{!}{<}{>})' \ '-rotate:rotation (degrees{<}{>})' \ '-sampling_factor:sampling factor (x)' \ '-scene:number of screen snapshots' \ '-screen[get root window]' \ '-silent[be quiet]' \ '-snaps:number' \ '-transparent:transparent color:_x_color' \ '-treedepth:color reduction tree depth' \ '-trim' \ '-type:image type:(Bilevel Grayscale Palette PaletteMatte TrueColor TrueColorMatte ColorSeparation ColorSeparationMatte Optimize)' \ '-verbose[print image information]' \ '-window:window ID to get:_x_window' \ ':output file:_files' && return ;; (montage) _arguments -M 'm:{a-z}={A-Z}' \ '*-adjoin[join images]' \ '*-background:color:_x_color' \ '*-blur:blur factor (0.0 - 99.9%%)' \ '*-bordercolor:color:_x_color' \ '*-borderwidth:geometry' \ '*-cache[specify memory available to the pixel cache]:memory (MB)' \ '*-colors:preferred number of colors' \ '*-colorspace:colorspace type:(GRAY OHTA RGB Transparent XYZ YCbCr YIQ YPbPr YUV CMYK)' \ '*-comment:comment string' \ '*-compose:image composition type:(Over In Out Atop Xor Plus Minus Add Subtract Difference Bumpmap Replace ReplaceRed ReplaceGreen ReplaceBlue ReplaceMatte)' \ '*-compress:image compression type:(None BZip Fax Group4 JPEG LZW RunlengthEncoded Zip)' \ '*-crop:crop image (x{+-}{+-}{%%})' \ '*-debug' \ '*-density:resolution in pixels of image (x)' \ '*-depth:image depth:(8 16)' \ '*-display:display:_x_display' \ '*-dispose:GIF disposal method:((0:no\ disposal 1\:don'\''t\ dispose\ between\ frames 2\:overwrite\ frame\ with\ background\ color 3\:overwrite\ with\ previous\ frame))' \ '*-dither[apply dithering]' \ '*+dither[render Postscript without aliasing]' \ '*-draw:drawing primitive:compadd -S "\\ " - rectangle circle ellipse polygon color matte text image' \ '*-endian:image endianess:(MSB LSB)' \ '*+endian' \ '*-filter:filter type for resizing:(Point Box Triangle Hermite Hanning Hamming Blackman Gaussian Quadratic Cubic Catrom Mitchell Lanczos Bessel Sinc)' \ '*-frame[draw frame around image]' \ '*-font:annotation font:_x_font' \ '*-gamma[gamma correction level]:gamma correction level ( or //)' \ '*+gamma[gamma correction level (don'\''t change pixels)]:gamma correction level ( or //)' \ '*-geometry:window geometry (x{+-}{+-}{%%}{!}{<}{>})' \ '*-gravity:image gravity:(Center North NorthEast East SouthEast South SouthWest West NorthWest)' \ '(- *)-help[display help information]' \ '*-interlace:interlacing scheme:(None Line Plane Partition)' \ '*-label:label string' \ '*-matte[store matte channel]' \ '*-mattecolor:color:_x_color' \ '*-mode:montage type:(Frame Unframe Concatenate)' \ '*-monochrome[transform to black and white]' \ '*-noop' \ '*-page:geometry of image canvas (x{+-}{+-}{%%}{!}{<}{>}):(11x17 Ledger Legal Letter LetterSmall ArchE ArchD ArchC ArchB ArchA A0 A1 A2 A3 A4 A4Small A5 A6 A7 A8 A9 A10 B0 B1 B2 B3 B4 B5 C0 C1 C2 C3 C4 C5 C6 Flsa Flse HalfLetter)' \ '*-pen:font color:_x_color' \ '*-pointsize:Postscript font size' \ '*-quality:JPEG/MIFF/PNG compression level' \ '*-resize:size (x{%%}{@}{!}{<}{>})' \ '*-rotate:rotation (degrees{<}{>})' \ '*-sampling_factor:sampling factor (x)' \ '*-scenes:image scene number' \ '*-shadow[add shadow]' \ '*-sharpen:sharpening factor (0.0 - 99.9%%)' \ '*-size:image size (x+)' \ '*-stroke:color:_x_color' \ '*-texture:background texture image:_imagemagick' \ '*-tile:number of tiles (x)' \ '*-title:image title' \ '*-transparent:transparent color:_x_color' \ '*-treedepth:color reduction tree depth' \ '*-trim' \ '*-type:image type:(Bilevel Grayscale Palette PaletteMatte TrueColor TrueColorMatte ColorSeparation ColorSeparationMatte Optimize)' \ '*-verbose[print image information]' \ '*:picture file:_imagemagick' && return ;; (convert) _arguments -C -M 'm:{a-z}={A-Z}' \ '-adjoin[join images]' \ '-affine[drawing transform matrix]:matrix' \ '-antialias[remove pixel aliasing]' \ '-append[append image sequence]' \ '-average[average image sequence]' \ '-background[specify background color]:color:_x_color' \ '-blur:blur factor (0.0 - 99.9%%)' \ '-border:border size (x)' \ '-bordercolor:border color:_x_color' \ '-box:annotation bounding box color:_x_color' \ '-cache[specify memory available to the pixel cache]:memory (MB)' \ '-channel:channel:(Red Green Blue Opacity Cyan Magenta Yellow Black)' \ '-charcoal:charcoal drawing factor' \ '-chop:x{+-}{+-}' \ '-clip' \ '-coalesce[merge image sequence]' \ '-colorize:colorization amount ( or //)' \ '-colors:preferred number of colors' \ '-colorspace:colorspace type:(GRAY OHTA RGB Transparent XYZ YCbCr YIQ YPbPr YUV CMYK)' \ '-comment:comment string' \ '-compress:image compression type:(None BZip Fax Group4 JPEG LZW RunlengthEncoded Zip)' \ '-contrast[enhance contrast]' \ '+contrast[reduce contrast]' \ '-crop:crop image (x{+-}{+-}{%%})' \ '-cycle:image colormap shift' \ '-debug' \ '-deconstruct[break down image sequence into parts]' \ '-delay:delay for next image (1/100ths of a second)' \ '-density:resolution in pixels of image (x)' \ '-depth:image depth:(8 16)' \ '-despeckle[reduce speckles in image]' \ '-display:display:_x_display' \ '-dispose:GIF disposal method:((0:no\ disposal 1\:don'\''t\ dispose\ between\ frames 2\:overwrite\ frame\ with\ background\ color 3\:overwrite\ with\ previous\ frame))' \ '-dither[apply dithering]' \ '-draw:drawing primitive:compadd -S "\\ " - rectangle circle ellipse polygon color matte text image' \ '-edge:edge detection factor (0.0 - 99.9%%)' \ '-emboss[emboss image]' \ '(+endian)-endian:image endianess:(MSB LSB)' \ '(-endian)+endian' \ '-enhance[enhance image]' \ '-equalize[histogram equalization]' \ '-fill[specify color to use when filling a graphic primitive]:color:_x_color' \ '-filter:filter type for resizing:(Point Box Triangle Hermite Hanning Hamming Blackman Gaussian Quadratic Cubic Catrom Mitchell Lanczos Bessel Sinc)' \ '-flatten[flatten a sequence of images]' \ '-flip[vertical mirror image]' \ '-flop[horizontal mirror image]' \ '-font:annotation font:_x_font' \ '-frame:border dimensions (x++)' \ '-fuzz:maximum distance for equal colors' \ '-gamma[gamma correction level]:gamma correction level ( or //)' \ '+gamma[gamma correction level (don'\''t change pixels)]:gamma correction level ( or //)' \ '-geometry:window geometry (x{+-}{+-}{%%}{!}{<}{>})' \ '-gravity:image gravity:(Center North NorthEast East SouthEast South SouthWest West NorthWest)' \ '-implode:implosion factor (0.0 - 99.9%%)' \ '-interlace:interlacing scheme:(None Line Plane Partition)' \ '-label:label string' \ '-layer:layer type:(Red Green Blue Matte)' \ '-linewidth:line width' \ '-loop:number of iterations (GIF animation)' \ '-map[single image colormap file]:picture file for colors:_imagemagick' \ '+map[all images colormap file]:picture file for colors:_imagemagick' \ '-matte[store matte channel]' \ '-modulate:,,' \ '-monochrome[transform to black and white]' \ '-morph[morph image sequence]' \ '-negate[invert image]' \ '+negate[invert only grayscale]' \ '-noise[noise peak elimination]' \ '+noise:noise type:(Uniform Gaussian Multiplicative Impulse Laplacian Poisson)' \ '-normalize[use full color value range]' \ '-opaque:image pen color:_x_color' \ '-page:geometry of image canvas (x{+-}{+-}{%%}{!}{<}{>}):(11x17 Ledger Legal Letter LetterSmall ArchE ArchD ArchC ArchB ArchA A0 A1 A2 A3 A4 A4Small A5 A6 A7 A8 A9 A10 B0 B1 B2 B3 B4 B5 C0 C1 C2 C3 C4 C5 C6 Flsa Flse HalfLetter)' \ '-paint:oil painting radius' \ '-pen:font color:_x_color' \ '-pointsize:Postscript font size' \ '-preview:image preview type:(Rotate Shear Roll Hue Saturation Brightness Gamma Spiff Dull Grayscale Quantize Despeckle ReduceNoise AddNoise Sharpen Blur Threshold Edge Detect Spread Shade Raise Segment Solarize Swirl Implode Wave OilPaint CharcoalDrawing JPEG)' \ '-profile:information profile:->profile' \ '-quality:JPEG/MIFF/PNG compression level' \ '-raise:lighten or darken edges (x)' \ '-region:image region (x{+-}{+-})' \ '-roll:image roll offset ({+-}{+-})' \ '-rotate:rotation (degrees{<}{>})' \ '-sample:scale factors (x)' \ '-scene:image scene number' \ '-seed:random number seed' \ '-segment:segment thresholds (x)' \ '-shade:image shading (x)' \ '-sharpen:sharpening factor (0.0 - 99.9%%)' \ '-shear:shearing angles (x in degrees)' \ '-size:image size (x+)' \ '-solarize:solarization threshold' \ '-spread:neighborhood size' \ '-swirl:swirl tightness' \ '-texture:background texture image:_imagemagick' \ '-threshold:threshold for maximum intensity' \ '-transparency:transparent color:_x_color' \ '-treedepth:color reduction tree depth' \ '-units:image resolution type:(Undefined PixelsPerInch PixelsPerCentimeter)' \ '-verbose[print image information]' \ '-view:FlashPix viewing parameters' \ '-wave:sine wave parameters (x)' \ '*:picture file:_imagemagick' && return if [[ "$state" = profile ]]; then if compset -P '*:'; then _files else _wanted prefixes expl 'profile type' compadd icc: iptc: fi return fi ;; (composite) _arguments -M 'm:{a-z}={A-Z}' \ '-blend:blending factor (0.0 - 99.9%%)' \ '-colors:preferred number of colors' \ '-colorspace:colorspace type:(GRAY OHTA RGB Transparent XYZ YCbCr YIQ YPbPr YUV CMYK)' \ '-comment:comment string' \ '-compose:image composition type:(Over In Out Atop Xor Plus Minus Add Subtract Difference Bumpmap Replace ReplaceRed ReplaceGreen ReplaceBlue ReplaceMatte)' \ '-compress:image compression type:(None BZip Fax Group4 JPEG LZW RunlengthEncoded Zip)' \ '-density:resolution in pixels of image (x)' \ '-displace:displacements scales (x)' \ '-display:display:_x_display' \ '-dispose:GIF disposal method:((0:no\ disposal 1\:don'\''t\ dispose\ between\ frames 2\:overwrite\ frame\ with\ background\ color 3\:overwrite\ with\ previous\ frame))' \ '-dither[apply dithering]' \ '+dither[render Postscript without aliasing]' \ '-font:normal text font:_x_font' \ '-geometry:window geometry (x{+-}{+-}{%%}{!}{<}{>})' \ '-gravity:image gravity:(Center North NorthEast East SouthEast South SouthWest West NorthWest)' \ '-interlace:interlacing scheme:(None Line Plane Partition)' \ '-label:label string' \ '-matte[store matte channel]' \ '-monochrome[transform to black and white]' \ '-negate[invert image]' \ '+negate[invert only grayscale]' \ '-page:geometry of image canvas (x{+-}{+-}{%%}{!}{<}{>}):(11x17 Ledger Legal Letter LetterSmall ArchE ArchD ArchC ArchB ArchA A0 A1 A2 A3 A4 A4Small A5 A6 A7 A8 A9 A10 B0 B1 B2 B3 B4 B5 C0 C1 C2 C3 C4 C5 C6 Flsa Flse HalfLetter)' \ '-quality:JPEG/MIFF/PNG compression level' \ '-scene:image scene number' \ '-stegano:watermark offset' \ '-stereo[create stereo anaglyph]' \ '-tile[repeat composite operation]' \ '-treedepth:color reduction tree depth' \ '-verbose[print image information]' \ ':image file:_imagemagick' \ ':composite file:_imagemagick' \ ':mask or combined file:_imagemagick' \ ':combined file:_files' && return ;; (mogrify) _arguments -M 'm:{a-z}={A-Z}' \ '*-affine[drawing transform matrix]:matrix' \ '*-antialias[remove pixel aliasing]' \ '*-background[specify background color]:color:_x_color' \ '*-blur:blur factor (0.0 - 99.9%%)' \ '*-border:border size (x)' \ '*-bordercolor:border color:_x_color' \ '*-box:annotation bounding box color:_x_color' \ '*-charcoal:charcoal drawing factor' \ '*-colorize:colorization amount ( or //)' \ '*-colors:preferred number of colors' \ '*-colorspace:colorspace type:(GRAY OHTA RGB Transparent XYZ YCbCr YIQ YPbPr YUV CMYK)' \ '*-comment:comment string' \ '*-compress:image compression type:(None BZip Fax Group4 JPEG LZW RunlengthEncoded Zip)' \ '*-contrast[enhance contrast]' \ '*+contrast[reduce contrast]' \ '*-crop:crop image (x{+-}{+-}{%%})' \ '*-cycle:image colormap shift' \ '*-delay:delay for next image (1/100ths of a second)' \ '*-density:resolution in pixels of image (x)' \ '*-depth:image depth:(8 16)' \ '*-despeckle[reduce speckles in image]' \ '*-display:display:_x_display' \ '*-dispose:GIF disposal method:((0:no\ disposal 1\:don'\''t\ dispose\ between\ frames 2\:overwrite\ frame\ with\ background\ color 3\:overwrite\ with\ previous\ frame))' \ '*-dither[apply dithering]' \ '*+dither[render Postscript without aliasing]' \ '*-draw:drawing primitive:compadd -S "\\ " - point line rectangle fillRectangle circle fillCircle ellipse fillEllipse polygon fillPolygon color matte text image' \ '*-edge:edge detection factor (0.0 - 99.9%%)' \ '*-emboss[emboss image]' \ '*-enhance[enhance image]' \ '*-equalize[histogram equalization]' \ '*-filter:filter type for resizing:(Point Box Triangle Hermite Hanning Hamming Blackman Gaussian Quadratic Cubic Catrom Mitchell Lanczos Bessel Sinc)' \ '*-flip[vertical mirror image]' \ '*-flop[horizontal mirror image]' \ "*-format:output file format:(${formats//:/ })" \ '*-font:annotation font:_x_font' \ '*-frame:border dimensions (x++)' \ '*-fuzz:maximum distance for equal colors' \ '*-gamma[gamma correction level]:gamma correction level ( or //)' \ '*+gamma[gamma correction level (don'\''t change pixels)]:gamma correction level ( or //)' \ '*-geometry:window geometry (x{+-}{+-}{%%}{!}{<}{>})' \ '*-gravity:image gravity:(Center North NorthEast East SouthEast South SouthWest West NorthWest)' \ '*-implode:implosion factor (0.0 - 99.9%%)' \ '*-interlace:interlacing scheme:(None Line Plane Partition)' \ '*-layer:layer type:(Red Green Blue Matte)' \ '*-linewidth:line width' \ '*-loop:number of iterations (GIF animation)' \ '*-map[single image colormap file]:picture file for colors:_imagemagick' \ '*+map[all images colormap file]:picture file for colors:_imagemagick' \ '*-matte[store matte channel]' \ '*-modulate:,,' \ '*-monochrome[transform to black and white]' \ '*-negate[invert image]' \ '*+negate[invert only grayscale]' \ '*-noise[noise peak elimination]' \ '*+noise:noise type:(Uniform Gaussian Multiplicative Impulse Laplacian Poisson)' \ '*-normalize[use full color value range]' \ '*-opaque:image pen color:_x_color' \ '*-page:geometry of image canvas (x{+-}{+-}{%%}{!}{<}{>}):(11x17 Ledger Legal Letter LetterSmall ArchE ArchD ArchC ArchB ArchA A0 A1 A2 A3 A4 A4Small A5 A6 A7 A8 A9 A10 B0 B1 B2 B3 B4 B5 C0 C1 C2 C3 C4 C5 C6 Flsa Flse HalfLetter)' \ '*-paint:oil painting radius' \ '*-pen:font color:_x_color' \ '*-pointsize:Postscript font size' \ '*-quality:JPEG/MIFF/PNG compression level' \ '*-raise:lighten or darken edges (x)' \ '*-region:image region (x{+-}{+-})' \ '*-resize:size (x{%%}{@}{!}{<}{>})' \ '*-roll:image roll offset ({+-}{+-})' \ '*-rotate:rotation (degrees{<}{>})' \ '*-sample:scale factors (x)' \ '*-scene:image scene number' \ '*-seed:random number seed' \ '*-segment:segment thresholds (x)' \ '*-shade:image shading (x)' \ '*-sharpen:sharpening factor (0.0 - 99.9%%)' \ '*-shave:shave edges (x{%%})' \ '*-shear:shearing angles (x in degrees)' \ '*-size:image size (x+)' \ '*-solarize:solarization threshold' \ '*-spread:neighborhood size' \ '*-swirl:swirl tightness' \ '*-texture:background texture image:_imagemagick' \ '*-threshold:threshold for maximum intensity' \ '*-transparency:transparent color:_x_color' \ '*-treedepth:color reduction tree depth' \ '*-units:image resolution type:(Undefined PixelsPerInch PixelsPerCentimeter)' \ '*-verbose[print image information]' \ '*-view:FlashPix viewing parameters' \ '*-wave:sine wave parameters (x)' \ '*:picture file:_imagemagick' && return ;; (identify) _arguments \ '*-cache[specify memory available to the pixel cache]:memory (MB)' \ '*-debug' '*-ping' \ '*-density:resolution in pixels of image (x)' \ '*-depth[specify image depth]:image depth:(8 16)' \ '*-format[specify format for image characteristics]:format' \ '(- *)-help[display help information]' \ '*-size:image size (x+)' \ '*-verbose[print more detailed info about image]' \ '*:picture file:_imagemagick' && return ;; (compare) _arguments \ '*-authenticate[decrypt image]:password' \ '*-colorspace[alternate image colorspace]:type' \ '*-debug[display copious debugging information]:events' \ '*-define[coder/decoder specific options]:values' \ '*-density[ horizontal and vertical density of the image]:geometry' \ '*-depth[image depth]:value' \ '*-display[get image or font from this X server]:server' \ '*-endian[multibyte word order]:(LSB MSB Native)' \ '*-file[write difference image to this file]:file:_files' \ '(- *)-help[print program options]' \ '*-highlight-color[color to use when annotating difference pixels]:color' \ '*-highlight-style[pixel highlight style]:(assign threshold tint xor)' \ '*-interlace:type:(None Line Plane Partition)' \ '*-limit:resource limit type and value:(Disk Files Map Memory Pixels)' \ '*-log[format of debugging information]:format' \ '*-matte[store matte channel if the image has one]' \ '*-metric[comparison metric (MAE, MSE, PAE, PSNR, RMSE)]' \ '*-monitor[show progress indication]' \ '*-sampling-factor[horizontal and vertical sampling factors]:factors' \ '*-size[width and height of image]:geometry' \ '*-type[image type]:type' \ '*-verbose[print detailed information about the image]' \ '*-version[print version information]' \ '*:picture file:_files' && return ;; (*) _message 'unknown' ;; esac fi return 1 PK[/6YYfunctions/xtermctlnuW+A# Put standard xterm/dtterm window control codes in shell parameters for # easy use. Note that some terminals do not support all combinations. # autoload -Uz xtermctl ; xtermctl # xtermctl --explain # Run once to set up; implements two functions: # xterm-tell control [args] # xterm-ask control # See xtermseq below for valid control names. -ask returns values in # $reply except for label and title which are returned in $REPLY. # E.g. one way to maximize the window (see caveat below): # xterm-ask screen_chars # xterm-tell size_chars $reply # Might there be terminfo names for these controls? typeset -Ag xtermseq xtermseq=( 1 deiconify 2 iconify '3;X;Y' position '4;H;W' size_pixels 5 raise 6 lower 7 refresh '8;H;W' size_chars '9;0' unmaximize '9;1' maximize 11 get_iconify 13 get_position 14 get_size_pixels 18 get_size_chars 19 get_screen_chars 20 get_label 21 get_title ) local k for k in ${(k)xtermseq}; do xtermseq[${xtermseq[$k]}]=$k; done # TODO (maybe): Populate hashes with completed control sequences similar # to the $fg and $bg mappings created by Functions/Misc/colors function xterm-tell { local seq=${${${xtermseq[$1]:?no such control}/[HX]/$2}/[WY]/$3} print -nr -- $'\e['"${seq}"t } # The following use of "read -st 2 ..." with the control sequences in # the prompt string requires zsh 4.3.5-dev-1 or later (zsh-users/12600 # or equivalent patch). function xterm-ask { local esc unset REPLY reply 1=get_${1#get_} local seq=${xtermseq[$1]:?no such control} case $1 in (get_(label|title)) read -st 2 -rk 3 esc$'?\e['"${seq}"t || return 1 read -srd $'\e' read -srk 1 esc ;; (get_*) read -st 2 -rk 2 esc$'?\e['"${seq}"t || return 1 IFS=';' read -Arsd t (( $#reply > 2 )) && shift reply ;; esac return 0 } local documentation; read -rd $'\e' documentation <<'EOdoc' <<<$'\e' CSI = "control sequence introducer": ESC [ OSC = "operating system command": ESC ] ST = "string terminator": ESC backslash Ps = "parameter string": (see list below) All control sequences described here begin with CSI and end with "t". Note that there are no spaces in control sequences or responses, except possibly for the text responses for label and title; spaces shown below are for readability. Window manipulation (from dtterm, as well as extensions). These controls may be disabled using the allowWindowOps resource. Valid values for the first (and any additional parameters) are: Ps = 1 -> De-iconify window. Ps = 2 -> Iconify window. Ps = 3 ; x ; y -> Move window to [x, y]. Ps = 4 ; height ; width -> Resize the xterm window in pixels. Ps = 5 -> Raise the xterm window to the front of the stacking order. Ps = 6 -> Lower the xterm window to the bottom of the stacking order. Ps = 7 -> Refresh the xterm window. Ps = 8 ; height ; width -> Resize the text area in characters. Ps = 9 ; 0 -> Restore maximized window. Ps = 9 ; 1 -> Maximize window (i.e., resize to screen size). Ps = 1 1 -> Report xterm window state. If the xterm window is open (non-iconified), returns CSI 1 t . If the xterm window is iconified, returns CSI 2 t . Ps = 1 3 -> Report xterm window position as CSI 3 ; x; yt Ps = 1 4 -> Report xterm window in pixels as CSI 4 ; height ; width t Ps = 1 8 -> Report size of text area as CSI 8 ; height ; width t Ps = 1 9 -> Report size of screen in characters as CSI 9 ; height ; width t Ps = 2 0 -> Report xterm window's icon label as OSC L label ST Ps = 2 1 -> Report xterm window's title as OSC l title ST Ps >= 2 4 -> Resize to Ps lines (DECSLPP) The size of the screen in characters is often reported inaccurately. Gnome-terminal as of v2.16 responds to 13/14/18/19 but fails to insert the Ps digit 3/4/8/9 between the CSI and the reported dimensions, and does not appear to respond to any of Ps in 1-9. Window managers may also affect behavior; the Gnome desktop allows xterm to resize or iconify itself but won't reliably let it reposition itself. EOdoc [[ -n "${(M)@:#--explain}" ]] && print "$documentation" return 0 PK[Cfunctions/tcp_readnuW+A# Helper function for reading input from a TCP connection. # Actually, the input doesn't need to be a TCP connection at all, it # is simply an input file descriptor. However, it must be contained # in ${tcp_by_fd[$TCP_SESS]}. This is set set by tcp_open, but may be # set by hand. (Note, however, the blocking/timeout behaviour is usually # not implemented for reading from regular files.) # # The default behaviour is simply to read any single available line from # the input fd and print it. If a line is read, it is stored in the # parameter $TCP_LINE; this always contains the last line successfully # read. Any chunk of lines read in are stored in the array $tcp_lines; # this always contains a complete list of all lines read in by a single # execution of this function and hence may be empty. The fd corresponding # to $TCP_LINE is stored in $TCP_LINE_FD (this can be turned into a # session by looking up in $tcp_by_fd). # # Printed lines are preceded by $TCP_PROMPT. This may contain two # percent escapes: %s for the current session, %f for the current file # descriptor. The default is `T[%s]:'. The prompt is not printed # to per-session logs where the source is unambiguous. # # The function returns 0 if a read succeeded, even if (using -d) a # subsequent read failed. # # The behaviour is modified by the following options. # # -a Read from all fds, not just the one given by TCP_SESS. # # -b The first read blocks until some data is available for reading. # # -d Drain all pending input; loop until no data is available. # # -l sess1,sess2,... # Gives a list of sessions to read on. Equivalent to # -u ${tcp_by_name[sess1]} -u ${tcp_by_name[sess2]} ... # Multiple -l options also work. # # -q Quiet; if $TCP_SESS is not set, just return 1, but don't print # an error message. # # -s sess # Gives a single session; the option may be repeated. # # -t TO On each read (the only read unless -d was also given), time out # if nothing was available after TO seconds (may be floating point). # Otherwise, the function will return immediately when no data is # available. # # If combined with -b, the function will always wait for the # first data to become available; hence this is not useful unless # -d is specified along with -b, in which case the timeout applies # to data after the first line. # -u fd Read from fd instead of the default session; may be repeated for # multiple sessions. Can be a comma-separated list, too. # -T TO This sets an overall timeout, again in seconds. emulate -L zsh setopt extendedglob cbases # set -x zmodload -i zsh/mathfunc local opt drain line quiet block read_fd all sess key val noprint local -A read_fds read_fds=() float timeout timeout_all endtime integer stat while getopts "abdl:qs:t:T:u:" opt; do case $opt in # Read all sessions. (a) all=1 ;; # Block until we receive something. (b) block=1 ;; # Drain all pending input. (d) drain=1 ;; (l) for sess in ${(s.,.)OPTARG}; do read_fd=${tcp_by_name[$sess]} if [[ -z $read_fd ]]; then print "$0: no such session: $sess" >&2 return 1 fi read_fds[$read_fd]=1 done ;; # Don't print an error message if there is no TCP connection, # just return 1. (q) quiet=1 ;; # Add a single session to the list (s) read_fd=${tcp_by_name[$OPTARG]} if [[ -z $read_fd ]]; then print "$0: no such session: $sess" >&2 return 1 fi read_fds[$read_fd]=1 ;; # Per-read timeout: wait this many seconds before # each read. (t) timeout=$OPTARG [[ -n $TCP_READ_DEBUG ]] && print "Timeout per-operations is $timeout" >&2 ;; # Overall timeout: return after this many seconds. (T) timeout_all=$OPTARG ;; # Read from given fd(s). (u) for read_fd in ${(s.,.)OPTARG}; do if [[ $read_fd != (0x[[:xdigit:]]##|[[:digit:]]##) ]]; then print "Bad fd in $OPTARG" >&2 return 1 fi read_fds[$((read_fd))]=1 done ;; (*) [[ $opt != \? ]] && print Unhandled option, complain: $opt >&2 return 1 ;; esac done if [[ -n $all ]]; then read_fds=(${(kv)tcp_by_fd}) elif (( ! $#read_fds )); then if [[ -z $TCP_SESS ]]; then [[ -z $quiet ]] && print "No tcp connection open." >&2 return 1 elif [[ -z $tcp_by_name[$TCP_SESS] ]]; then print "TCP session $TCP_SESS has gorn!" >&2 return 1 fi read_fds[$tcp_by_name[$TCP_SESS]]=1 fi typeset -ga tcp_lines tcp_lines=() local helper_stat=2 skip tpat reply REPLY float newtimeout if [[ ${(t)SECONDS} != float* ]]; then # If called from another function, don't override typeset -F TCP_SECONDS_START=$SECONDS # Get extra accuracy by making SECONDS floating point locally typeset -F SECONDS fi if (( timeout_all )); then (( endtime = SECONDS + timeout_all )) fi zmodload -i zsh/zselect if [[ -n $block ]]; then if (( timeout_all )); then # zselect -t uses 100ths of a second zselect -t $(( int(100*timeout_all + 0.5) )) ${(k)read_fds} || return $helper_stat else zselect ${(k)read_fds} || return $helper_stat fi fi while (( ${#read_fds} )); do if [[ -n $block ]]; then # We already have data waiting this time through. unset block else if (( timeout_all )); then (( (newtimeout = endtime - SECONDS) <= 0 )) && return 2 if (( ! timeout || newtimeout < timeout )); then (( timeout = newtimeout )) fi fi if (( timeout )); then if [[ -n $TCP_READ_DEBUG ]]; then print "[tcp_read: selecting timeout $timeout on ${(k)read_fds}]" >&2 fi zselect -t $(( int(timeout*100 + 0.5) )) ${(k)read_fds} || return $helper_stat else if [[ -n $TCP_READ_DEBUG ]]; then print "[tcp_read: selecting no timeout on ${(k)read_fds}]" >&2 fi zselect -t 0 ${(k)read_fds} || return $helper_stat fi fi if [[ -n $TCP_READ_DEBUG ]]; then print "[tcp_read: returned fds ${reply}]" >&2 fi for read_fd in ${reply[2,-1]}; do if ! read -u $read_fd -r line; then unset "read_fds[$read_fd]" stat=1 continue fi helper_stat=0 sess=${tcp_by_fd[$read_fd]} # Handle user-defined triggers noprint=${TCP_SILENT:+-q} if (( ${+tcp_on_read} )); then # Call the function given in the key for each matching value. # It is this way round because function names must be # unique, while patterns do not need to be. Furthermore, # this keeps the use of subscripting under control. for key val in ${(kv)tcp_on_read}; do if [[ $line = ${~val} ]]; then $key "$sess" "$line" || noprint=-q fi done fi tcp_output -P "${TCP_PROMPT=<-[%s] }" -S $sess -F $read_fd \ $noprint -- "$line" # REPLY is now set to the line with an appropriate prompt. tcp_lines+=($REPLY) typeset -g TCP_LINE="$REPLY" TCP_LINE_FD="$read_fd" # Only handle one line from one device at a time unless draining. [[ -z $drain ]] && return $stat done done return $stat PK[d?UUfunctions/_autocdnuW+A#compdef -command- _command_names local ret=$? [[ -o autocd ]] && _cd || return ret PK[9functions/tcp_sessnuW+A# try to disguise parameters from the eval'd command in case it's a function. integer __myfd=1 if [[ -n $1 ]]; then if [[ -z $tcp_by_name[$1] ]]; then print no such session: $1 __myfd=2 elif [[ -n $2 ]]; then local TCP_SESS=$1 shift # A bit tricky: make sure the first argument gets re-evaluated, # so as to get aliases etc. to work, but make sure the remainder # don't, so as not to bugger up quoting. This ought to work the # vast majority of the time, anyway. local __cmd=$1 shift eval $__cmd \$\* return else typeset -g TCP_SESS=$1 return 0; fi fi # Print out the list of sessions, first the number, than the corresponding # file descriptor. The current session, if any, is marked with an asterisk. local cur name fd for name in ${(ko)tcp_by_name}; do fd=${tcp_by_name[$name]} # mark current session with an asterisk if [[ ${TCP_SESS} = $name ]]; then cur=" *" else cur= fi print -u $__myfd "sess:$name; fd:$fd$cur" done return $(( __myfd - 1 )) PK[jjfunctions/_mergechangesnuW+A#compdef mergechanges _arguments \ '-f[output to file]' \ '*:changes file:_files -g "*.changes(-.)"' PK[}}functions/_x_geometrynuW+A#autoload local x="$argv[(I)-X]" if (( x )); then _message -r "$argv[x + 1]" else _message -e geometries 'geometry' fi PK[ofunctions/_arch_archivesnuW+A#autoload local ARCHCMD="$1" shift local expl completions library name_arg='-n' if [[ -n $argv[(r)--library] ]]; then library='library-' # remove parameter from $@ before calling compadd argv[(r)--library]=() name_arg= fi completions=($(_call_program ${ARCHCMD} ${ARCHCMD} ${library:-}archives $name_arg)) _description -V archives expl "${library:-}archives" compadd "$@" "$expl[@]" -- "$completions[@]" PK[mmfunctions/_imagemagicknuW+A#compdef animate composite combine convert display identify import mogrify montage xtp local state line expl formats curcontext="$curcontext" typeset -A opt_args # Things that could be improved: # # - file names and types ($formats) # - the -draw option # - urls for xtp # # and certainly many other things... formats=jpg:jpeg:tiff:miff:ras:bmp:cgm:dcx:ps:eps:fig:fits:fpx:gif:mpeg:pbm:pgm:ppm:pcd:pcl:pdf:pcx:png:rad:rgb:rgba:rle:sgi:html:shtml:tga:ttf:uil:xwd:xbm:xpm:yuv if (( $# )); then _files "$@" -g "*.(#i)(${~formats//:/|})(-.)" return fi case "$service" in display) _arguments -M 'm:{a-z}={A-Z}' \ '*-backdrop[use full screen]' \ '*-background:color:_x_color' \ '*-border:border size (x)' \ '*-bordercolor:color:_x_color' \ '*-borderwidth:geometry' \ '*-cache[specify memory available to the pixel cache]:memory (MB)' \ '*-colormap:colormap type:(shared private)' \ '*-colors:preferred number of colors' \ '*-colorspace:colorspace type:(GRAY OHTA RGB Transparent XYZ YCbCr YIQ YPbPr YUV CMYK)' \ '*-comment:comment string' \ '*-compress:image compression type:(None BZip Fax Group4 JPEG LZW RunlengthEncoded Zip)' \ '*-contrast[enhance contrast]' \ '*+contrast[reduce contrast]' \ '*-crop:crop image (x{+-}{+-}{%%})' \ '*-debug' \ '*-delay:delay for next image (1/100ths of a second)' \ '*-density:image resolution (x in pixels)' \ '*-despeckle[reduce speckles in image]' \ '*-display:display:_x_display' \ '*-dispose:GIF disposal method:((0:no\ disposal 1\:don'\''t\ dispose\ between\ frames 2\:overwrite\ frame\ with\ background\ color 3\:overwrite\ with\ previous\ frame))' \ '*-dither[apply dithering]' \ '*-edge:edge detection factor (0.0 - 99.9%%)' \ '*-endian:image endianess:(MSB LSB)' \ '*+endian' \ '*-enhance[enhance noisy image]' \ '*-filter:filter type for resizing:(Point Box Triangle Hermite Hanning Hamming Blackman Gaussian Quadratic Cubic Catrom Mitchell Lanczos Bessel Sinc)' \ '*-flip[vertical mirror image]' \ '*-flop[horizontal mirror image]' \ '*-font:font:_x_font' \ '*-foreground:color:_x_color' \ '*-frame:border dimensions (x++)' \ '*-gamma[gamma correction level]:gamma correction level ( or //)' \ '*+gamma[gamma correction level (don'\''t change pixels)]:gamma correction level ( or //)' \ '*-geometry:window geometry (x{+-}{+-}{%%}{!}{<}{>})' \ '(- *)-help[display help information]' \ '*-iconGeometry:geometry:_x_geometry' \ '*-iconic' \ '*-immutable[disallow image modifications]' \ '*-interlace:interlacing scheme:(None Line Plane Partition)' \ '*-label:label string' \ '*-magnify:factor' \ '*-map:colormap type for display:(best default gray red green blue)' \ '*-matte[store matte channel]' \ '*-mattecolor:color:_x_color' \ '*-monochrome[transform to black and white]' \ '*-name:image name' \ '*-negate[invert image]' \ '*+negate[invert only grayscale]' \ '*-noop' \ '*-page:geometry of image canvas (x{+-}{+-}{%%}{!}{<}{>}):(11x17 Ledger Legal Letter LetterSmall ArchE ArchD ArchC ArchB ArchA A0 A1 A2 A3 A4 A4Small A5 A6 A7 A8 A9 A10 B0 B1 B2 B3 B4 B5 C0 C1 C2 C3 C4 C5 C6 Flsa Flse HalfLetter)' \ '*-quality:JPEG/MIFF/PNG compression level' \ '*-raise:3-D edges (raised)' \ '*+raise:3-D edges (lowered)' \ '*-remote:remote command (file name):_imagemagick' \ '*-roll:image roll offset ({+-}{+-})' \ '*-rotate:rotation (degrees{<}{>})' \ '*-sample:scale factors (x)' \ '*-sampling_factor:sampling factor (x)' \ '*-scenes:image scene number' \ '*-segment:cluster pixel number' \ '*-shared_memory' \ '*-sharpen:sharpening factor (0.0 - 99.9%%)' \ '*-size:image size (x+)' \ '*-text_font:font:_x_font' \ '*-texture:background texture image:_imagemagick' \ '*-title:image title' \ '*-treedepth:color reduction tree depth' \ '*-trim' \ '*-update:redisplay test time (seconds)' \ '*-use_pixmap' \ '*-verbose' \ '*-visual:visual to use for display:(StaticGray GrayScale StaticColor PseudoColor TrueColor DirectColor default)' \ '*-window:window ID to display image in:_x_window' \ '*-window_group' \ '*-write:output filename:_files' \ '*:picture file:_imagemagick' && return ;; animate) _arguments -M 'm:{a-z}={A-Z}' \ '*-backdrop[use full screen]' \ '*-background:color:_x_color' \ '*-bordercolor:color:_x_color' \ '*-borderwidth:geometry' \ '*-cache[specify memory available to the pixel cache]:memory (MB)' \ '*-chop:x{+-}{+-}' \ '*-colormap:colormap type:(Shared Private)' \ '*-colors:preferred number of colors' \ '*-colorspace:colorspace type:(GRAY OHTA RGB Transparent XYZ YCbCr YIQ YPbPr YUV CMYK)' \ '*-crop:crop image (x{+-}{+-})' \ '*-debug' \ '*-delay:delay for next image (1/100ths of a second)' \ '*-density:image resolution (x in pixels)' \ '*-depth:image depth:(8 16)' \ '*-display:display:_x_display' \ '*-dither[apply dithering]' \ '*-font:font:_x_font' \ '*-foreground:color:_x_color' \ '*-gamma[gamma correction level]:gamma correction level ( or //)' \ '*+gamma[gamma correction level (don'\''t change pixels)]:gamma correction level ( or //)' \ '*-geometry:window geometry (x{+-}{+-}{%%}{!}{<}{>})' \ '(- *)-help[display help information]' \ '*-iconGeometry:geometry:_x_geometry' \ '*-iconic' \ '*-interlace:interlacing scheme:(None Line Plane Partition)' \ '*-map:colormap type for display:(best default gray red green blue)' \ '*-matte[store matte channel]' \ '*-mattecolor:color:_x_color' \ '*-monochrome[transform to black and white]' \ '*-name:image name' \ '*-noop' \ '*-pause:delay (seconds)' \ '*-remote:remote command (file name):_imagemagick' \ '*-rotate:rotation (degrees{<}{>})' \ '*-scenes:image scene number' \ '*-shared_memory' \ '*-size:image size (x+)' \ '*-text_font:font:_x_font' \ '*-title:image title' \ '*-treedepth:color reduction tree depth' \ '*-trim' \ '*-verbose[print image information]' \ '*-visual:visual to use for display:(StaticGray GrayScale StaticColor PseudoColor TrueColor DirectColor default)' \ '*-window:window ID to display image in:_x_window' \ '*:picture file:_imagemagick' && return ;; import) _x_arguments -M 'm:{a-z}={A-Z}' \ '-adjoin[join images]' \ '-border:border size (x):' \ '-bordercolor:color:_x_color' \ '-cache[specify memory available to the pixel cache]:memory (MB)' \ '-colors:preferred number of colors' \ '-colorspace:colorspace type:(GRAY OHTA RGB Transparent XYZ YCbCr YIQ YPbPr YUV CMYK)' \ '-comment:comment string' \ '-crop:crop image (x{+-}{+-}{%%})' \ '-debug' \ '-delay:delay for next image (1/100ths of a second)' \ '-density:resolution in pixels of image (x)' \ '-depth:image depth:(8 16)' \ '-descend[descend window hierarchy]' \ '-dispose:GIF disposal method:((0:no\ disposal 1\:don'\''t\ dispose\ between\ frames 2\:overwrite\ frame\ with\ background\ color 3\:overwrite\ with\ previous\ frame))' \ '-dither[apply dithering]' \ '(+endian)-endian:image endianess:(MSB LSB)' \ '(-endian)+endian' \ '-frame[include window manager frame]' \ '(- *)-help[display help information]' \ '-interlace:interlacing scheme:(None Line Plane Partition)' \ '-label:label string' \ '-monochrome[transform to black and white]' \ '-negate[invert image]' \ '+negate[invert only grayscale]' \ '-page:geometry of image canvas (x{+-}{+-}{%%}{!}{<}{>}):(11x17 Ledger Legal Letter LetterSmall ArchE ArchD ArchC ArchB ArchA A0 A1 A2 A3 A4 A4Small A5 A6 A7 A8 A9 A10 B0 B1 B2 B3 B4 B5 C0 C1 C2 C3 C4 C5 C6 Flsa Flse HalfLetter)' \ '-pause:delay (seconds)' \ '-ping' \ '-pointsize:Postscript font size' \ '-quality:JPEG/MIFF/PNG compression level' \ '-resize:size (x{%%}{@}{!}{<}{>})' \ '-rotate:rotation (degrees{<}{>})' \ '-sampling_factor:sampling factor (x)' \ '-scene:number of screen snapshots' \ '-screen[get root window]' \ '-silent[be quiet]' \ '-snaps:number' \ '-transparent:transparent color:_x_color' \ '-treedepth:color reduction tree depth' \ '-trim' \ '-type:image type:(Bilevel Grayscale Palette PaletteMatte TrueColor TrueColorMatte ColorSeparation ColorSeparationMatte Optimize)' \ '-verbose[print image information]' \ '-window:window ID to get:_x_window' \ ':output file:_files' && return ;; montage) _arguments -M 'm:{a-z}={A-Z}' \ '*-adjoin[join images]' \ '*-background:color:_x_color' \ '*-blur:blur factor (0.0 - 99.9%%)' \ '*-bordercolor:color:_x_color' \ '*-borderwidth:geometry' \ '*-cache[specify memory available to the pixel cache]:memory (MB)' \ '*-colors:preferred number of colors' \ '*-colorspace:colorspace type:(GRAY OHTA RGB Transparent XYZ YCbCr YIQ YPbPr YUV CMYK)' \ '*-comment:comment string' \ '*-compose:image composition type:(Over In Out Atop Xor Plus Minus Add Subtract Difference Bumpmap Replace ReplaceRed ReplaceGreen ReplaceBlue ReplaceMatte)' \ '*-compress:image compression type:(None BZip Fax Group4 JPEG LZW RunlengthEncoded Zip)' \ '*-crop:crop image (x{+-}{+-}{%%})' \ '*-debug' \ '*-density:resolution in pixels of image (x)' \ '*-depth:image depth:(8 16)' \ '*-display:display:_x_display' \ '*-dispose:GIF disposal method:((0:no\ disposal 1\:don'\''t\ dispose\ between\ frames 2\:overwrite\ frame\ with\ background\ color 3\:overwrite\ with\ previous\ frame))' \ '*-dither[apply dithering]' \ '*+dither[render Postscript without aliasing]' \ '*-draw:drawing primitive:compadd -S "\\ " - rectangle circle ellipse polygon color matte text image' \ '*-endian:image endianess:(MSB LSB)' \ '*+endian' \ '*-filter:filter type for resizing:(Point Box Triangle Hermite Hanning Hamming Blackman Gaussian Quadratic Cubic Catrom Mitchell Lanczos Bessel Sinc)' \ '*-frame[draw frame around image]' \ '*-font:annotation font:_x_font' \ '*-gamma[gamma correction level]:gamma correction level ( or //)' \ '*+gamma[gamma correction level (don'\''t change pixels)]:gamma correction level ( or //)' \ '*-geometry:window geometry (x{+-}{+-}{%%}{!}{<}{>})' \ '*-gravity:image gravity:(Center North NorthEast East SouthEast South SouthWest West NorthWest)' \ '(- *)-help[display help information]' \ '*-interlace:interlacing scheme:(None Line Plane Partition)' \ '*-label:label string' \ '*-matte[store matte channel]' \ '*-mattecolor:color:_x_color' \ '*-mode:montage type:(Frame Unframe Concatenate)' \ '*-monochrome[transform to black and white]' \ '*-noop' \ '*-page:geometry of image canvas (x{+-}{+-}{%%}{!}{<}{>}):(11x17 Ledger Legal Letter LetterSmall ArchE ArchD ArchC ArchB ArchA A0 A1 A2 A3 A4 A4Small A5 A6 A7 A8 A9 A10 B0 B1 B2 B3 B4 B5 C0 C1 C2 C3 C4 C5 C6 Flsa Flse HalfLetter)' \ '*-pen:font color:_x_color' \ '*-pointsize:Postscript font size' \ '*-quality:JPEG/MIFF/PNG compression level' \ '*-resize:size (x{%%}{@}{!}{<}{>})' \ '*-rotate:rotation (degrees{<}{>})' \ '*-sampling_factor:sampling factor (x)' \ '*-scenes:image scene number' \ '*-shadow[add shadow]' \ '*-sharpen:sharpening factor (0.0 - 99.9%%)' \ '*-size:image size (x+)' \ '*-stroke:color:_x_color' \ '*-texture:background texture image:_imagemagick' \ '*-tile:number of tiles (x)' \ '*-title:image title' \ '*-transparent:transparent color:_x_color' \ '*-treedepth:color reduction tree depth' \ '*-trim' \ '*-type:image type:(Bilevel Grayscale Palette PaletteMatte TrueColor TrueColorMatte ColorSeparation ColorSeparationMatte Optimize)' \ '*-verbose[print image information]' \ '*:picture file:_imagemagick' && return ;; convert) _arguments -C -M 'm:{a-z}={A-Z}' \ '-adjoin[join images]' \ '-affine[drawing transform matrix]:matrix' \ '-antialias[remove pixel aliasing]' \ '-append[append image sequence]' \ '-average[average image sequence]' \ '-background[specify background color]:color:_x_color' \ '-blur:blur factor (0.0 - 99.9%%)' \ '-border:border size (x)' \ '-bordercolor:border color:_x_color' \ '-box:annotation bounding box color:_x_color' \ '-cache[specify memory available to the pixel cache]:memory (MB)' \ '-channel:channel:(Red Green Blue Opacity Cyan Magenta Yellow Black)' \ '-charcoal:charcoal drawing factor' \ '-chop:x{+-}{+-}' \ '-clip' \ '-coalesce[merge image sequence]' \ '-colorize:colorization amount ( or //)' \ '-colors:preferred number of colors' \ '-colorspace:colorspace type:(GRAY OHTA RGB Transparent XYZ YCbCr YIQ YPbPr YUV CMYK)' \ '-comment:comment string' \ '-compress:image compression type:(None BZip Fax Group4 JPEG LZW RunlengthEncoded Zip)' \ '-contrast[enhance contrast]' \ '+contrast[reduce contrast]' \ '-crop:crop image (x{+-}{+-}{%%})' \ '-cycle:image colormap shift' \ '-debug' \ '-deconstruct[break down image sequence into parts]' \ '-delay:delay for next image (1/100ths of a second)' \ '-density:resolution in pixels of image (x)' \ '-depth:image depth:(8 16)' \ '-despeckle[reduce speckles in image]' \ '-display:display:_x_display' \ '-dispose:GIF disposal method:((0:no\ disposal 1\:don'\''t\ dispose\ between\ frames 2\:overwrite\ frame\ with\ background\ color 3\:overwrite\ with\ previous\ frame))' \ '-dither[apply dithering]' \ '-draw:drawing primitive:compadd -S "\\ " - rectangle circle ellipse polygon color matte text image' \ '-edge:edge detection factor (0.0 - 99.9%%)' \ '-emboss[emboss image]' \ '(+endian)-endian:image endianess:(MSB LSB)' \ '(-endian)+endian' \ '-enhance[enhance image]' \ '-equalize[histogram equalization]' \ '-fill[specify color to use when filling a graphic primitive]:color:_x_color' \ '-filter:filter type for resizing:(Point Box Triangle Hermite Hanning Hamming Blackman Gaussian Quadratic Cubic Catrom Mitchell Lanczos Bessel Sinc)' \ '-flatten[flatten a sequence of images]' \ '-flip[vertical mirror image]' \ '-flop[horizontal mirror image]' \ '-font:annotation font:_x_font' \ '-frame:border dimensions (x++)' \ '-fuzz:maximum distance for equal colors' \ '-gamma[gamma correction level]:gamma correction level ( or //)' \ '+gamma[gamma correction level (don'\''t change pixels)]:gamma correction level ( or //)' \ '-geometry:window geometry (x{+-}{+-}{%%}{!}{<}{>})' \ '-gravity:image gravity:(Center North NorthEast East SouthEast South SouthWest West NorthWest)' \ '-implode:implosion factor (0.0 - 99.9%%)' \ '-interlace:interlacing scheme:(None Line Plane Partition)' \ '-label:label string' \ '-layer:layer type:(Red Green Blue Matte)' \ '-linewidth:line width' \ '-loop:number of iterations (GIF animation)' \ '-map[single image colormap file]:picture file for colors:_imagemagick' \ '+map[all images colormap file]:picture file for colors:_imagemagick' \ '-matte[store matte channel]' \ '-modulate:,,' \ '-monochrome[transform to black and white]' \ '-morph[morph image sequence]' \ '-negate[invert image]' \ '+negate[invert only grayscale]' \ '-noise[noise peak elimination]' \ '+noise:noise type:(Uniform Gaussian Multiplicative Impulse Laplacian Poisson)' \ '-normalize[use full color value range]' \ '-opaque:image pen color:_x_color' \ '-page:geometry of image canvas (x{+-}{+-}{%%}{!}{<}{>}):(11x17 Ledger Legal Letter LetterSmall ArchE ArchD ArchC ArchB ArchA A0 A1 A2 A3 A4 A4Small A5 A6 A7 A8 A9 A10 B0 B1 B2 B3 B4 B5 C0 C1 C2 C3 C4 C5 C6 Flsa Flse HalfLetter)' \ '-paint:oil painting radius' \ '-pen:font color:_x_color' \ '-pointsize:Postscript font size' \ '-preview:image preview type:(Rotate Shear Roll Hue Saturation Brightness Gamma Spiff Dull Grayscale Quantize Despeckle ReduceNoise AddNoise Sharpen Blur Threshold Edge Detect Spread Shade Raise Segment Solarize Swirl Implode Wave OilPaint CharcoalDrawing JPEG)' \ '-profile:information profile:->profile' \ '-quality:JPEG/MIFF/PNG compression level' \ '-raise:lighten or darken edges (x)' \ '-region:image region (x{+-}{+-})' \ '-roll:image roll offset ({+-}{+-})' \ '-rotate:rotation (degrees{<}{>})' \ '-sample:scale factors (x)' \ '-scene:image scene number' \ '-seed:random number seed' \ '-segment:segment thresholds (x)' \ '-shade:image shading (x)' \ '-sharpen:sharpening factor (0.0 - 99.9%%)' \ '-shear:shearing angles (x in degrees)' \ '-size:image size (x+)' \ '-solarize:solarization threshold' \ '-spread:neighborhood size' \ '-swirl:swirl tightness' \ '-texture:background texture image:_imagemagick' \ '-threshold:threshold for maximum intensity' \ '-transparency:transparent color:_x_color' \ '-treedepth:color reduction tree depth' \ '-units:image resolution type:(Undefined PixelsPerInch PixelsPerCentimeter)' \ '-verbose[print image information]' \ '-view:FlashPix viewing parameters' \ '-wave:sine wave parameters (x)' \ '*:picture file:_imagemagick' && return if [[ "$state" = profile ]]; then if compset -P '*:'; then _files else _wanted prefixes expl 'profile type' compadd icc: iptc: fi return fi ;; combine|composite) _arguments -M 'm:{a-z}={A-Z}' \ '-blend:blending factor (0.0 - 99.9%%)' \ '-colors:preferred number of colors' \ '-colorspace:colorspace type:(GRAY OHTA RGB Transparent XYZ YCbCr YIQ YPbPr YUV CMYK)' \ '-comment:comment string' \ '-compose:image composition type:(Over In Out Atop Xor Plus Minus Add Subtract Difference Bumpmap Replace ReplaceRed ReplaceGreen ReplaceBlue ReplaceMatte)' \ '-compress:image compression type:(None BZip Fax Group4 JPEG LZW RunlengthEncoded Zip)' \ '-density:resolution in pixels of image (x)' \ '-displace:displacements scales (x)' \ '-display:display:_x_display' \ '-dispose:GIF disposal method:((0:no\ disposal 1\:don'\''t\ dispose\ between\ frames 2\:overwrite\ frame\ with\ background\ color 3\:overwrite\ with\ previous\ frame))' \ '-dither[apply dithering]' \ '+dither[render Postscript without aliasing]' \ '-font:normal text font:_x_font' \ '-geometry:window geometry (x{+-}{+-}{%%}{!}{<}{>})' \ '-gravity:image gravity:(Center North NorthEast East SouthEast South SouthWest West NorthWest)' \ '-interlace:interlacing scheme:(None Line Plane Partition)' \ '-label:label string' \ '-matte[store matte channel]' \ '-monochrome[transform to black and white]' \ '-negate[invert image]' \ '+negate[invert only grayscale]' \ '-page:geometry of image canvas (x{+-}{+-}{%%}{!}{<}{>}):(11x17 Ledger Legal Letter LetterSmall ArchE ArchD ArchC ArchB ArchA A0 A1 A2 A3 A4 A4Small A5 A6 A7 A8 A9 A10 B0 B1 B2 B3 B4 B5 C0 C1 C2 C3 C4 C5 C6 Flsa Flse HalfLetter)' \ '-quality:JPEG/MIFF/PNG compression level' \ '-scene:image scene number' \ '-stegano:watermark offset' \ '-stereo[create stereo anaglyph]' \ '-tile[repeat composite operation]' \ '-treedepth:color reduction tree depth' \ '-verbose[print image information]' \ ':image file:_imagemagick' \ ':composite file:_imagemagick' \ ':mask or combined file:_imagemagick' \ ':combined file:_files' && return ;; mogrify) _arguments -M 'm:{a-z}={A-Z}' \ '*-affine[drawing transform matrix]:matrix' \ '*-antialias[remove pixel aliasing]' \ '*-background[specify background color]:color:_x_color' \ '*-blur:blur factor (0.0 - 99.9%%)' \ '*-border:border size (x)' \ '*-bordercolor:border color:_x_color' \ '*-box:annotation bounding box color:_x_color' \ '*-charcoal:charcoal drawing factor' \ '*-colorize:colorization amount ( or //)' \ '*-colors:preferred number of colors' \ '*-colorspace:colorspace type:(GRAY OHTA RGB Transparent XYZ YCbCr YIQ YPbPr YUV CMYK)' \ '*-comment:comment string' \ '*-compress:image compression type:(None BZip Fax Group4 JPEG LZW RunlengthEncoded Zip)' \ '*-contrast[enhance contrast]' \ '*+contrast[reduce contrast]' \ '*-crop:crop image (x{+-}{+-}{%%})' \ '*-cycle:image colormap shift' \ '*-delay:delay for next image (1/100ths of a second)' \ '*-density:resolution in pixels of image (x)' \ '*-depth:image depth:(8 16)' \ '*-despeckle[reduce speckles in image]' \ '*-display:display:_x_display' \ '*-dispose:GIF disposal method:((0:no\ disposal 1\:don'\''t\ dispose\ between\ frames 2\:overwrite\ frame\ with\ background\ color 3\:overwrite\ with\ previous\ frame))' \ '*-dither[apply dithering]' \ '*+dither[render Postscript without aliasing]' \ '*-draw:drawing primitive:compadd -S "\\ " - point line rectangle fillRectangle circle fillCircle ellipse fillEllipse polygon fillPolygon color matte text image' \ '*-edge:edge detection factor (0.0 - 99.9%%)' \ '*-emboss[emboss image]' \ '*-enhance[enhance image]' \ '*-equalize[histogram equalization]' \ '*-filter:filter type for resizing:(Point Box Triangle Hermite Hanning Hamming Blackman Gaussian Quadratic Cubic Catrom Mitchell Lanczos Bessel Sinc)' \ '*-flip[vertical mirror image]' \ '*-flop[horizontal mirror image]' \ "*-format:output file format:(${formats//:/ })" \ '*-font:annotation font:_x_font' \ '*-frame:border dimensions (x++)' \ '*-fuzz:maximum distance for equal colors' \ '*-gamma[gamma correction level]:gamma correction level ( or //)' \ '*+gamma[gamma correction level (don'\''t change pixels)]:gamma correction level ( or //)' \ '*-geometry:window geometry (x{+-}{+-}{%%}{!}{<}{>})' \ '*-gravity:image gravity:(Center North NorthEast East SouthEast South SouthWest West NorthWest)' \ '*-implode:implosion factor (0.0 - 99.9%%)' \ '*-interlace:interlacing scheme:(None Line Plane Partition)' \ '*-layer:layer type:(Red Green Blue Matte)' \ '*-linewidth:line width' \ '*-loop:number of iterations (GIF animation)' \ '*-map[single image colormap file]:picture file for colors:_imagemagick' \ '*+map[all images colormap file]:picture file for colors:_imagemagick' \ '*-matte[store matte channel]' \ '*-modulate:,,' \ '*-monochrome[transform to black and white]' \ '*-negate[invert image]' \ '*+negate[invert only grayscale]' \ '*-noise[noise peak elimination]' \ '*+noise:noise type:(Uniform Gaussian Multiplicative Impulse Laplacian Poisson)' \ '*-normalize[use full color value range]' \ '*-opaque:image pen color:_x_color' \ '*-page:geometry of image canvas (x{+-}{+-}{%%}{!}{<}{>}):(11x17 Ledger Legal Letter LetterSmall ArchE ArchD ArchC ArchB ArchA A0 A1 A2 A3 A4 A4Small A5 A6 A7 A8 A9 A10 B0 B1 B2 B3 B4 B5 C0 C1 C2 C3 C4 C5 C6 Flsa Flse HalfLetter)' \ '*-paint:oil painting radius' \ '*-pen:font color:_x_color' \ '*-pointsize:Postscript font size' \ '*-quality:JPEG/MIFF/PNG compression level' \ '*-raise:lighten or darken edges (x)' \ '*-region:image region (x{+-}{+-})' \ '*-resize:size (x{%%}{@}{!}{<}{>})' \ '*-roll:image roll offset ({+-}{+-})' \ '*-rotate:rotation (degrees{<}{>})' \ '*-sample:scale factors (x)' \ '*-scene:image scene number' \ '*-seed:random number seed' \ '*-segment:segment thresholds (x)' \ '*-shade:image shading (x)' \ '*-sharpen:sharpening factor (0.0 - 99.9%%)' \ '*-shave:shave edges (x{%%})' \ '*-shear:shearing angles (x in degrees)' \ '*-size:image size (x+)' \ '*-solarize:solarization threshold' \ '*-spread:neighborhood size' \ '*-swirl:swirl tightness' \ '*-texture:background texture image:_imagemagick' \ '*-threshold:threshold for maximum intensity' \ '*-transparency:transparent color:_x_color' \ '*-treedepth:color reduction tree depth' \ '*-units:image resolution type:(Undefined PixelsPerInch PixelsPerCentimeter)' \ '*-verbose[print image information]' \ '*-view:FlashPix viewing parameters' \ '*-wave:sine wave parameters (x)' \ '*:picture file:_imagemagick' && return ;; xtp) _arguments -M 'm:{a-z}={A-Z}' \ '-account:password' \ '-binary[retrieve files as binary]' \ '-directory[list directory]' \ '-exclude:regular expression for exclusion' \ '-file:output file:_files' \ '-get[get files]' \ '-port:port: _ports' \ '-proxy:host of proxy ftp deamon:_hosts' \ '-print[print files]' \ '-prune[process files from remote directory]' \ '-put[put files]' \ '-retrieve[retrieve matching files]' \ '-timeout:maximum timeout' \ '-type:remote system type:(UNIX VMS other)' \ ':URL: _urls' && return ;; identify) _arguments \ '*-cache[specify memory available to the pixel cache]:memory (MB)' \ '*-debug' '*-ping' \ '*-density:resolution in pixels of image (x)' \ '*-depth[specify image depth]:image depth:(8 16)' \ '*-format[specify format for image characteristics]:format' \ '(- *)-help[display help information]' \ '*-size:image size (x+)' \ '*-verbose[print more detailed info about image]' \ '*:picture file:_imagemagick' && return ;; *) _message 'eh?' ;; esac return 1 PK[4'!!functions/_readshortcutnuW+A#compdef readshortcut readshortcut.exe # cygutils 1.3.2 _arguments -s -S \ '(--fields -f)'{-f,--fields}'[show field names]' \ '(--unix -u --windows -w)'{-u,--unix}'[use Unix path format for display (default)]' \ '(--unix -u --windows -w)'{-w,--windows}'[use Windows path format for display ]' \ '(--target -t)'{-t,--target}'[display shortcut target]' \ '(--working -g)'{-g,--working}'[display shortcut working directory]' \ '(--args -r)'{-r,--args}'[display shortcut arguments]' \ '(--showcmd -s)'{-s,--showcmd}'[display shortcut "show" command value]' \ '(--icon -i)'{-i,--icon}'[display icon library location]' \ '(--offset -j)'{-j,--offset}'[display icon library offset]' \ '(--desc -d)'{-d,--desc}'[display shortcut description]' \ '(--all -a)'{-a,--all}'[display all information]' \ '(- 1)'{-h,--help}'[display help information]' \ '(- 1)--usage[display brief usage message]' \ '(- 1)'{-v,--version}'[display version information]' \ '(- 1)--license[display licensing information]' \ '1:shortcut:_files -g "*.lnk(-.)"' PK[͓OOfunctions/VCS_INFO_detect_cdvnuW+A## vim:ft=zsh ## codeville support by: Frank Terbeck ## Distributed under the same BSD-ish license as zsh itself. setopt localoptions NO_shwordsplit [[ $1 == '--flavours' ]] && return 1 VCS_INFO_check_com ${vcs_comm[cmd]} || return 1 vcs_comm[detect_need_file]=format VCS_INFO_bydir_detect '.cdv' return $? PK[afunctions/_dir_listnuW+A#compdef -value-,TERMINFO_DIRS,-default- -P -value-,*PATH,-default- # options: # -s to specify the separator (default is a colon) # -S to say that the separator should be added as a suffix (instead # of the default slash) # any description passed should apply to an individual directory and not # to the entire list local sep=: dosuf suf while [[ "$1" = -(s*|S) ]]; do case "$1" in -s) sep="$2"; shift 2;; -s*) sep="${1[3,-1]}"; shift;; -S) dosuf=yes; shift;; esac done compset -P "*${sep}" compset -S "${sep}*" || suf="$sep" if [[ -n "$dosuf" ]]; then suf=(-S "$suf") else suf=() fi _directories "$suf[@]" -r "${sep}"' /\t\t\-' "$@" PK[mtfunctions/_mkshortcutnuW+A#compdef mkshortcut mkshortcut.exe # cygutils 1.3.2 _arguments -s -S \ '(--arguments -a)'{-a,--arguments=-}'[use specified arguments]:arguments' \ '(--desc -d)'{-d,--desc=-}'[text for description/tooltip (defaults to POSIX path of TARGET)]:description' \ '(--icon -i)'{-i,--icon=-}'[specify icon file for link to use]:icon file:_files' \ '(--iconoffset -j)'{-j,--iconoffset=-}'[specify offset of icon in icon file]:offset' \ '(--name -n)'{-n,--name=-}'[specify name for link]:file:_files' \ '(--show -s)'{-s,--show=-}'[window to show: normal, minimized, maximized]:window state:(norm min max)' \ '(--workingdir -w)'{-w,--workingdir=-}'[set working directory (defaults to directory path of TARGET)]:working directory:_files -/' \ '(--allusers -A)'{-A,--allusers}"[use 'All Users' instead of current user for -D,-P]" \ '(--desktop -D --smprograms -P)'{-D,--desktop}"[create link relative to 'Desktop' directory]" \ '(--desktop -D --smprograms -P)'{-P,--smprograms}"[create link relative to Start Menu 'Programs' directory]" \ '(- 1)'{-h,--help}'[display help information]' \ '(- 1)--usage[display brief usage message]' \ '(- 1)'{-v,--version}'[display version information]' \ '(- 1)--license[display licensing information]' \ '1:target:_files' PK[w$ functions/_arch_namespacenuW+A#autoload _arch_namespace () { #double as arch_namespace_categories local ARCHCMD="$1" shift # takes an integer argument specifying how many components: # 1: category # 2: branch # 3: version # 4: revision local suffix expl archive=`$ARCHCMD my-default-archive 2> /dev/null` local trailing_dashes=0 [[ -n $argv[(r)--trailing-dashes] ]] && trailing_dashes=1 local library [[ -n $argv[(r)--library] ]] && library='library-'; local exclude_library_revisions=0 [[ -n $argv[(r)--exclude-library-revisions] ]] && exclude_library_revisions=1 if [ $1 -gt 1 ] || (( trailing_dashes )); then suffix=(-q -S --) fi if [[ $PREFIX = */* ]]; then compset -P '*/' archive=${IPREFIX%/*} _description -V categories expl "${library:-}categories in $archive" compadd $suffix "$expl[@]" `$ARCHCMD ${library:-}categories $archive` elif [ -z $IPREFIX ]; then local index=$(( words[(i)-A] + 1 )) (( index < CURRENT )) || index=$(( words[(i)--archive] + 1 )) (( index < CURRENT )) && archive=$words[$index] if [ $archive ]; then _description -V categories expl "${library:-}categories in $archive" compadd "$expl[@]" $suffix `$ARCHCMD ${library:-}categories $archive` fi _arch_archives "$ARCHCMD" -S / ${library:+--library} fi if [ $archive ] && [ $1 -gt 1 ] && [[ $PREFIX != *@* ]] \ && [[ $PREFIX = *--* ]]; then #this match could be better _arch_namespace_branches "$ARCHCMD" $(($1 - 1)) fi } (( $+functions[_arch_namespace_branches] )) || _arch_namespace_branches () { local ARCHCMD="$1" shift local suffix expl if [ $1 -gt 1 ] || (( $trailing_dashes )); then suffix=(-q -S --) fi if [[ $IPREFIX != *-- ]]; then compset -P 1 '*--' local category=${IPREFIX%--} _description -V branches expl "${library:-}branches" compadd $suffix "$expl[@]" \ ${${(@)$($ARCHCMD ${library:-}branches $category)}##*--} fi if [ $1 -gt 1 ] && [[ $IPREFIX = *-- ]] && [[ $PREFIX = *--* ]]; then _arch_namespace_versions "${ARCHCMD}" $(($1 - 1)) fi } (( $+functions[_arch_namespace_versions] )) || _arch_namespace_versions () { local ARCHCMD="$1" shift local suffix expl if [ $1 -gt 1 ]; then suffix=(-q -S --) fi if [[ $IPREFIX != *--*-- ]] || [[ $IPREFIX != */*--*-- ]]; then compset -P 1 '*--' local branch=${IPREFIX%--} _description -V versions expl "${library:-}versions" compadd $suffix "$expl[@]" \ ${${(@)$($ARCHCMD ${library:-}versions $branch)}##*--} fi if [ $1 -gt 1 ] && [[ $IPREFIX = *--*-- ]] && ([[ $IPREFIX = */*--*-- ]] \ || [[ $PREFIX != */* ]]) && [[ $PREFIX = *--* ]]; then _arch_namespace_revisions "${ARCHCMD}" fi } (( $+functions[_arch_namespace_revisions] )) || _arch_namespace_revisions () { local ARCHCMD="$1" local expl if [[ $IPREFIX != *--*--*-- ]] || [[ $IPREFIX != */*--*--*-- ]]; then compset -P 1 '*--' local version=${IPREFIX%--} _description -V revisions expl "${library:-}revisions" local completions c completions=( ${${(@)$($ARCHCMD ${library:-}revisions $version)}##*--} ) (( exclude_library_revisions )) && \ foreach c ($($ARCHCMD library-revisions $version)); do completions[(r)$c]=(); done compadd "$expl[@]" -a completions fi } _arch_namespace "$@" PK[7functions/_dputnuW+A#compdef dput _dput() { _arguments \ '(-c --config)'{-c,--config}'[specify config file]:config file:_files' \ '(-d --debug)'{-d,--debug}'[debug mode]' \ '(-D --dinstall)'{-D,--dinstall}'[run dinstall after upload]' \ '(-e --delayed)'{-E,--delayed}'[number of days in delayed queue]:number of days:(0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15)' \ '(-f --force)'{-f,--force}'[force upload of already uploaded package]' \ '(-H --host-list)'{-H,--host-list}'[display host list]' \ '(-l --lintian)'{-l,--lintian}'[run lintian before upload]' \ '(-o --check-only)'{-o,--check-only}'[check the package, do not upload]' \ '(-p --print)'{-p,--print}'[print configuration]' \ '(-s --simulate)'{-s,--simulate}'[simulate an upload only]' \ '(-u --unchecked)'{-u,--unchecked}'[do not check GPG signature on the changes file]' \ '(-v --version)'{-v,--version}'[show version information]' \ '1::host:_dput_hosts' \ '*:changes file:_files -g "*.changes(-.)"' } _dput_hosts() { local expl if ( [[ ${+_dput_cfhosts} -eq 0 ]] || _cache_invalid dputhosts ) && ! _retrieve_cache dputhosts; then _dput_cfhosts=(${${(M)${(f)"$(dput -H)"}:#*=>*}/ =>*/}) _store_cache dputhosts _dput_cfhosts fi _wanted dputhosts expl 'target host' compadd -a _dput_cfhosts } _dput "$@" PK[`88functions/_zstylenuW+A#compdef zstyle local state context ostate line expl ctop suf local nm=$compstate[nmatches] taglist patterns pstyles contexts typeset -A opt_args styles (( $+functions[_completers] )) || _completers() { # option: -p - needs a `_' prefix local us local -a disp list expl list=( complete approximate correct match expand list menu oldlist ignored prefix history ) zparseopts -D -K -E 'p=us' [[ -n "$us" ]] && us='_' zstyle -t ":completion:${curcontext}:completers" prefix-hidden && disp=(-d list) _wanted completers expl 'completer' \ compadd "$@" "$disp[@]" - "$us${^list[@]}" } # Assoc array of styles; the values give the possible top-level # contexts: # c completion # d chpwd # e line editor # v vcs_info # z zftp # or any combination of the above, # followed by a colon, followed by a state to enter, empty if none. styles=( accept-exact c:bool accept-exact-dirs c:bool add-space c:bool ambiguous c:bool assign-list c:_parameters auto-description c: avoid-completer c:completer break-keys c: cache-path c:_directories cache-policy c:_functions call-command c:bool command c:command command-path c:_dir_list commands c: complete c:bool complete-options c:bool completer c:completer condition c:bool cursor c:cursor delimiters c: disabled c:bool domains c: environ c:environ expand c: extra-verbose c:bool fake c: fake-always c: fake-files c:fake-files fake-parameters c:fake-params file-list c:bool file-patterns c:filepat file-sort c:fsort filter c: force-list c: format c: glob c:bool global c:bool group-name c: group-order c:tag groups c:_groups hidden c:bool hosts c:_hosts hosts-ports c:host-port ignore-line c:ignline ignore-parents c:ignorepar ignored-patterns c: insert-ids c:insert-ids insert-tab c:bool insert-unambiguous c:insunambig keep-prefix c:keep-prefix last-prompt c:bool list ce:listwhen list-colors c: list-dirs-first c:bool list-grouped c:bool list-packed c:bool list-prompt c: list-rows-first c:bool list-separator c:separator list-suffixes c:bool local c: mail-directory c:_directories match-original c:match-orig matcher c: matcher-list c: max-errors c: max-matches-width c:max-matches-width menu c:boolauto muttrc c:_files numbers c:bool old-list c:bool old-matches c:oldmatches old-menu c:bool original c:bool packageset c:packageset path c:_directories pager c:_command_names path-completion c:bool pine-directory c:_directories ports c:_ports prefix-hidden c:bool prefix-needed c:bool preserve-prefix c:preserve-prefix range c: recent-dirs-insert c:recent-dirs-insert regular c:bool rehash c:bool remote-access c:bool remove-all-dups c:bool select-prompt c: select-scroll c: separate-sections c:bool show-completer c:bool single-ignored c:single-ignored sort c:bool special-dirs c:sdirs squeeze-slashes c:bool stop c:stop strip-comments c:bool subst-globs-only c:bool substitute c:bool suffix c:bool tag-order c:tag-order try-to-use-pminst c:bool urls c:_urls use-cache c:bool use-compctl c:urgh use-ip c:bool use-perl c:bool users c:_users users-hosts c:user-host users-hosts-ports c:user-host-port verbose ce:bool word c:bool recent-dirs-default d:bool recent-dirs-file d:_files recent-dirs-max d: recent-dirs-prune d: recent-dirs-pushd d:bool auto-previous e:bool break-keys e: cursor e: edit-buffer e:bool edit-previous e:bool insert-kept e: leave-cursor e:bool match e: prompt e: stop-keys e: toggle e:bool url-globbers e: url-local-schema e: url-metas e: url-other-schema e: url-seps e: whence e: word-chars e: word-style e:word-style word-context e: formats v:vcs-format actionformats v:vcs-format branchformat v:branch-format nvcsformats v: stgitformat v:stg-format max-exports v: enable v:vcs disable v:vcs disable-patterns v: check-for-changes v:bool stagedstr v: unstagedstr v: command v:_command_names use-server v:bool use-simple v:bool get-revision v:bool use-prompt-escapes v:bool chpwd z:bool progress z:progress remote-glob z:bool titlebar z:bool update z: ) taglist=( accounts all-expansions all-files arguments arrays association-keys bookmarks builtins characters colormapids colors commands contexts corrections cursors default descriptions devices directories directory-stack displays expansions extensions files flags fstypes fonts functions globbed-files groups history-words hosts indexes interfaces jobs keymaps keysyms libraries limits local-directories mailboxes manuals maps messages modifiers modules my-accounts named-directories names newsgroups nicknames options original other-accounts packages parameters path-directories paths pods ports prefixes printers processes processes-names ps regex sequences sessions signals strings styles tags targets timezones types urls users values variant visuals warnings widgets windows zsh-options email-address ${(k)functions[(I)_email-*]#_} ) _arguments -C \ '(-)-L[output in form of zstyle commands]' \ '(: -)-d[delete style definitions]:context pattern:->patterns:*:styles:->pstyles' \ '(-)-e[value is evaluated when style is looked up]' \ ':context:->contexts' ':style:->styles' '*:argument:->style-arg' while (( $#state )); do case "$state[1]" in (contexts) if [[ ! -prefix :*: ]]; then _wanted contexts expl context compadd -P : -qS : completion vcs_info zftp elif compset -P :completion:; then contexts=( functions _completers cmdorcont argument tag ) elif compset -P :vcs_info:; then contexts=( vcs-string user-context repo-root-name ) fi if (( $#contexts )); then for ostate in $contexts; do compset -P '[^:]#:' || break done suf=() compset -S ':*' || suf=( -qS: ) [[ $ostate = $contexts[-1] ]] && suf=() if compset -P '(|\\)\((*\||)'; then # handle (x|y) patterns suf=() compset -S '(|\\)[)|]*' || suf=( -S "${${QIPREFIX:+|}:-\|}" -r "${${QIPREFIX:+|}:-\\\\} \t)" ) fi state+=( "$ostate" ) fi ;; (patterns) zstyle -g patterns _wanted contexts expl 'context pattern' compadd -a patterns ;; (pstyles) zstyle -g pstyles ${(Q)${(M)opt_args[-d]#*[^\\]:}%:} _wanted styles expl style compadd -a pstyles ;; (styles) # Get the top-level context we're completing for, if any. case ${(Q)line[1]} in (:completion:*) ctop=c ;; (:chwpd:*) ctop=d ;; (:zftp:*) ctop=z ;; (:vcs_info:*) ctop=v ;; (:zle:*) ctop=e ;; (*) ctop=cdez ;; esac _wanted styles expl style \ compadd -M 'r:|-=* r:|=*' -k "styles[(R)[^:]#[$ctop][^:]#:*]" ;; (style-arg) state+=( "${styles[${(Q)line[2]}]#*:}" ) ;; (argument) _message -e arguments argument ;; (bool) _wanted values expl boolean compadd true false ;; (boolauto) _wanted values expl boolean \ compadd true false auto select search search-backward interactive ;; (cmdorcont) _alternative -O suf \ 'commands:command:_command ' \ 'contexts:context:(-array-value- -brace-parameter- -command- -condition- -math- -parameter- -redirect- -subscript- -value-)' ;; (cursor) _wanted values expl 'cursor positioning' compadd complete key default ;; (completer) _wanted values expl completer _completers -p ;; (environ) if [[ "$PREFIX" = *\=* ]]; then compstate[parameter]="${PREFIX%%\=*}" compset -P 1 '*=' _value else suf=() compset -S '=*' || suf=(-S '=') _parameters -q $suf fi ;; (fsort) _wanted values expl 'how to sort files' \ compadd name size links time date modification access inode change reverse ;; (function) _wanted control-function expl 'control function' \ compadd predict-on all-matches ;; (functions) _wanted comp-widget expl 'completion widget' \ compadd $suf - all-matches complete-debug complete-tag \ correct-word expand-word expand-alias-word history-words ;; (user-host-port) if [[ $PREFIX != *[@:]* ]]; then _users -S @ elif [[ $PREFIX = *[@:]*[[@:]* ]]; then compset -P 2 '*[:@]' _ports else compset -P 1 '*[:@]' _hosts -S : fi ;; (host-port) if [[ $PREFIX != *:* ]]; then _hosts -S : else compset -P 1 '*:' _ports fi ;; (listwhen) _wanted values expl 'when to list completions' \ compadd always never sometimes ;; (packageset) _wanted values expl 'default package set' \ compadd available installed uninstalled ;; (progress) _wanted values expl 'progress meter style' \ compadd none bar percent ;; (sdirs) _wanted values expl 'whether to complete . or ..' \ compadd true false .. ;; (stop) _wanted values expl 'when to insert matches' \ compadd true false verbose ;; (tag) _wanted tags expl tag compadd $suf -a taglist ;; (tag-order) if compset -P '*:*:'; then _message -e descriptions description elif compset -P '*:'; then _message -e labels 'tag label' else suf=() compset -S ':*' || suf=( -qS: ) _wanted values expl tag compadd $suf -a taglist fi ;; (filepat) if compset -P '*:*:'; then _message -e descriptions description elif compset -P '*:'; then _message -e tags tag else _message -e patterns 'glob patterns' fi ;; (user-host) if [[ $PREFIX = *[@:]* ]]; then compset -P '*[@:]' _hosts else _users -S @ fi ;; (ignorepar) _wanted values expl 'which parents to ignore' \ compadd parent pwd .. directory ;; (single-ignored) _wanted values expl 'how to handle a single ignored match' \ compadd - show menu ;; (command) shift 3 words (( CURRENT -= 3 )) _normal ;; (insert-ids) _wanted values expl 'when to insert process IDs' \ compadd - menu single longer ;; (fake-files) _message -e fakes 'prefix and names' ;; (fake-params) if compset -P '*:'; then _wanted values expl 'parameter type' compadd scalar array integer else suf='' compset -S ':*' || suf='-qS:' _wanted values expl 'fake parameter' _parameters $suf fi ;; (ignline) _wanted values expl 'ignore strings on the line' compadd true false current current-shown other ;; (keep-prefix) _wanted values expl 'keep prefix' compadd true false changed ;; (match-orig) _wanted values expl "match without inserting \`*'" compadd only both ;; (oldmatches) _wanted values expl 'use list of old matches' compadd true false only ;; (insunambig) _wanted values expl 'insert unambiguous string' compadd true false pattern ;; (preserve-prefix) _message -e prefixes 'pattern matching prefix to keep' ;; (recent-dirs-insert) _wanted values expl 'inserting recent directories' \ compadd true false always fallback both ;; (separator) _message -e separators 'separator string' ;; (max-matches-width) _message -e numbers 'maximum display width for matches' ;; (urgh) _wanted values expl no compadd no false off 0 ;; (word-style) _wanted word-styles expl 'word style' compadd normal shell space ;; (vcs-string) _wanted vcs expl vcs compadd $suf - \ ${${(f)"$(_call_program vcs vcs_info_printsys 2>/dev/null)"}:#\#*} ;; (vcs) _wanted vcs expl vcs compadd \ ${${(f)"$(_call_program vcs vcs_info_printsys 2>/dev/null)"}:#(\#|*-)*} ;; (user-context) _wanted user-contexts expl 'user context' compadd $suf default command ;; (repo-root-name) _message -e names 'repository root name' ;; (vcs-format) if [[ $PREFIX = *% ]]; then compset -P '*%' _values -s '' 'format replacement' \ 's[the vcs in use]' \ 'b[the current branch]' \ 'a[an identifier describing the action]' \ 'i[current revision no/id]' \ 'c[details of staged changes]' \ 'u[details of unstaged changes]' \ 'r[repository name]' \ 'S[subdirectory within repository]' \ 'm[misc replacement - backend specific]' else _message -e formats 'vcs format' fi ;; (branch-format) if [[ $PREFIX = *% ]]; then compset -P '*%' _values -s '' 'format replacement' \ 'b[the current branch]' \ 'r[current revision number]' \ else _message -e formats 'vcs format' fi ;; (stg-format) if [[ $PREFIX = *% ]]; then compset -P '*%' _values -s '' 'format replacement' \ 'p[patch currently on top of the stack]' \ 'c[the number of unapplied patches]' else _message -e formats 'vcs format' fi ;; (_*) ${=state[1]} $suf ;; esac shift state done [[ $compstate[nmatches] != $nm ]] PK[ą̑functions/_whoisnuW+A#compdef whois fwhois _whois () { _whois_setup case "$0" in fwhois) _whois_fwhois;; *) $_whois_comp;; esac } (( $+functions[_whois_setup] )) || _whois_setup () { (( $+_whois_defaultserver )) || _whois_defaultserver='whois.internic.net' (( $+_whois_servers )) || { typeset -gUa _whois_servers _whois_servers=( $_whois_defaultserver domain-registry.nl is.nic.pw whois.apnic.net:p whois.arin.net:a whois.aunic.net whois.berkeley.edu whois.cdnnet.ca whois.dns.pt whois.funet.fi whois.gb.com whois.gb.net whois.internic.net whois.jpl.nasa.gov whois.nic-se.se whois.nic.ad.jp whois.nic.af whois.nic.as whois.nic.br whois.nic.bt whois.nic.ch whois.nic.cx whois.nic.fr whois.nic.gov:g whois.nic.hm whois.nic.it whois.nic.li whois.nic.lk whois.nic.mil:d whois.nic.mx whois.nic.nu whois.nic.or.kr whois.nic.sh whois.nic.tj whois.nic.tm whois.nic.uk whois.ripe.net:r whois.ripn.net:R whois.sics.se whois.stanford.edu whois.uk.com www.nic.at $(functions -m '_whois:*' | awk '/^undefined _whois:/ {print substr($2,8,length($2)-7)} /^_whois:/ {print substr($1,8,length($1)-7)}') ) } (( $+_whois_arguments )) || { local help="$(whois &1)" local tmp opt opts local hostopt=-h+ if [[ $help = *"user[@]"* ]]; then _whois_comp=_whois_fwhois elif [[ $help = *(name\ ...|OBJECT...)* ]]; then _whois_comp=_whois_multi else _whois_comp=_whois_single hostopt=-h fi _whois_arguments=() if [[ $help = *"-p PORT"* ]]; then _whois_arguments=("$_whois_arguments[@]" '-p[port]:port:_whois_ports' ) fi tmp="${(j::)${(@)${(@M)_whois_servers:#*:?}##*:}}" if [[ $help = (#b)*\[-([$tmp]##)\]* ]]; then tmp=(${(s::)match[1]}) else tmp=() fi if [[ $help = *"-h host"* ]]; then tmp=($tmp h) fi for opt in $tmp; do opts=(-${^tmp:#$opt}) if (( $#opts )); then opts="($opts)"; else opts=; fi if [[ $opt = h ]]; then _whois_arguments=("$_whois_arguments[@]" "${opts}${hostopt}:host:_whois_hosts") else _whois_arguments=("$_whois_arguments[@]" "${opts}-${opt}[${${(@M)_whois_servers:#*:$opt}%:?}]") fi done } } _whois_single () { local curcontext="$curcontext" state line expl typeset -A opt_args local tmp host _arguments -C \ "$_whois_arguments[@]" \ ':identifier:->identifier' && return 0 case "$state" in identifier) if [[ -z "$QIPREFIX" && -z "$PREFIX" ]]; then compadd -QS '' \' return fi compset -q host="${opt_args[-h]:-$_whois_defaultserver}" for tmp in $_whois_servers; do if [[ $tmp = *:? && $+opt_args[-${tmp##*:}] -ne 0 ]]; then host="${tmp%:?}" break fi done if (( $+functions[_whois:$host] )); then "_whois:$host" "$expl[@]" else _message -e identifiers "identifier" fi ;; esac } _whois_multi () { local curcontext="$curcontext" state line expl typeset -A opt_args local tmp host _arguments -C \ "$_whois_arguments[@]" \ '*::identifier:->identifier' && return 0 case "$state" in identifier) host="${opt_args[-h]:-$_whois_defaultserver}" for tmp in $_whois_servers; do if [[ $tmp = *:? && $+opt_args[-${tmp##*:}] -ne 0 ]]; then host="${tmp%:?}" break fi done if (( $+functions[_whois:$host] )); then "_whois:$host" "$expl[@]" else _message -e identifiers "identifier" fi ;; esac } _whois_fwhois () { if compset -P '*@'; then _whois_hosts "$@" else if [[ -z "$QIPREFIX" && -z "$PREFIX" ]]; then compadd -QS '' \' return fi compset -q host="$_whois_defaultserver" if (( $+functions[_whois:$host] )); then "_whois:$host" "$@" else _message -e identifiers "identifier" fi fi } _whois_hosts () { _tags hosts && compadd "$@" \ -M 'm:{a-zA-Z}={A-Za-z} r:|.=* r:|=*' \ - ${_whois_servers%:?} || _hosts "$@" } _whois_ports () { _tags ports && compadd "$@" - whois || _ports "$@" } (( $+functions[_whois:whois.internic.net] )) || _whois:whois.internic.net () { if (( CURRENT == 1 )); then local expl _wanted strings expl string compadd HELP DOMAIN HOST else _message -e strings 'string' fi } (( $+functions[_whois:whois.nic.ad.jp] )) || _whois:whois.nic.ad.jp () { if (( CURRENT == 1 )); then local expl _wanted strings expl string compadd HELP DOM NET HOST PERSON CONN COM else _message -e strings 'string' fi } _whois "$@" PK[m  functions/_qtplaynuW+A#compdef qtplay _arguments -S \ '(- *)-cd[play a CD]' \ '(-)-f[read files as playlist]:*:playlist:_files' \ '-l[loop]' \ '-q[quiet]' \ '-Q[quicktime only]' \ '-s[speak filenames]' \ '-S[sound manager only]' \ '-v[verbose]' \ '-z[shuffle play]' \ '-Z[random play]' \ '-1[play one random file]' \ '-t[specify update time]:update time (seconds)' \ '-T[kill time]:ticks' \ '-V[volume]:percentage of normal volume' \ '(-)'{-?,--help,-h}'[display help information]' \ '(-)*:quicktime file:_files' PK[Q 666functions/_fuse_argumentsnuW+A#autoload local ret long rawret nm=${compstate[nmatches]} fsopt cvalsvar typeset -a fargs opts fargs=( '(-d -f)-d[enable debug output]' '-f[enable foreground operation]' '-r[mount filesystem read-only]' '-s[disable multi-threaded operation]' '(-h --help)'{-h,--help}'[display help and exit]' '(-V --version)'{-V,--version}'[show version information and exit]' ) (( $# )) || fargs+='*:default: _default' long=$argv[(I)--] if (( long )); then argv[long]=($fargs --) else set -- "$@" $fargs fi while [[ $1 == -(O*|F*|[CRWsw]) ]]; do if [[ $1 == -F?* ]]; then cvalsvar=${1[3,-1]} elif [[ $1 == -F ]]; then cvalsvar=$2 shift else opts+=$1 [[ $1 == -R ]] && rawret=yes fi shift done if [[ $cvalsvar != - ]]; then fsopt='*-o[specify mount options]:mount option:_fuse_values' [[ -n $cvalsvar ]] && fsopt+=" -A $cvalsvar" fsopt+=' mount\ option' set -- "$@" $fsopt fi _arguments -R $opts "$@" ret=$? if [[ $ret == 300 ]]; then compstate[restore]= [[ -z $rawret ]] && ret=$(( nm == $compstate[nmatches] )) fi return ret PK[ ݧn functions/_qemunuW+A#compdef qemu _qemu_log_items () { local -a opts hline qemu -d \? | while read -A hline; do [[ $hline[1] = Log ]] && continue opts=($opts "${hline[1]}[${hline[2,-1]}]") done _values -s , 'log items' $opts } local _qemu_machines _qemu_machines=(${${${(f)"$(qemu -M \?)"}[2,-1]}%% *}) _arguments \ '-'{fda,fdb,hda,hdb,hdc,hdd,cdrom}':disk image:_files' \ '-M[target machine]:machine:('"${_qemu_machines:-none}"')' \ '-boot[specify which image to boot from]:boot device:((a\:floppy\ image\ a c\:hard\ disk d\:cdrom))' \ '-snapshot[write to temporary files instead of disk image files]' \ '-no-fd-bootchk[disable boot sig checking for floppies in Bochs BIOS]' \ '-m[virtual RAM size (default=128)]:megs:' \ '-smp[set the number of CPUs (default=1)]:number of CPUs:' \ '-nographic[disable graphical output]' \ '-vnc[listen on VNC display]:display:' \ '-k[use keyboard layout]:keyboard layout language:(ar de-ch es fo fr-ca hu ja mk no pt-br sv da en-gb et fr fr-ch is lt nl pl ru th de en-us fi fr-be hr it lv nl-be pt sl tr)' \ '-audio-help[show audio subsystem help]' \ '-soundhw[enable audio and selected sound hardware]:cards to enable:(all)' \ '-localtime[set rtc to local time]' \ '-full-screen[start in full screen]' \ '-pidfile:pidfile:_files' \ '-win2k-hack' \ '-usb[enable USB driver]' \ '-usbdevice:usb device:' \ '-net:net config:(none)' \ '-tftp[allow tftp access to files starting with prefix]:tftp prefix:_files' \ '-smb[allow SMB access to files in specified directory]:samba directory:_path_files -/' \ '-redir[redirect TCP or UDP connections from host to guest]:redirection: ' \ '-kernel[boot specified linux kernel]:kernel image:_files' \ '-append[use specified kernel command line]:command line: ' \ '-initrd[use specified initial ram disk]:ram disk:_files' \ '-serial:dev:(vc stdio pty null /dev/ttyS0 /dev/partport0)' \ '-parallel:dev:(vc stdio pty null /dev/ttyS0 /dev/partport0)' \ '-monitor:dev:(vc stdio pty null /dev/ttyS0 /dev/partport0)' \ '-s[wait gdb connection to port 1234]' \ '-p[change gdb connection port]:port:_ports' \ '-S[do not start CPU at startup]' \ '-d[output log in /tmp/qemu.log]:log items:_qemu_log_items' \ '-hdachs[force hard disk 0 geometry (usually qemu can guess it)]:hd0 geometry c,h,s:' \ '-std-vga[simulate standard VGA]' \ '-no-acpi[disable ACPI]' \ '-loadvm[start right away with a saved state]:file:_files' \ '-g[set initial graphic mode]:graphic mode:' \ ':disk image:_files' PK[Cok  functions/_softwareupdatenuW+A#compdef softwareupdate _softwareupdate_ignored_update_name() { if [[ -z "$_softwareupdate_ignored_updates" ]]; then local res="$(_call_program pkgs softwareupdate --ignored)" _softwareupdate_ignored_updates=("${(Qs/, /)${${res#Current ignored updates: \(}%\)}}") fi if (( ${#_softwareupdate_ignored_updates} > 0 )); then _wanted pkgs expl "ignored package" compadd -a _softwareupdate_ignored_updates && return 0 fi return 1 } _softwareupdate_update_name() { local name line if [[ -z "$_softwareupdate_updates" ]]; then _softwareupdate_updates=() for line in ${(f)"$(_call_program pkgs softwareupdate --list)"}; do if [[ $line == ' '* ]]; then name="${line# ? }" elif [[ -n "$name" ]]; then _softwareupdate_updates+=("$name:${line# }") name="" fi done fi if (( ${#_softwareupdate_updates} > 0 )); then _describe -t pkgs "update name" _softwareupdate_updates && return 0 fi return 1 } _softwareupdate() { local context state line expl typeset -A opt_args _arguments -R \ '(-h --help -l --list)-q[quiet mode]' \ {-l,--list}'[list all available updates]:*:' \ {-d,--download}'[download to directory set in InternetConfig]:*:' \ {-i,--install}'[install (requires root)]:*: :->install' \ '--ignored[show or manage ignored updates list (per-user)]:*:: :->ignored' \ '--schedule[scheduler preferences (per-user)]:automatic checking:(on off)' \ {-h,--help}'[print command usage]:*:' && return 0 case "$state" in install) _arguments \ '(* -a --all)'{-a,--all}'[all available active updates]' \ '(* -r --req)'{-r,--req}'[all required active updates]' \ '*:update name:_softwareupdate_update_name' && return 0 ;; ignored) local -a ignored_subcmd ignored_subcmd=(add remove) if (( CURRENT == 1 )); then _describe -t commands "subcommands" ignored_subcmd && return 0 fi case $words[1] in add) _softwareupdate_update_name && return 0 ;; remove) _arguments \ '(* -a --all)'{-a,--all}'[all available active updates]' \ '*:update name:_softwareupdate_ignored_update_name' && return 0 ;; esac ;; esac return 1 } _softwareupdate "$@" PK[ġqmmfunctions/_fingernuW+A#compdef finger local curcontext="$curcontext" state line match ret=1 typeset -A opt_args if (( ! $+_finger_args )); then local help="$(_call_program options finger -\\\? 2>&1)" local -A optionmap ## `finger -\?': # SunOS 5.7: # finger: illegal option -- ? # Usage: finger [-bfhilmpqsw] [-t l|h|l,h] [name1 [name2 ...] ] # SunOS 4.1.4: # Usage: finger [-bfhilmpqsw] [login1 [login2 ...] ] # IRIX 6.3: # Usage: finger [-bfhilmpqsw] [login1 [login2 ...] ] # NetBSD 1.4.1: # finger: illegal option -- ? # usage: finger [-lmpsho] [login ...] # FreeBSD 2.2.8 # finger: illegal option -- ? # usage: finger [-lmpshoT] [login ...] # BSD/OS 3.0: # finger: illegal option -- ? # usage: finger [-lmps] [login ...] # 4.4BSD Lite: # usage: finger [-lmps] [login ...] # Debian GNU/Linux (potato) (netstd 3.07-10): # finger: invalid option -- ? # usage: finger [-lmps] [login ...] if [[ "$help" = *\[-(#b)(lmps[a-zA-Z]#)* ]]; then # BSD style optionmap=( '*m*' '-m[match to login name]' '*l*' '(-s -o)-l[force long format]' '*s*' '(-l -p)-s[force short format]' '*p*' '(-s -o)-p[suppress .forward, .plan and .project]' '*o*' '(-l -p)-o[print office information]' '*T*' '-T[disable T/TCP]' ) _finger_args=($optionmap[(K)$match[1]]) elif [[ "$help" = *\[-(#b)(bfhilmpqsw[a-zA-Z]#)* ]]; then # System V style optionmap=( '*m*' '-m[match to login name]' '*l*' '( -i -q -s -f -w)-l[force long format]' '*i*' '(-l -q -s -b -h -p -w)-i[force idle format]' '*q*' '(-l -i -s -b -h -p -w)-q[force quick format]' '*s*' '(-l -i -q -b -h -p)-s[force short format]' '*b*' '(-i -q -s)-b[suppress home and shell]' '*f*' '(-l)-f[suppress header]' '*h*' '(-i -q -s)-h[suppress .project]' '*p*' '(-i -q -s)-p[suppress .plan]' '*w*' '(-i -q -l)-w[suppress full name]' ) _finger_args=($optionmap[(K)$match[1]]) else _finger_args=() fi fi _arguments -C -s $_finger_args '*:finger targets:->finger-targets' && ret=0 case "$state" in finger-targets) _user_at_host -t other-accounts "$@" && return ;; esac return ret PK[ufunctions/_jobsnuW+A#autoload local expl disp jobs job jids pfx='%' desc how expls sep if [[ "$1" = -t ]]; then zstyle -T ":completion:${curcontext}:jobs" prefix-needed && [[ "$PREFIX" != %* && compstate[nmatches] -ne 0 ]] && return 1 shift fi zstyle -t ":completion:${curcontext}:jobs" prefix-hidden && pfx='' zstyle -T ":completion:${curcontext}:jobs" verbose && desc=yes if [[ "$1" = -r ]]; then jids=( "${(@k)jobstates[(R)running*]}" ) shift expls='running job' elif [[ "$1" = -s ]]; then jids=( "${(@k)jobstates[(R)suspended*]}" ) shift expls='suspended job' else [[ "$1" = - ]] && shift jids=( "${(@k)jobtexts}" ) expls=job fi if [[ -n "$desc" ]]; then disp=() zstyle -s ":completion:${curcontext}:jobs" list-separator sep || sep=-- for job in "$jids[@]"; do [[ -n "$desc" ]] && disp=( "$disp[@]" "${pfx}${(r:2:: :)job} $sep ${(r:COLUMNS-8:: :)jobtexts[$job]}" ) done fi zstyle -s ":completion:${curcontext}:jobs" numbers how if [[ "$how" = (yes|true|on|1) ]]; then jobs=( "$jids[@]" ) else local texts i text str tmp num max=0 # Find shortest unambiguous strings. texts=( "$jobtexts[@]" ) jobs=() for i in "$jids[@]"; do text="$jobtexts[$i]" str="${text%% *}" if [[ "$text" = *\ * ]]; then text="${text#* }" else text="" fi tmp=( "${(@M)texts:#${str}*}" ) num=1 while [[ -n "$text" && $#tmp -ge 2 ]]; do str="${str} ${text%% *}" if [[ "$text" = *\ * ]]; then text="${text#* }" else text="" fi tmp=( "${(@M)texts:#${str}*}" ) (( num++ )) done [[ num -gt max ]] && max="$num" jobs=( "$jobs[@]" "$str" ) done if [[ "$how" = [0-9]## && max -gt how ]]; then jobs=( "$jids[@]" ) else [[ -z "$pfx" && -n "$desc" ]] && disp=( "${(@)disp#%}" ) fi fi if [[ -n "$desc" ]]; then _wanted jobs expl "$expls" compadd "$@" -ld disp - "%$^jobs[@]" else _wanted jobs expl "$expls" compadd "$@" - "%$^jobs[@]" fi PK[ߚDDfunctions/_mdadmnuW+A#compdef mdadm typeset -A opt_args local -a args misc modes _raids_build () { _values -S \ "MD device type" \ 'linear[linear]' \ {0,raid0,stripe}'[striping]' \ {1,raid1,mirror}'[mirroring]' \ {multipath,mp}'[multiple paths to one common physical storage device]' \ 'faulty[injects faults]' } _raids () { _values -S \ "MD device type" \ 'linear[linear]' \ {0,raid0,stripe}'[striping]' \ {1,raid1,mirror}'[mirroring]' \ {4,raid4}'[RAID 4]' \ {5,raid5}'[RAID 5]' \ {6,raid6}'[RAID 6]' \ {10,raid10}'[RAID 1+0]' \ {multipath,mp}'[multiple paths to one common physical storage device]' \ 'faulty[injects faults]' } _layouts () { case ${(v)opt_args[(I)-(l|-level)]} in 5|raid5) _values -S \ "RAID5 parity block layout" \ {left-asymmetric,la}'[left-asymmetric]' \ {left-symmetric,ls}'[left-symmetric]' \ {right-asymmetric,ra}'[right-asymmetric]' \ {right-symmetric,rs}'[right-symmetric]' ;; 10|raid10) _values -s ' ' 'RAID10 layout with number of copies of each datablock' \ 'n1[near copies]' \ 'n2[near copies]' \ 'n3[near copies]' \ 'n4[near copies]' \ 'n5[near copies]' \ 'n6[near copies]' \ 'n7[near copies]' \ 'n8[near copies]' \ 'n8[near copies]' \ 'f1[far copies]' \ 'f2[far copies]' \ 'f3[far copies]' \ 'f4[far copies]' \ 'f5[far copies]' \ 'f6[far copies]' \ 'f7[far copies]' \ 'f8[far copies]' \ 'f9[far copies]' ;; faulty) _values -S \ "Failure mode" \ {write-transient,wt}'[write-transient]' \ {read-transient,rt}'[read-transient]' \ {write-presistent,wp}'[write-presistent]' \ {read-presistent,rp}'[read-presistent]' \ write-all'[write-all]' \ {read-fixable,rf}'[read-fixable]' \ {clear,none}'[remove any pending or periodic failure modes]' \ flush'[clear any persistant faults]' esac } if (( $+words[(r)-(A|-assemble)] )); then args=( '(--bitmap)'--bitmap='[bitmap file to use with the array]::bitmap file:_files' '(--uuid -u)'{--uuid=,-u}'[UUID of array to assemble]:UUID' '(--super-minor -m)'{--super-minor=,-m}'[minor number to look for in super-block]:minor number' '(--name -N)'{--name=,-N}'[array name to look for in super-block]:array name' '(--config -c)'{--config=,-c}'[config file]::config file:_files' '(--scan -s)'{--scan,-s}'[scan config file for missing information]' '(--run -R)'{--run,-R}'[try to start the array even if not enough devices for a full array are present]' '(--force -f)'{--force,-f}'[assemble the array even if some superblocks appear out-of-date]' '(--update,-U)'{--update=,-U}'[update superblock]::update the superblock:(sparc2.2 summaries uuid resync byteorder super-minor)' ) fi if (( $+words[(r)-(B|-build)] )); then args=( '(--bitmap)'--bitmap='[file to store/find bitmap information in]::bitmap file:_files' '(--chunk -c)'{--chunk=,-c}'[chunk size of kibibytes]:chunk size' '(--rounding)'--rounding='[rounding factor for linear array (==chunk size)]:rounding factor' '(--level -l)'{--level=,-l}'[RAID level]::RAID level:_raids_build' '(--raid-devices -n)'{--raid-devices=,-n}'[number of active devices in array]:active devices number' '(--bitmap-chunk)'--bitmap-chunk='[bitmap chunksize in Kilobytes]:bitmap chunk' '(--delay -d)'{--delay=,-d}'[bitmap update delay in seconds]:bitmap update delay' ) fi if (( $+words[(r)-(C|-create)] )); then args=( '(--bitmap)'--bitmap='[create a bitmap for the array with the given filename]::bitmap file:_files' '(--chunk -c)'{--chunk=,-c}'[chunk size of kibibytes]:chunk size' '(--rounding)'--rounding='[rounding factor for linear array (==chunk size)]:rounding factor' '(--level -l)'{--level=,-l}'[RAID level]::RAID level:_raids' '(--parity -p --layout)'{--parity=,-p,--layout=}'[RAID5/6/10 parity algorithm, faulty mode]::layout:_layouts' '(--raid-devices -n)'{--raid-devices=,-n}'[number of active devices in array]:active devices number' '(--spare-devices -x)'{--spare-devices=,-x}'[number of spares (eXtras) devices in initial array]:spare devices number' '(--size -z)'{--size=,-z}'[size (in K) of each drive in RAID1/4/5/6/10]:size of each drive' '(--force -f)'{--force,-f}'[honour devices as listed on command line]' '(--run -R)'{--run,-R}'[insist of running the array even if not all devices are present or some look odd]' '(--readonly -o)'{--readonly,-o}'[start the array readonly]' '(--name -N)'{--name=,-N}'[textual name for array - max 32 characters]:array name' '(--bitmap-chunk)'--bitmap-chunk='[bitmap chunksize in Kilobytes]:bitmap chunk' '(--delay -d)'{--delay,-d}'[bitmap update delay in seconds]:bitmap update delay' ) fi if (( $+words[(r)-([DEXQ]|-(detail|examine(|-bitmap)|query))] )); then args=( '(--zero-superblock)'--zero-superblock'[erase the MD superblock from a device]' '(--run -R)'{--run,-R}'[start a partially built array]' '(--stop -S)'{--stop,-S}'[deactivate array, releasing all resources]' '(--readonly -o)'{--readonly,-o}'[mark array as readonly]' '(--readwrite -w)'{--readwrite,-w}'[mark array as readwrite]' '(--test -t)'{--test,-t}'[exit status 0 if ok, 1 if degrade, 2 if dead, 4 if missing]' ) fi if (( $+words[(r)-(F|-follow|-monitor)] )); then args=( '(--mail -m)'{--mail=,-m}'[address to mail alerts of failure to]:::_email_addresses' '(--program -p --alert)'{--program=,-p,--alert=}'[program to run when an event is detected]::program:_files' '(--delay -d)'{--delay=,-d}'[seconds of delay between polling state]:seconds' '(--config -c)'{--config=,-c}'[specify a different config file]::config file:_files' '(--scan -s)'{--scan,-s}'[find mail-address/program in config file]' '(--daemonise -f)'{--daemonise,-f}'[fork and continue in child, parent exits]' '(--pid-file -i)'{--pid-file=,-i}'[in daemon mode write pid to specified file instead of stdout]::PID file:_files' '(--oneshot -1)'{--oneshot,-1}'[check for degraded arrays, then exit]' '(--test -t)'{--test,-t}'[generate a TestMessage event against each array at startup]' ) fi if (( $+words[(r)-(G|-grow)] )); then args=( '(--size -z)'{--size=,-z}'[change the active size of devices in an array]:active size' '(--raid-disks -n)'{--raid-disks=,-n}'[change the number of active devices in a RAID1 array]:number of active devices' ) fi _mds () { local -a vals vals=( ${${${(M)${(f)"$(< /etc/mdadm.conf)"}##ARRAY *}//ARRAY /}%%[[:blank:]]*} ) _describe -t mds "RAID devices" vals _arguments \ "(-h --help)"{-h,--help}'[display a mode specific help message]' } modes=(-A --assemble -B --build -C --create -F --follow --monitor -G --grow -h --help -V --version) misc=(-D --detail -E --examine -X --examine-bitmap -Q --query) _arguments \ "($misc $modes)"{-A,--assemble}'[assemble a pre-existing array]:::_mds' \ "($misc $modes)"{-B,--build}'[build a legacy array without superblocks]:::_mds' \ "($misc $modes)"{-C,--create}'[create a new array]' \ "($misc $modes)"{-F,--follow,--monitor}'[select Monitor mode]' \ "($misc $modes)"{-G,--grow}'[change the size or shape of an active array]' \ "($modes -D --detail -E --examine -X --examine-bitmap)"{-D,--detail}'[print detail of one or more md devices]' \ "($modes -D --detail -E --examine -X --examine-bitmap -Q --query)"{-E,--examine}'[print content of md superblock on device(s)]' \ "($modes -Q --query)"{-Q,--query}'[examine a device]' \ "($modes -E --examine -X --examine-bitmap)"{-X,--examine-bitmap}'[report information about a bitmap file]' \ "(-)"{-h,--help}'[display general help message]' \ "(-)"{-V,--version}'[print version information for mdadm]' \ "$args[@]" PK[R functions/_pingnuW+A#compdef ping if _pick_variant iputils=iputils unix -V; then _arguments \ '-a[audible]' \ '-A[adaptive]' \ '-b[allow pinging a broadcast address]' \ '-B[do not allow ping to change source address]' \ '-c:count' \ '-d[set SO_DEBUG on the socket]' \ '-f[flood ping]' \ '-i:interval in seconds' \ '-I:iface:_net_interfaces' \ '-l:preload number' \ '-L[suppress loopback of multicast packets]' \ '-n[numeric output only]' \ '-p:padding pattern' \ '-Q:QoS TOS bits' \ '-q[quiet]' \ '-r[bypass normal routing tables]' \ '-R[record route]' \ '-s:packet size in bytes' \ '-S:sndbuf' \ '-t:timeout in seconds' \ '-T:timestamp option:(tsonly tsandaddr tsprespec)' \ '-M:Path MTU Discovery strategy:((do\:prohibit\ fragmentation want\:fragment\ locally dont\:do\ not\ set\ DF\ flag))' \ '-U[print full user-to-user latency]' \ '-v[verbose]' \ '-w:deadline in seconds' \ '-W:seconds to wait for a response' \ ':host:_hosts' else # FreeBSD 4.11 _arguments \ '-A[audible for no packet]' \ '-Q[somewhat quiet]' \ '-R[record route]' \ '-a[audible for each packet]' \ '-d[set SO_DEBUG on the socket]' \ '-f[flood ping]' \ '-n[numeric output only]' \ '-q[quiet]' \ '-r[bypass normal routing tables]' \ '-v[verbose]' \ '-c:count' \ '-i:wait seconds' \ '-l:preload number' \ '-m:ttl' \ '-p:padding pattern' \ '-P:IPsec policy' \ '-s:packet size in bytes' \ '-S:src addr' \ '-t:timeout in seconds' \ '-L[suppress loopback of multicast packets]' \ '-I:iface:_net_interfaces' \ '-T:ttl for multicasted packets' \ ':host:_hosts' fi PK[[~SSfunctions/_loadkeysnuW+A#compdef loadkeys case $OSTYPE in linux*) _arguments \ '(--clearcompose -c)'{--clearcompose,-c}'[clear kernel compose table]' \ '(--default -d)'{--default,-d}'[load default keymap file]' \ '(--help -h)'{--help,-h}'[display help information]' \ '(--mktable -m)'{--mktable,-m}'[output a "defkeymap.c" to stdout]' \ '(--clearstrings)'{--clearstrings,-s}'[clear kernel string table]' \ '*'{--verbose,-v}'[print more details]' \ ':keymap:_files -W /usr/share/keymaps' ;; solaris*) _files -W /usr/share/lib/keytables ;; *) _default;; esac PK[?functions/_modutilsnuW+A#compdef lsmod modinfo modprobe rmmod insmod local curcontext="$curcontext" expl state line modules ign args ret=1 local -r modules_dir=/lib/modules args=( '(-)'{-V,--version}'[print version]' '(-)'{-h,--help}'[print help text]' ) case "$service" in lsmod) _arguments -s "$args[@]" && return ;; modinfo) _arguments -s -C "$args[@]" \ '(-)'{-a,--author}"[display the module's author]" \ '(-)'{-d,--description}"[display the module's description]" \ '(-)'{-l,--license}"[display the module's license]" \ '(-)'{-n,--filename}"[display the module's filename]" \ '(-)'{-p,--parameters}'[display the typed parameters that a module may support]' \ '(-)'{-F,--field}"[display only selected module's information]:module_field:( alias author depends description filename license parm)" \ '(-)-k[use modules from a different kernel version]:kernel_version:( $(echo $modules_dir/*(/\:t)))' \ '1:module file:->all_modules' && ret=0 ;; modprobe) ign='-h --help -V --version -c --showconfig' _arguments -s -C "$args[@]" \ "(-a --all $ign)"{-a,--all}'[load all matching modules]' \ '(-)'{-c,--showconfig}'[show current configuration]' \ "(-d --debug $ign)"{-d,--debug}'[print debug info]' \ "(-k --autoclean $ign)"{-k,--autoclean}'[set autoclean]' \ "(-n --show $ign)"{-n,--show}"[don't actually perform action]" \ "(-q --quiet $ign)"{-q,--quiet}"[don't complain about insmod failures]" \ "(-s --syslog $ign)"{-s,--syslog}'[report via syslog instead of stderr]' \ "(* -t --type $ign)"{-t,--type}'[module type]:module type' \ "(-v --verbose $ign)"{-v,--verbose}'[print all commands as executed]' \ '(-C --config)'{-C,--config}'[specify config file]:config file:_files' \ "(-r --remove -l --list -t --type -a --all $ign)"{-r,--remove}'[remove module (stacks)]' \ "(* -l --list -r --remove $ign)"{-l,--list}'[list matching modules]' \ "(-c $ign)1:modules:->loadable_modules" \ "(-c -l --list -t --type $ign)*:params:->params" && ret=0 [[ -n $state ]] && (( $+opt_args[-r] )) && state=loaded_modules ;; rmmod) _arguments -s -C "$args[@]" \ '(-a --all)'{-a,--all}'[remove all unused autocleanable modules]' \ '(-e --persist)'{-e,--persist}'[save persistent data]' \ '(-r --stacks)'{-r,--stacks}'[remove a module stack]' \ '(-s --syslog)'{-s,--syslog}'[output to syslog]' \ '(-v --verbose)'{-v,--verbose}'[be verbose]' \ '*:loaded module:->loaded_modules' && ret=0 ;; insmod) _arguments \ '1:module file:_files' \ '*:module parameters:' && ret=0 ;; esac case "$state" in loaded_modules|loadable_modules) if [[ -r /proc/modules ]]; then loaded_modules=(${${(f)"$(/dev/null)"}:#parm:*}##parm:[[:space:]]##} ) if [[ $#params -eq 0 ]]; then _message -e parameter "This modules doesn't have parameters" else typeset -A val_args _values -S = -C -w 'module parameter' \ ${${${(M)params:#*(:bool|\(bool\))}/:/[}/(bool| \(bool\))/]} \ ${^${params:#*(:bool|\(bool\))}/:/[}"]:auto added argument: " && ret=0 fi fi ;; esac return ret PK[ >nnfunctions/_sqshnuW+A#compdef sqsh _sybase_server() { local interfaces if [[ -n "$opt_args[-I]" ]]; then interfaces=${(e)~opt_args[-I]:Q} elif [[ -n "$opt_args[-y]" ]]; then interfaces=${(e)~opt_args[-y]:Q}/interfaces else interfaces=$SYBASE/interfaces fi [[ -f $interfaces ]] && compadd ${${(f)"$(<$interfaces)"}:#[[:space:]#]*} } _arguments : \ '-A[adjust TDS packet size (512)]:packet size (bytes):(512 1024 1536 2048)' \ '-B[turn off file buffering on startup]' \ '-C[send sql statment to server]:sql' \ '-D[change database context on startup]:database' \ '-E[replace default editor (vi)]:editor' \ '-H[set the client hostname]:reported hostname' \ '-I[alternate interfaces file]:interface file:_files' \ '-J[client character set]:charset' \ '*-L[set the value of a given variable]:variable=value' \ '-P[Sybase password (NULL)]:password' \ '-S[name of Sybase server (\$DSQUERY)]:_sybase_server' \ '-U[name of Sybase user]:username' \ '-X[enable client password encryption]' \ '-a[max. # of errors before abort]:number' \ '-b[suppress banner message on startup]' \ '*-c[alias for the ''go'' command]:go alias' \ '-d[min. severity level to display]:severity level (0-22)' \ '-e[echo batch prior to executing]' \ '-f[min. severity level for failure]:failure severity' \ '-h[disable headers and footers]' \ '-i[read input from file]:_files' \ '-k[specify alternate keywords file]:_files' \ '-l[set debugging level]' \ '-m[set display mode (normal)]:display style:(horiz vert bcp html meta pretty none)' \ '-n[set chained transaction mode]:chained transaction mode:(on off)' \ '-o[direct all output to file]:_files' \ '-p[display performance stats]' \ '-r[specify name of .sqshrc]:_files' \ '-s[alternate column separator (\t)]:column separator' \ '-t[filter batches through program]:filter program:_files -g "*(*)"' \ '-v[display current version and exit]' \ '-w[adjust result display width]:number' \ '-y[override value of $SYBASE]:_directories' \ '-z[alternate display language]:language' PK[/) functions/_regex_argumentsnuW+A#autoload ## usage: _regex_arguments funcname regex # _regex_arguments compiles `regex' and emits the result of the state # machine into the function `funcname'. `funcname' parses a command line # according to `regex' and evaluates appropriate actions in `regex'. Before # parsing the command line string is generated by concatenating `words' # (before `PREFIX') and `PREFIX' with a separator NUL ($'\0'). # The `regex' is defined as follows. ## regex word definition: # pattern = "/" ( glob | "[]" ) "/" [ "+" | "-" ] # lookahead = "%" glob "%" # guard = "-" zsh-code-to-eval # caction = ":" tag ":" descr ":" zsh-code-to-eval # action = "{" zsh-code-to-eval "}" ## regex word sequence definition: # element = pattern [ lookahead ] [ guard ] [ caction ] # # regex = element # | "(" regex ")" # | regex "#" # | ( regex | action ) # # | regex "|" regex # example: # compdef _tst tst # _regex_arguments _tst /$'[^\0]#\0'/ /$'[^\0]#\0'/ :'compadd aaa' # _tst complete `aaa' for first argument. # First $'[^\0]#\0' is required to match with command name. # _regex_arguments _tst /$'[^\0]#\0'/ \( /$'[^\0]#\0'/ :'compadd aaa' /$'[^\0]#\0'/ :'compadd bbb' \) \# # _tst complete `aaa' for (2i+1)th argument and `bbb' for (2i)th argument. # _regex_arguments _tst /$'[^\0]#\0'/ \( /$'[^\0]#\0'/ :'compadd aaa' \| /$'[^\0]#\0'/ :'compadd bbb' \) \# # _tst complete `aaa' or `bbb'. ## Recursive decent regex parser # return status of parser functions: # 0 : success # 1 : parse error # 2 : fatal parse error _ra_comp () { _ra_actions=("$_ra_actions[@]" "$1") } _regex_arguments () { local regex funcname="$1" shift regex=(${@:/(#b):(*)/":_ra_comp ${(qqqq)match[1]}"}) eval \ "$funcname"' () { local _ra_p1 _ra_p2 _ra_left _ra_right _ra_com expl tmp nm="$compstate[nmatches]" local _ra_actions _ra_line="${(pj:\0:)${(@)words[1,CURRENT - 1]:Q}}"$'\''\0'\''"$PREFIX" _ra_actions=() zregexparse -c _ra_p1 _ra_p2 "$_ra_line" '"${(j: :)${(qqqq)regex[@]}}"' case "$?" in 0|2) _message "no more arguments";; 1) if [[ "$_ra_line[_ra_p1 + 1, -1]" = *$'\''\0'\''* ]]; then _message "parse failed before current word" else _ra_left="$_ra_line[_ra_p1 + 1, _ra_p2]" _ra_right="$_ra_line[_ra_p2 + 1, -1]" compset -p $(( $#PREFIX - $#_ra_line + $_ra_p1 )) (( $#_ra_actions )) && _alternative "$_ra_actions[@]" fi ;; 3) _message "invalid regex";; esac [[ nm -ne "$compstate[nmatches]" ]] }' } _regex_arguments "$@" PK[EbMM functions/_psnuW+A#compdef ps2epsi ps2pdf psmulti pswrap ps2pdf12 ps2pdf13 ps2pdf14 ps2pdfwr ps2ps local expl ext='' # ghostscript: # ps2epsi ps2pdf ps2pdf12 ps2pdf13 ps2pdf14 ps2pdfwr ps2ps if [[ "$1" == '-z' ]]; then ext='(|.bz2|.gz|.Z)' shift fi _description files expl 'PostScript file' _files "$@" "$expl[@]" -g "*.(#i)(ps|eps)$ext(-.)" PK[Q֞functions/copy-earlier-wordnuW+A# Copy the word before the one you last copied --- call repeatedly # to cycle through the list of words on the history line. # # Words in combination with insert-last-word to use the line reached, # and start from the word before last. Otherwise, it will operate on # the current line. emulate -L zsh setopt typesetsilent typeset -g __copyword if (( ${NUMERIC:-0} )); then # 1 means last word, 2 second last, etc. (( __copyword = ${NUMERIC:-0} )) zstyle -s :$WIDGET widget __copywidget elif [[ -n $__copyword && $WIDGET = $LASTWIDGET ]]; then (( __copyword-- )) elif [[ $LASTWIDGET = *insert-last-word ]]; then __copyword=-2 typeset -g __copywidget=$LASTWIDGET else __copyword=-1 zstyle -s :$WIDGET widget __copywidget fi zle ${__copywidget:-.insert-last-word} 0 $__copyword PK[)functions/_w3mnuW+A#compdef w3m # w3m version w3m/0.5.1 local curcontext="$curcontext" state line expl ret=1 typeset -A opt_args _arguments -C \ '-t[set tab width]:tab width:' \ '-r[ignore backspace effect]' \ '-l[specify number of preserved lines]:number of lines (default 10000):' \ '-I[document charset]:charset:->charset' \ '-O[display/output charset]:charset:->charset' \ '( -s -j)-e[EUC-JP]' \ '(-e -j)-s[Shift_JIS]' \ '(-e -s )-j[JIS]' \ '(-v *)-B[load bookmark]' \ '-bookmark[specify bookmark file]:bookmark file:_files' \ '-T[specify content-type]:content type:_mime_types' \ '-m[internet message mode]' \ '(-B *)-v[visual startup mode]' \ '-M[monochrome display]' \ '-N[open URL of command line on each new tab]' \ '-F[automatically render frame]' \ '-cols[specify column width (used with -dump)]:column width' \ '-ppc[specify the number of pixels per character (4.0...32.0)]:number of pixels (4.0...32.0):' \ '-ppl[specify the number of pixels per line (4.0...64.0)]:number of pixels (4.0...64.0):' \ '( -dump_head -dump_source -dump_both -dump_extra)-dump[dump formatted page into stdout]' \ '(-dump -dump_source -dump_both -dump_extra)-dump_head[dump HEAD and source into stdout]' \ '(-dump -dump_head -dump_both -dump_extra)-dump_source[dump page source into stdout]' \ '(-dump -dump_head -dump_source -dump_extra)-dump_both[dump HEAD and source into stdout]' \ '(-dump -dump_head -dump_source -dump_both )-dump_extra[dump HEAD, source, and extra information into stdout]' \ '-post[use POST method with file content]:POST data file:_files' \ '-header[insert string as a header]:header:' \ '+-[goto specified line]:line number:_guard "[0-9]#" "line number"' \ '-num[show line number]' \ "-no-proxy[don't use proxy]" \ '(-6)-4[IPv4 only (-o dns_order=4)]' \ '(-4)-6[IPv6 only (-o dns_order=6)]' \ "-no-mouse[don't use mouse]" \ '(-no-cookie)-cookie[use cookie]' \ "(-cookie)-no-cookie[don't use cookie]" \ '-pauth[proxy authentication]:user\:pass:->pauth' \ '(-no-graph)-graph[use graphic character]' \ "(-graph)-no-graph[don't use graphic character]" \ '-S[squeeze multiple blank lines]' \ '-W[toggle wrap search mode]' \ "-X[don't use termcap init/deinit]" \ '-title=[set buffer name to terminal title string]:terminal:_terminals' \ '*-o[assign value to config option]:option=value:->option' \ '(- *)-show-option[print all config options]' \ '-config[specify config file]:configuration file:_files' \ '(- *)-help[print usage information]' \ '(- *)-version[print version information]' \ '-debug' \ '(-B -v)*:URL:->html' && ret=0 local -a suf case "$state" in charset) local -a charsets charsets=( US-ASCII ISO-8859-1 ISO-8859-2 ISO-8859-3 ISO-8859-4 ISO-8859-5 ISO-8859-6 ISO-8859-7 ISO-8859-8 ISO-8859-9 ISO-8859-10 ISO-8859-11 ISO-8859-13 ISO-8859-14 ISO-8859-15 ISO-8859-16 EUC-JP Shift_JIS Shift_JISX0213 ISO-2022-JP ISO-2022-JP-2 ISO-2022-JP-3 EUC-CN GBK GB18030 HZ-GB-2312 ISO-2022-CN EUC-TW Big5 HKSCS EUC-KR UHC Johab ISO-2022-KR TIS-620 TCVN-5712 VISCII VPS KOI8-R KOI8-U NeXTSTEP CP437 CP737 CP775 CP850 CP852 CP855 CP856 CP857 CP860 CP861 CP862 CP863 CP864 CP865 CP866 CP869 CP874 CP1006 CP1250 CP1251 CP1252 CP1253 CP1254 CP1255 CP1256 CP1257 CP1258 UTF-8 UTF-7 ) _wanted charsets expl 'character set' compadd -a charsets && ret=0 ;; html) local -a bookmarks w3mhistory if [[ -s ~/.w3m/bookmark.html ]]; then bookmarks=( ${${(M)${(f)"$(<~/.w3m/bookmark.html)"}:#
  • *}/(#b)
  • */$match[1]} ) fi if [[ -s ~/.w3m/history ]]; then w3mhistory=( ${(f)"$(<~/.w3m/history)"} ) fi _alternative \ 'files:file:_files -g "*.x#html(-.)"' \ 'urls:URL:_urls' \ 'bookmarks:bookmarks:compadd -a bookmarks' \ 'history:history:compadd -a w3mhistory' && ret=0 ;; option) local -a options options=( ${${(M)${(f)"$(_call_program options $words[1] -show-option 2>/dev/null)"}:# -o *}/(#b) -o (*)=[^ ]#[[:blank:]]##(*)/$match[1]:${match[2]:l}} ) if compset -P '*='; then _message -e values 'value' else compset -S '=*' || suf=( -S '=' ) _describe -t options 'option' options "$suf[@]" && ret=0 fi ;; pauth) if compset -P '*:'; then _message -e passwords 'password' else compset -S ':*' || suf=( -S ':' ) _users "$suf[@]" && ret=0 fi ;; esac return ret PK[1bgfunctions/_readnuW+A#compdef read local pflag # -p flag only relevant if we have a coprocess (:>&p) 2>/dev/null && pflag='(-q -s -u -z)-p[input is read from the coprocess]' _arguments -s -A "-*" -S \ '-r[raw mode]' \ '(-p -k -s -u -z)-q[read y or n character from terminal]' \ '(-q)-k+[specify number of characters to read]:: :_guard "[0-9]#" "number of characters"' \ '(-q -z)-t+[test if input is available before reading]:: :_guard "[0-9.]#" "timeout (seconds)"' \ '(-q)-d[specify delimiter to terminate input instead of newline]:delimiter' \ '(-q -s -u -p -t)-z[read entry from editor buffer stack]' \ '(-E)-e[input read is echoed and not assigned]' \ '(-e)-E[input read is echoed]' \ '(-q -z -p)-s[suppress terminal echoing]' \ '-A[first name is taken as an array]' \ '(-q -z -p)-u+[specify file descriptor to read from]:file descriptor:_file_descriptors' \ $pflag '1:varprompt:_vars -qS\?' '*:vars:_vars' PK[-^nnfunctions/_floppynuW+A#compdef dosread dosdel local expl _wanted floppyfiles expl 'file on floppy' compadd - ${$(dosdir)[1,-5]:l} PK[HHfunctions/_genericnuW+A#autoload if [[ -n $ZSH_TRACE_GENERIC_WIDGET ]]; then local widget=$ZSH_TRACE_GENERIC_WIDGET unset ZSH_TRACE_GENERIC_WIDGET $widget _generic return fi local curcontext="${curcontext:-}" if [[ -z "$curcontext" ]]; then curcontext="${WIDGET}:::" else curcontext="${WIDGET}:${curcontext#*:}" fi _main_complete "$@" PK[weEfunctions/_cygchecknuW+A#compdef cygcheck cygcheck.exe # cygwin 1.5.25 local curcontext="$curcontext" state line expl typeset -A opt_args local -a exclusive_opts exclusive_opts=(-k --keycheck -f --find-package -l --list-package -p --package-query -h --help -V --version) _arguments -C -s -S \ "(* $exclusive_opts -c --check-setup)"{-c,--check-setup}'[show installed version of the specified package and verify integrity (or for all installed packages if none specified)]:*:package:->package' \ "(* $exclusive_opts -d --dump-only)"{-d,--dump-only}'[just list packages, do not verify (with -c)]' \ "(* $exclusive_opts -s --sysinfo)"{-s,--sysinfo}'[produce diagnostic system information (implies -c -d)]' \ "(* $exclusive_opts -r --registry)"{-r,--registry}'[also scan registry for Cygwin settings (with -s)]' \ '(* -)'{-k,--keycheck}'[perform a keyboard check session (must be run from a plain console only, not from a pty/rxvt/xterm)]' \ '(* -)'{-f,--find-package}'[find the package that specified file belongs to]:*:file:_files' \ '(* -)'{-l,--list-package}'[list contents of the specified package (or all packages if none given)]:*:package:->package' \ '(* -)'{-p,--package-query}'[search for the specified regexp in the entire cygwin.com package repository (requires internet connectivity)]:regexp:' \ '(-V --version -k --keycheck -f --find-package -l --list-package -p --package-query -c --check-setup -d --dump-only -v --verbose)'{-v,--verbose}'[produce more verbose output]' \ '(-V --version -k --keycheck -f --find-package -l --list-package -p --package-query -c --check-setup -d --dump-only -h --help)'{-h,--help}'[annotate output with explanatory comments when given with another command, otherwise print this help]' \ '(* -)'{-V,--version}'[print the version of cygcheck and exit]' \ '(-)*:program: _command_names -e' && return if [[ "$state" = package ]]; then local -a packages packages=( ${${${(f)"$(_call_program packages $words[1] -c -d)"}[3,-1]}%% *} ) _wanted packages expl package compadd -a packages && return fi return 1 PK[I00functions/_uzblnuW+A#compdef uzbl uzbl-browser uzbl-tabbed _arguments \ '(-u --uri)'{-u,--uri=}':uri to load:_urls' \ '(-v --verbose)'{-v,--verbose}'[verbose]' \ '(-n --name)'{-n,--name=}':instance name' \ '(-c --config)'{-c,--config=}':config file:_files' \ '--display=:X display:_x_display' \ '--help[help]' PK[߹`NNfunctions/run-help-p4nuW+Aif (( ! $# )); then p4 help commands else p4 help $1 fi | ${=PAGER:-less} PK[7(\++functions/_rpmnuW+A#compdef rpm # This uses `_arguments' in a state-machine kind of way. These states # have names and before executing the default action for such a state # we try to call a function with the name `_rpm_'. If such a # function exists, we return with its return status immediately. This # allows users to override the default completions by simply defining # these functions. # The states (and possible values for the `' above) are: # # query # complete for `rpm -q' query # verify # complete for `rpm --verify' # install # complete for `rpm -i' or `rpm --install' # upgrade # complete for `rpm -U' or `rpm --upgrade' # uninstall # complete for `rpm -e' or `rpm --erase' # build_b # complete for `rpm -bx' (the stage `x' is already completed) # build_t # complete for `rpm -tx' (the stage `x' is already completed) # sigcheck # complete for `rpm --sigcheck' # rebuild # complete for `rpm --rebuild' # package # complete a RPM package name # package_file # complete a RPM package file name # package_or_file # the previous two together # tags # complete a tag name # capability # complete a capability # relocate # complete a `old=new' pair of paths _rpm () { local curcontext="$curcontext" state lstate line nm="$compstate[nmatches]" typeset -A opt_args local ret=1 local -a tmp expl commonopts selectopts commonopts=( '(-v --verbose)--quiet[print as little as possible]' '(--quiet)*'{-v,--verbose}'[verbose output]' '--rcfile:resource file:_files' '--ftpproxy:ftp proxy server:_hosts' '--ftpport:ftp port number' '--httpproxy:http proxy server:_hosts' '--httpport:http port number' {-\?,--help}'[print help information]' '--version[print version number]' '--pipe:pipe command:->command' \ ) # package selection options of which only one can be used selectopts=( {-a,--all}'[query all packages]' {-f,--file}'[query packages that own specified files]' {-p,--package}'[query uninstalled packages]' {-g,--group}'[query packages in one of specified groups]' --fileid --hdrid --pkgid --tid --querybynumber '--triggeredby' '--whatprovides' '--whatrequires' ) sopts=${selectopts%\[*}\ --specfile selectopts=( "(* $sopts)"${selectopts[1,2]} "($sopts)"${selectopts[3,-1]} '(-a --all)*: :->package-select' ) pathopts=( '--root:rpm root directory:_files -/' '--dbpath:rpm database path:_files -/' ) _arguments -C -s \ "${commonopts[@]}" \ {-q+,--query}'[query mode]:*:query:->query' \ '(-V -y --verify)'{-V+,-y+,--verify}'[verify mode]:*:verify:->verify' \ '--import:*:public key' \ '(-K --checksig)'{-K,--checksig}'[signature check mode]:*:sigcheck:->sigcheck' \ '(-i --install)'{-i+,--install}'[install mode]:*:install:->install' \ '(-U --upgrade)'{-U+,--upgrade}'[upgrade mode]:*:upgrade:->upgrade' \ '(-F --freshen)'{-F+,--freshen}'[freshen mode]:*:upgrade:->upgrade' \ '(-e --erase)'{-e+,--erase}'[uninstall mode]:*:uninstall:->uninstall' \ --{initdb,querytags,showrc} \ '--rebuilddb:*:rebuild:->rebuild' \ --{resign,addsign}':*:package:->package_file' \ '--setperms[set file permissions]:*:package:->setattrs' \ '--setugids[set file owner/group]:*:package:->setattrs' \ '-b+[build mode (spec file)]:build stage:((p\:execute\ \%prep\ stage l\:do\ a\ list\ check c\:execute\ build\ stage i\:execute\ install\ stage b\:build\ a\ binary\ package a\:build\ binary\ and\ source\ packages)):*:build:->build_b' \ '(-b)-t+[build mode (tar file)]:build stage:((p\:execute\ \%prep\ stage l\:do\ a\ list\ check c\:execute\ build\ stage i\:execute\ install\ stage b\:build\ a\ binary\ package a\:build\ binary\ and\ source\ packages)):*:build:->build_t' \ '--rmsource:*:spec file:->spec_files' \ --{rebuild,recompile}':*:source rpm file:->package_src' \ '--eval:macro:->macros' && ret=0 # As long as we have a state name... while [[ -n "$state" ]]; do # First try to call a user-defined function. _call_function ret _rpm_$state && return ret # Copy the state and reset `state', to simplify the test above. lstate="$state" state='' tmp=() # Dispatch... case "$lstate" in query) # --dump requires one of -{l,c,d} # --triggers requires --script _arguments -s \ \!{-q,--query} "${commonopts[@]}" "${selectopts[@]}" "${pathopts[@]}" \ "($sopts)--specfile[query specified spec file as if it were a package]" \ '(-i --info)'{-i,--info}'[display package information]' \ '--changelog[display change log]' \ '(-s --state -l --list --filesbypkg)'{-l,--list}'[display package file list]' \ '(-s --state -l --list --filesbypkg)'{-s,--state}'[show file states]' \ '(-s --state -l --list)--filesbypkg[list files with package names]' \ {-d,--docfiles}'[documentation files only]' \ {-c,--configfiles}'[configuration files only]' \ '--dump[show all information]' \ '--provides[show capabilities provided]' \ \*--{qf,queryformat}'[specify format for package information]:rpm query format:->tags' \ -{R,-requires}'[list dependencies]' \ '--scripts[show (un)install scripts]' \ {--triggers,--triggerscripts}'[show trigger scripts]' && ret=0 ;; setattrs) _arguments -s --set{perm,ugids} "${selectopts[@]}" && ret = 0 ;; verify) _arguments -s \!-{y,V} \ "${commonopts[@]}" "${selectopts[@]}" "${pathopts[@]}" \ --no{deps,files,scripts,digest,signature,linkto,md5,size,user,group,mtime,mode,rdev} && ret=0 ;; upgrade) tmp=( '(--force)--oldpackage' ) ;& install) _arguments -s \!-{i,U} "$tmp[@]" \ "${commonopts[@]}" "${pathopts[@]}" \ '--excludepath:file to exclude:_files -/' \ '--relocate:relocate:->relocate' \ '--prefix:package prefix directory:_files -/' \ '(-h --hash)'{-h,--hash} \ '(--replacepkgs --replacefiles --oldpackage)--force' \ '(--force)--'{replacefiles,replacepkgs} \ --{aid,allfiles,badreloc,excludedocs,ignorearch,ignoreos,ignoresize,includedocs,justdb,percent,repackage,test} \ --no{digest,signature,deps,suggest,order,pre,post,preun,postun,trigger{s,in,un,postun}} \ '(--nopre --nopost --nopreun --nopostun)--noscripts' \ '*:pkg file:->package_file' && ret=0 ;; uninstall) _arguments -s \!-e \ "${commonopts[@]}" "${pathopts[@]}" \ --{allmatches,justdb,repackage,test} \ --no{deps,scripts,preun,postun,trigger{s,un,postun}} \ '*:package:->package' && ret=0 ;; build_b) tmp=( '*:spec file:_files -g "*.spec(-.)"' ) ;& build_t) (( $#tmp )) || tmp=( '*:tar file:_files -g "*.(#i)tar(.*|)(-.)"' ) _arguments -s \ "${commonopts[@]}" "${pathopts[@]}" \ --{short-circuit,clean,nobuild,rmsource,sign,test} \ '--target:specify a build target:->target'\ '--buildroot:build root directory:_files -/' \ '--buildarch:architecture for which to build:->target' \ '--buildos:operating system for which to build:' \ '--timecheck:time check (seconds):' "$tmp[1]" && ret=0 ;; sigcheck) _arguments -s \!-K \ "${commonopts[@]}" \ --no{gpg,pgp,md5,signature,digest} \ '*:package file:->package_file' && ret=0 ;; rebuild) _arguments -s \ "${commonopts[@]}" "${pathopts[@]}" \ '*:source package file:->package_file' && ret=0 ;; package-select) case "${opt_args[(i)${sopts// /|}]}" in -f|--file) _files ;; -p|--package) state=package_file ;; -g|--group) state=groups ;; --fileid|--pkgid) _message -e md5 md5 ;; --hdrid) _message -e sha1 sha1 ;; --querybynumber) _message -e value number ;; --what*) state=capabilities ;; --specfile) state=spec_files ;; *) state=package ;; esac ;; macros) local -a macros local mfile for mfile in {/usr/lib/rpm/{,redhat/}macros,/etc/rpm/macros,~/.rpmmacros}(N); do macros+=( ${${(M)${(f)"$(<$mfile)"}:#%[^\{]*}%%[[:blank:]]*} ) done if zstyle -t ":completion:${curcontext}:macros" prefix-hidden; then macros=( ${macros#%} ) _wanted macros expl macro compadd -p '%' -a - macros else _wanted macros expl macro compadd -a - macros fi ;; command) compset -q _normal ;; target) _wanted targets expl 'target platform' compadd \ ${${(M)${(f)"$(_call_programs targets rpm --showrc)"}:#compatible archs*}##*: } && ret=0 ;; groups) if ( (( ! $+_rpm_groups )) || _cache_invalid rpm-groups ) && ! _retrieve_cache rpm-groups then typeset -gaU _rpm_groups _rpm_groups=( ${(f)"$(_call_program groups rpm -qa --queryformat '%\{group}\\n' 2>/dev/null)"} ) _store_cache RPM-groups _rpm_groups fi _wanted groups expl 'group' _multi_parts / _rpm_groups && ret=0 ;; package_or_file) state=package_file ;; package) if ( [[ ${+_rpms} -eq 0 ]] || _cache_invalid RPMs ) && ! _retrieve_cache RPMs; then _rpms=( $(_call_program packages rpm -qa 2>/dev/null) ) _store_cache RPMs _rpms fi _wanted packages expl 'package' \ compadd -M 'r:|-=* r:|=*' - "$_rpms[@]" && ret=0 ;; spec_files) _wanted specfiles expl 'spec file' \ _files -g '*.spec(-.)' && ret=0 ;; package_file) _wanted files expl 'package file' \ _files -g '*.(#i)rpm(-.)' && ret=0 if [[ -prefix 1 (f|ht)tp:// ]]; then _wanted urls expl 'URL of rpm package file' \ _urls -f -g '*.(#i)rpm(-.)' "${expl[@]}" && ret=0 else _wanted urls expl 'URL of rpm package file' \ compadd -S '' "${expl[@]}" ftp:// http:// && ret=0 fi ;; package_src) _files -g '(#i)*.src.rpm(-.)' && ret=0 ;; tags) local -a suf if compset -P "*%*${${QIPREFIX:+{}:-\{}"; then compset -S '(|\\)}*' || suf=( -qS ${${QIPREFIX:+\}}:-\\\}} ) _wanted tags expl 'rpm tag' compadd -M 'm:{a-z}={A-Z}' "$suf[@]" - \ "${(L@)${(@f)$(_call_program tags rpm --querytags 2>/dev/null)}#RPMTAG_}" && ret=0 else _message -e formats 'rpm query format' fi ;; capabilities) _wanted capabilities expl capability compadd \ ${(f)"$(_call_program capabilities rpm -qa --queryformat '%\{requirename}\\n' 2>/dev/null)"} ;; relocate) if compset -P '*='; then _description directories expl 'new path' else _description directories expl 'old path' fi _files "$expl[@]" -/ && ret=0 ;; esac [[ ret -eq 0 || $nm -ne $compstate[nmatches] ]] && return 0 done return ret } # set a sensible default caching policy local update_policy zstyle -s ":completion:*:*:rpm:*" cache-policy update_policy if [[ -z "$update_policy" ]]; then zstyle ":completion:*:*:rpm:*" cache-policy _rpms_caching_policy fi _rpms_caching_policy () { # rebuild if cache is more than a week old local -a oldp oldp=( "$1"(mw+1) ) (( $#oldp )) && return 0 pkg_indices=( /var/lib/rpm/{packages.rpm,Packages}(N) ) for pkg_index in $pkg_indices; do [[ "$pkg_index" -nt "$1" ]] && return 0 done } _rpm "$@" PK[➵functions/_pick_variantnuW+A#autoload local output cmd pat local -a var local -A opts (( $+_cmd_variant )) || typeset -gA _cmd_variant zparseopts -D -A opts c: r: : ${opts[-c]:=$words[1]} while [[ $1 = *=* ]]; do var+=( "${1%%\=*}" "${1#*=}" ) shift done if (( $+_cmd_variant[$opts[-c]] )); then (( $+opts[-r] )) && eval "${opts[-r]}=${_cmd_variant[$opts[-c]]}" [[ $_cmd_variant[$opts[-c]] = "$1" ]] && return 1 return 0 fi output="$(_call_program variant $opts[-c] "${@[2,-1]}" &1)" for cmd pat in "$var[@]"; do if [[ $output = *$~pat* ]]; then (( $+opts[-r] )) && eval "${opts[-r]}=$cmd" _cmd_variant[$opts[-c]]="$cmd" return 0 fi done (( $+opts[-r] )) && eval "${opts[-r]}=$1" _cmd_variant[$opts[-c]]="$1" return 1 PK[Mfunctions/_groupsnuW+A#compdef newgrp groupdel local expl groups tmp _tags groups || return 1 if ! zstyle -a ":completion:${curcontext}:" groups groups; then (( $+_cache_groups )) || if [[ $OSTYPE = darwin* ]]; then if (( ${+commands[lookupd]} )); then : ${(A)_cache_groups:=${${(M)${(f)"$(_call_program groups lookupd -q group)"}:#name*}##*: }} elif (( ${+commands[dscacheutil]} )); then : ${(A)_cache_groups:=${${(M)${(f)"$(_call_program groups dscacheutil -q group)"}:#name*}##*: }} fi elif (( ${+commands[getent]} )); then : ${(A)_cache_groups:=${${(s: :)$(_call_program groups getent group 2>/dev/null)}%%:*}} else : ${(A)_cache_groups:=${${${(s: :)$(/dev/null); then _cache_groups+=( ${${(f)tmp}%%:*} ) # If you use YP fi fi groups=( "$_cache_groups[@]" ) fi _wanted groups expl group compadd -a "$@" - groups PK[(bsssfunctions/_mkzshnuW+A#compdef mkzsh mkzsh.exe _arguments -s -S \ '(--allusers -A)'{-A,--allusers}'[creates item for All Users instead of just current user]' \ '(--desktop -D)'{-D,--desktop}'[creates a Desktop icon for running /zsh.bat]' \ '(--smprograms -P)'{-P,--smprograms}'[creates a Program menu item for running /zsh.bat]' \ '(--help -h)'{-h,--help}'[display help information]' PK[ffunctions/prompt_redhat_setupnuW+A# Converted to zsh prompt theme by bash2zshprompt, written by # Red Hat Default Prompt # Styled like the default prompt in Red Hat 5.1 # prompt_redhat_setup () { PS1="[%n@%m %1~]\\$ " PS2="> " prompt_opts=( cr percent ) } prompt_redhat_setup "$@" PK[_Qfunctions/_locatenuW+A#compdef locate mlocate slocate # Decide if we are using mlocate or slocate. local ltype basename=${words[1]:t} input # If we can't, use this guess. local best_guess=mlocate case $basename in ([ms]locate) ltype=$basename ;; (locate) input="$(_call_program locate $words[1] -V 2>&1)" case $input in (*mlocate*) ltype=mlocate ;; (*(#i)secure locate*) ltype=slocate ;; (*(#i)gnu locate*|*findutils*gnu*) ltype=gnu ;; (*illegal option*) if [[ $OSTYPE == (freebsd|openbsd|dragonfly|darwin)* ]]; then ltype=bsd else ltype=$best_guess fi ;; # guess (*) ltype=$best_guess ;; esac ;; (*) # too dangerous to run: guess ltype=$best_guess esac case $ltype in (mlocate) # actually, -d can take a colon-separate list # -r/--regexp mean no normal arguments, so shouldn't complete # -m and --mmap are ignored, so don't bother # -s and --stdio likewise _arguments -s -S : \ {-b,--basename}'[match only the basename of files in the database]' \ {-c,--count}'[output the number of matching entries]' \ {-d,--database=}'[use alternative database]:database:_files' \ {-e,--existing}'[restrict display to existing files]' \ {-L,--follow}'[follow symbolic links to find existing files (default)]' \ {-h,--help}'[show help]' \ {-i,--ignore-case}'[ignore case distinctions in patterns]' \ {-l,-n,--limit=}'[limit search results]:file limit: ' \ {-P,-H,--nofollow}'[don'\''t follow symbolic links]' \ {-0,--null}'[output separated by NUL characters]' \ {-S,--statistics}'[show database statistics]' \ {-q,--quiet}'[don'\''t report errors]' \ {-r,--regexp=}'[search for given basic regexp]:basic regexp: ' \ --regex'[patterns are extended regexps]' \ {-V,--version}'[show version]' \ {-w,--wholename}'[match entire file path (default)]' \ '*:pattern: ' ;; (slocate) # -d can take path # -e can take a comma-separated list of directories. # -f should complete list of file system types like mount _arguments -s -S : \ -u'[create slocate database starting at path /]' \ -U'[create slocate database starting at given path]:directory:_files -/' \ -c'[parse GNU locate updatedb with -u, -U]' \ -e'[exclude directories with -u, -U]:directories:_files -/' \ -f'[exclude file system types from db with -u, -U]:file system:_file_systems' \ -l'[security level]:level:(0 1)' \ -q'[quiet mode]' \ -n'[limit search results]:file limit: ' \ -i'[case insensitive search]' \ {-r,--regexp=}'[use basic regular expression]:regexp: ' \ {-o,--output=}'[specify database to create]:database:_files' \ {-d,--database=}'[specify database to search]:database:_files' \ {-h,--help}'[display help]' \ {-v,--verbose}'[display files when creating database]' \ {-V,--version}'[display version]' \ '*:pattern: ' ;; (gnu) _arguments -s : \ {-d,--database=}'[use alternative database]:database:_files' \ {-e,--existing}'[restrict display to existing files]' \ {-E,--non-existing}'[allow display of nonexistent files (default)]' \ {-i,--ignore-case}'[ignore case distinctions in patterns]' \ {-w,--wholename}'[match entire file path (default)]' \ {-b,--basename}'[match only the basename of files in the database]' \ {-l,-n,--limit=}'[limit search results]:file limit: ' \ {-S,--statistics}'[show database statistics]' \ {-0,--null}'[output separated by NUL characters]' \ {-c,--count}'[output the number of matching entries]' \ {-P,-H,--nofollow}'[don'\''t follow symbolic links]' \ {-L,--follow}'[follow symbolic links to find existing files (default)]' \ {-A,-all}'[match all arguments instead of at least one]' \ {-p,--print}'[include search results with statistics or count]' \ {-r,--regex=}'[patterns are regular expressions]:basic regexp: ' \ --regextype='[select type of regular expression]' \ {-V,--version}'[show version]' \ --help'[show help]' \ '*:pattern: ' ;; (bsd) _arguments -s -S -A '-*' \ '(-S)-0[separate file names by NUL characters]' \ '(- *)-S[show database statistics and exit]' \ '(-S)-c[output the number of matching file names]' \ '(-S)*-d[specify database to search]:database:_files' \ '(-S)-i[ignore case distinctions in pattern and database]' \ '(-S)-l[limit output to specified number of file names]:file limit: ' \ '(-S)-m[use mmap(2) instead of stdio(3) (default)]' \ '(-S)-s[use stdio(3) instead of mmap(2)]' \ '*:pattern: ' ;; esac PK[YDN N functions/_aapnuW+A#compdef aap # A-A-P recipe executive version 1.076; released 2005 May 30 12:47:03 GMT local curcontext="$curcontext" state line ret=1 typeset -A opt_args _arguments -C -s -S \ '(- *)'{-V,--version}'[print version information and exit]' \ '(- *)'{-h,--help}'[print help information and exit]' \ '(-s --silent -v --verbose)'{-v,--verbose}'[print more information]' \ '(-v --verbose -s --silent)'{-s,--silent}'[print less information]' \ '(-d --debug)'{-d,--debug=}'[debug the specified items]:flags:' \ '--profile=[profile A-A-P execution and write results in specified file]:output file:_files' \ '(-n --nobuild)'{-n,--nobuild}'[print the build commands but do not execute them]' \ '--changed=[consider specified file changed]:changed file:_files' \ '(-t --touch)'{-t,--touch}'[update target signatures, do not build]' \ '(-F --force)'{-F,--force}'[force rebuilding]' \ '(-C --contents)'{-C,--contents}'[only build when file contents changed]' \ \*{-c,--command=}'[execute a command after reading the recipe]:aap command:' \ '(-k --continue)'{-k,--continue}'[continue building after an error]' \ '(-S --stop)'{-S,--stop}'[stop building at first error (default)]' \ '(-N,--nofetch-recipe -R --fetch-recipe)'{-R,--fetch-recipe}'[fetch recipe file and child recipes]' \ '(-R --fetch-recipe -N --nofetch-recipe)'{-N,--nofetch-recipe}'[do not fetch recipes for "fetch" target]' \ '(-a --nocache)'{-a,--nocache}"[always download files, don't use the cache]" \ '(-l --local)'{-l,--local}'[do not recurse into subdirectories]' \ '(-j --jobs)'{-j,--jobs=}'[maximum number of parallel jobs]:number of jobs:' \ '(-f --recipe -u --search-up --up)'{-u,--search-up,--up}'[search directory tree upwards for main.aap recipe]' \ \*{-I,--include=}'[directory to search for included recipes]:include directory:_files -/' \ '(-u --search-up --up -f --recipe)'{-f,--recipe=}'[recipe file to be executed]:recipe file:_files -g \*.aap\(-.\)' \ '--install=[install specified package]:package name:' \ '--[end of options, targets and assignments follow]' \ '*:aap target:->target' && ret=0 if [[ "$state" = target ]]; then local targets recipe if [[ -n $opt_args[(I)(-u|--search-up|--up)] ]]; then recipe=( (../)#main.aap(N[-1]) ) else recipe=${(v)opt_args[(I)(-f|--recipe)]:-main.aap} fi if [[ -f $recipe ]]; then targets=( ${${(f)"$(_call_program targets $words[1] -f $recipe comment 2>/dev/null)"}/(#b)target (*):[[:blank:]]##(*)/$match[1]:${match[2]:l}} comment ) _describe -t targets 'aap target' targets && ret=0 else _message -e targets 'aap target' fi fi return ret PK[Dw@functions/_compressnuW+A#compdef compress uncompress -redirect-,<,uncompress=uncompress -redirect-,>,compress=uncompress -redirect-,<,compress=compress local expl state line bits common_args1 common_args2 decompress ret=1 local curcontext="$curcontext" typeset -A opt_args bits=( {9..16} ) common_args1=( \ '-n[omit compressed file header from compressed file]' \ '-V[display current version and compile options]' \ '*:files:->files') common_args2=( \ '-c[write on standard output]' \ '(-F)-f[force overwrite]' \ '(-f)-F[force overwrite]' \ '(-v)-q[suppress display of compression statistics]' \ '(-q)-v[display compression statistics]' \ "${common_args1[@]}" ) case "$service" in compress) _arguments -C -s \ "-b[specify maximum number of bits used to replace common substring]:bits:(${bits[*]})" \ '-C[produce output compatible with BSD 2.0]' \ '(-b -C)-d[decompress]' \ "${common_args2[@]}" && ret=0 ;; uncompress) _arguments -C -s "${common_args2[@]}" && ret=0 decompress=yes ;; zcat) _arguments -C -s "${common_args1[@]}" && ret=0 decompress=yes ;; esac if [[ "$state" = files ]]; then if [[ -z "$decompress" ]] || (( $+opt_args[-d] )); then _description files expl 'file to compress' _files "$expl[@]" -g '^*.Z(-.)' && return else _description files expl 'compressed file' _files "$expl[@]" -g '*.Z(-.)' && return fi fi return ret PK[$functions/compdumpnuW+A# This is a function to dump the definitions for new-style # completion defined by 'compinit' in the same directory. The output # should be directed into the "compinit.dump" in the same directory as # compinit. If you rename init, just stick .dump onto the end of whatever # you have called it and put it in the same directory. This is handled # automatically if you invoke compinit with the option -d. # # You will need to update the dump every time you add a new completion. # To do this, simply remove the .dump file, start a new shell, and # create the .dump file as before. Again, compinit -d handles this # automatically. # Print the number of files used for completion. This is used in compinit # to see if auto-dump should re-dump the dump-file. emulate -L zsh setopt extendedglob noshglob typeset _d_file _d_f _d_bks _d_line _d_als _d_files _d_name _d_tmp _d_file=${_comp_dumpfile-${0:h}/compinit.dump}.$HOST.$$ [[ $_d_file = //* ]] && _d_file=${_d_file[2,-1]} [[ -w ${_d_file:h} ]] || return 1 _d_files=( ${^~fpath:/.}/^([^_]*|*~|*.zwc)(N) ) if [[ -n "$_comp_secure" ]]; then _d_wdirs=( ${^fpath}(Nf:g+w:,f:o+w:,^u0u${EUID}) ) _d_wfiles=( ${^~fpath:/.}/^([^_]*|*~|*.zwc)(N^u0u${EUID}) ) (( $#_d_wfiles )) && _d_files=( "${(@)_d_files:#(${(j:|:)_d_wfiles})}" ) (( $#_d_wdirs )) && _d_files=( "${(@)_d_files:#(${(j:|:)_d_wdirs})/*}" ) fi print "#files: $#_d_files\tversion: $ZSH_VERSION" > $_d_file # Dump the arrays _comps, _services and _patcomps. The quoting # hieroglyphics ensure that a single quote inside a variable is itself # correctly quoted. print "\n_comps=(" >> $_d_file for _d_f in ${(ok)_comps}; do print -r - "${(qq)_d_f}" "${(qq)_comps[$_d_f]}" done >> $_d_file print ")" >> $_d_file print "\n_services=(" >> $_d_file for _d_f in ${(ok)_services}; do print -r - "${(qq)_d_f}" "${(qq)_services[$_d_f]}" done >> $_d_file print ")" >> $_d_file print "\n_patcomps=(" >> $_d_file for _d_f in ${(ok)_patcomps}; do print -r - "${(qq)_d_f}" "${(qq)_patcomps[$_d_f]}" done >> $_d_file print ")" >> $_d_file _d_tmp="_postpatcomps" print "\n_postpatcomps=(" >> $_d_file for _d_f in ${(ok)_postpatcomps}; do print -r - "${(qq)_d_f}" "${(qq)_postpatcomps[$_d_f]}" done >> $_d_file print ")" >> $_d_file print "\n_compautos=(" >> $_d_file for _d_f in "${(ok@)_compautos}"; do print -r - "${(qq)_d_f}" "${(qq)_compautos[$_d_f]}" done >> $_d_file print ")" >> $_d_file print >> $_d_file # Now dump the key bindings. We dump all bindings for zle widgets # whose names start with a underscore. # We need both the zle -C's and the bindkey's to recreate. # We can ignore any zle -C which rebinds a standard widget (second # argument to zle does not begin with a `_'). _d_bks=() typeset _d_complist= zle -lL | while read -rA _d_line; do if [[ ${_d_line[3]} = _* && ${_d_line[5]} = _* ]]; then if [[ -z "$_d_complist" && ${_d_line[4]} = .menu-select ]]; then print 'zmodload -i zsh/complist' _d_complist=yes fi print -r - ${_d_line} _d_bks+=(${_d_line[3]}) fi done >> $_d_file bindkey | while read -rA _d_line; do if [[ ${_d_line[2]} = (${(j.|.)~_d_bks}) ]]; then print -r "bindkey '${_d_line[1][2,-2]}' ${_d_line[2]}" fi done >> $_d_file print >> $_d_file # Autoloads: look for all functions beginning with `_'. _d_als=(${(o)$(typeset +fm '_*')}) # print them out: about five to a line looks neat integer _i=5 print -n autoload -Uz >> $_d_file while (( $#_d_als )); do if (( ! $+_compautos[$_d_als[1]] )); then print -n " $_d_als[1]" if (( ! --_i && $#_d_als > 1 )); then _i=5 print -n ' \\\n ' fi fi shift _d_als done >> $_d_file print >> $_d_file local _c for _c in "${(ok@)_compautos}"; do print "autoload -Uz $_compautos[$_c] $_c" >> $_d_file done print >> $_d_file print "typeset -gUa _comp_assocs" >> $_d_file print "_comp_assocs=( ${(qq)_comp_assocs} )" >> $_d_file mv -f $_d_file ${_d_file%.$HOST.$$} unfunction compdump autoload -Uz compdump PK[;>+ functions/zfcputnuW+A# function zfcput { # Continuation put of files from remote server. # For each file, if it's shorter over there, put the remainder from # over here. This uses append, which is standard, so unlike zfcget it's # expected to work on any reasonable server... err, as long as it # supports SIZE and MDTM. (It could be enhanced so you can enter the # size so far by hand.) You should probably be in binary transfer # mode, thought it's not enforced. # # To read from midway through a local file, `tail +c' is used. # It would be nice to find a way of doing this which works on all OS's. emulate -L zsh [[ $curcontext = :zf* ]] || local curcontext=:zfcput local loc rem stat=0 locst remst offs tailtype local tmpfile=${TMPPREFIX}zfcget$$ rstat # find how tail works. this is intensely annoying, since it's completely # standard in C. od's no use, since we can only skip whole blocks. if [[ $(echo abcd | tail +2c) = bcd ]]; then tailtype=c elif [[ $(echo abcd | tail --bytes=+2) = bcd ]]; then tailtype=b else print "I can't get your \`tail' to start from from arbitrary characters.\n" \ "If you know how to do this, let me know." 2>&1 return 1 fi for loc in $*; do # zfcd directory hack to put the front back to ~ rem=$loc if [[ $rem = $HOME || $rem = $HOME/* ]]; then rem="~${rem#$HOME}" fi if [[ ! -r $loc ]]; then print "Can't read file $loc" stat=1 else # Compare the sizes. locst=($(zftp local $loc)) zftp remote $rem >$tmpfile rstat=$? remst=($(<$tmpfile)) rm -f $tmpfile if [[ $rstat = 2 ]]; then print "Server does not support remote status commands.\n" \ "You will have to find out the size by hand and use zftp append." 2>&1 stat=1 continue elif [[ $rstat = 1 ]]; then # Not found, so just do a standard put. zftp put $rem <$loc elif [[ $remst[1] -gt $locst[1] ]]; then print "Remote file is larger!" 2>&1 continue; elif [[ $locst[1] == $remst[1] ]]; then print "Files are already the same size." 2>&1 continue else # tail +c takes the count of the character # to start from, not the offset from zero. if we did # this with years, then 2000 would be 1999. no y2k bug! # brilliant. (( offs = $remst[1] + 1 )) if [[ $tailtype = c ]]; then tail +${offs}c $loc | zftp append $rem || stat=1 else tail --bytes=+$offs $loc | zftp append $rem || stat=1 fi fi fi done return $stat # } PK[K@functions/calendar_sortnuW+Aemulate -L zsh setopt extendedglob autoload -Uz calendar_{read,scandate,lockfiles} local calendar line REPLY new lockfile local -a calendar_entries local -a times lines_sorted lines_unsorted lines_failed lockfiles integer i # Read the calendar file from the calendar-file style zstyle -s ':datetime:calendar:' calendar-file calendar || calendar=~/calendar # start of subshell for OS file locking ( # start of block for following always to clear up lockfiles. # Not needed but harmless if OS file locking is used. { if zmodload -F zsh/system b:zsystem && zsystem supports flock && zsystem flock $calendar; then # locked OK : else calendar_lockfiles $calendar || exit 1 fi new=$calendar.new.$$ calendar_read $calendar if [[ ${#calendar_entries} -eq 0 || \ ( ${#calendar_entries} -eq 1 && -z $calendar_entries[1] ) ]]; then return 0 fi for line in $calendar_entries; do if calendar_scandate -a $line; then lines_unsorted+=("${(l.16..0.)REPLY}:$line") else lines_failed+=($line) fi done if (( ${#lines_unsorted} )); then lines_sorted=(${${(o)lines_unsorted}##[0-9]##:}) fi { for line in "${lines_failed[@]}"; do print "$line # BAD DATE" done (( ${#lines_sorted} )) && print -l "${lines_sorted[@]}" } > $new if [[ ! -s $new ]]; then print "Writing to $new failed." return 1 elif (( ${#lines_failed} )); then print "Warning: lines with date that couldn't be parsed. Output (with unparseable dates marked) left in $new" return 1 fi if ! mv $calendar $calendar.old; then print "Couldn't back-up $calendar to $calendar.old. New calendar left in $new" return 1 fi if ! mv $new $calendar; then print "Failed to rename $new to $calendar. Old calendar left in $calendar.old" return 1 fi print "Old calendar left in $calendar.old" } always { (( ${#lockfiles} )) && rm -rf $lockfiles } ) PK[!!functions/_ecasoundnuW+A#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 filters) _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' ;; teffects) _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' ;; emod) _values -S : 'envelopme modulation' \ 'b[pulse gate]: :->eemb' \ 'p[pulse gate (hz)]: :->eemp' \ 't[tremolo effect]: :->eemt' ;; esac case $state in b) _wanted -V sizes expl 'buffer size' compadd \ 1 2 4 8 16 32 64 128 256 512 1024 2048 4096 8192 16384 32768 65536 ;; f) if compset -P '*,*,*,'; then _values 'interleaving' \ 'i[interleaved stream format]' \ 'n[noninterleaved]' elif compset -P '*,*,'; then _message 'sampling rate' elif compset -P '*,'; then _message 'channels' else _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)]' fi ;; z) _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]' ;; io) 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` else _message 'ALSA information bot found in proc filesystem' fi else _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))' fi ;; pn) _wanted presets expl preset compadd \ ${${(M)${(f)"$(>functions/_tiffnuW+A#compdef -P (tiff*|*2tiff|pal2rgb) local pat expl ret=1 if [[ "$service" = *2tiff ]]; then pat="*.(#i)${service}(-.)" else pat='*.(#i)tiff(-.)' fi if [[ $# -ne 0 || $+_in_tiff -ne 0 ]]; then if (( ! $# )); then _description files expl 'picture file' set -- "$expl[@]" fi _wanted files expl 'picture file' _path_files "$@" -g "$pat" - || _files "$@" "$expl[@]" -g '*.(#i)tiff(-.)' return fi local _in_tiff=yes local curcontext="$curcontext" state line ret=1 typeset -A opt_args case "$service" in tiff2bw) _arguments -C \ '-c[specify compression scheme]:compression scheme:->compress' \ '-r[specify rows per strip]:rows per strip' \ '-R[specify percentage of red channel]:percentage of red channel' \ '-G[specify percentage of green channel]:percentage of green channel' \ '-B[specify percentage of blue channel]:percentage of blue channel' \ ':input file:_files -g "*.(#i)tif(|f)(-.)"' \ ':output file:_files -g "*.(#i)tif(|f)(-.)"' && ret=0 ;; tiff2ps) _arguments \ '-1[generate PostScript Level I output]' \ '-2[generate PostScript Level II output]' \ '-a[generate output for all IFDs]' \ '-d[set initial TIFF directory]:initial TIFF directory' \ '(-p)-e[generate Encapsulated PostScript]' \ '-o[set initial TIFF directory (file offset)]:file offset' \ '(-e)-p[generate non-Encapsulated PostScript]' \ '-h[set page height]:page height' \ '-w[set page width]:page width' \ '-8[disable use of ASCII85 encoding]' \ '-D[print two pages per sheet]' \ '-O[specify output file]:output file:_files -g "*.(#i)ps(-.)"' \ '-s[generate output for a single image]' \ '-T[print pages for top edge binding]' \ '*:input TIFF file:_files -g "*.(#i)tif(|f)(-.)"' && ret=0 ;; tiffcmp) _arguments \ '-l[list all differing bytes]' \ '-t[ignore differences in directories]' \ ':first input TIFF file:_files -g "*.(#i)tif(|f)(-.)"' \ ':second input TIFF file:_files -g "*.(#i)tif(|f)(-.)"' && ret=0 ;; tiffcp) _arguments -C \ '-B[write output in bin-endian byte order]' \ '-c[specify compression scheme]:compression scheme:->compress' \ '-o[set initial TIFF directory (file offset)]:file offset' \ '-p[set sample packing]:sample packing:(contig separate)' \ '(-t)-s[write output in strips]' \ '(-s)-t[write output in tiles]' \ '-i[ignore read errors]' \ '-r[specify rows per strip]:rows per strip' \ '-w[specify output tile width]:output tile width' \ '-l[specify output tile length]:output tile length' \ '-f[specify fill order]:fill order:(lsb2msb msb2lsb)' \ '*:input TIFF file:_files -g "*.(#i)tif(|f)(-.)"' && ret=0 ;; tiffdither) _arguments -C \ '-c[specify compression scheme]:compression scheme:->compress' \ '-f[specify fill order]:fill order:(lsb2msb msb2lsb)' \ '-r[specify rows per strip]:rows per strip' \ '-t[set threshold for dithering]:dither threshold value' \ ':input file:_files -g "*.(#i)tif(|f)(-.)"' \ ':output file:_files -g "*.(#i)tif(|f)(-.)"' && ret=0 ;; tiffdump) _arguments \ '-o[set initial TIFF directory (file offset)]:file offset:' \ '-h[print numbers in hexadecimal]' \ '*:input TIFF file:_files -g "*.(#i)tif(|f)(-.)"' && ret=0 ;; tiffinfo) _arguments \ '-c[display colormap and color/gray response curves]' \ '-D[read and decompress data]' \ '-d[print decompressed data]' \ '-j[display JPEG-related tags]' \ '-o[set initial TIFF directory (file offset)]:file offset' \ '-s[display offsets and byte counts for all data strips]' \ '-i[ignore read errors]' \ '-f[force fill order]:fill order:(lsb2msb msb2lsb)' \ '-w[display raw data in words]' \ '*:input TIFF file:_files -g "*.(#i)tif(|f)(-.)"' && ret=0 ;; tiffmedian) _arguments -C \ '-r[specify rows per strip]:rows per strip' \ '-C[specify number of colormap entries]:number of colormap entries' \ '-c[specify compression scheme]:compression scheme:->compress' \ '-f[use Floyd-Steinberg dithering]' \ ':input file:_files -g "*.(#i)tif(|f)(-.)"' \ ':output file:_files -g "*.(#i)tif(|f)(-.)"' && ret=0 ;; tiffsplit) _arguments \ ':input file:_files -g "*.(#i)tif(|f)(-.)"' \ ':output file prefix' && ret=0 ;; fax2tiff) _arguments \ '(-1 -4)-2[input is Group 3, 2d encoded]' \ '(-2 -4)-1[input is Group 3, 1d encoded]' \ '(-1 -2)-4[input is Group 4 encoded]' \ '(-W)-B[0 in input is black]' \ '(-B)-W[0 in input is white]' \ '(-M)-L[input is lsb-to-msb]' \ '(-L)-M[input is msb-to-lsb]' \ '-R[specify resolution]:resolution (lines per inch)' \ '-o[specify output file]:output file:_files -g "*.(#i)tif(|f)(-.)"' \ '(-f)-c[generate `classic'"'"' TIFF format]' \ '(-c)-f[generate TIFF Class F format]' \ '-m[output in msb-to-lsb order]' \ "-p[don't align EOL codes]" \ '-s[duplicate all rows]' \ '-v[verbose mode]' \ ':FAX input file:_files -g "*.(#i)(g[34]|fax)(-.)"' && ret=0 ;; gif2tiff) _arguments -C \ '-r[specify rows per strip]:rows per strip' \ '-c[specify compression scheme]:compression scheme:->compress' \ ':input GIF file:_files -g "*.(#i)gif(-.)"' \ ':output file:_files -g "*.(#i)tif(|f)(-.)"' && ret=0 ;; ppm2tiff) _arguments -C \ '-r[specify rows per strip]:rows per strip' \ '-c[specify compression scheme]:compression scheme:->compress' \ '-R[specify resolution]:resolution:' \ ':input GIF file:_files -g "*.(#i)ppm(-.)"' \ ':output file:_files -g "*.(#i)tif(|f)(-.)"' && ret=0 ;; ras2tiff) _arguments -C \ '-r[specify rows per strip]:rows per strip' \ '-c[specify compression scheme]:compression scheme:->compress' \ ':input raster image file:_files -g "*.(#i)ras(|t)(-.)"' \ ':output file:_files -g "*.(#i)tif(|f)(-.)"' && ret=0 ;; pal2rgb) _arguments -C \ '-C[specify number of bits for colormap entries]:bits for colormap entries:(8 16)' \ '-p[set sample packing]:sample packing:(contig separate)' \ '-c[specify compression scheme]:compression scheme:->compress' \ '-r[specify rows per strip]:rows per strip' \ ':input file:_files -g "*.(#i)tif(|f)(-.)"' \ ':output file:_files -g "*.(#i)tif(|f)(-.)"' && ret=0 ;; *) _description files expl 'picture file' _files "$expl[@]" -g "$pat" && ret=0 esac if [[ -n "$state" ]]; then if [[ "$PREFIX" = *:* ]]; then local scheme="${PREFIX%%:*}" compset -P 1 '*:' case "$scheme" in g3) _values -s : 'FAX Group 3 options' \ '(2d)1d[use 1D-encoding]' \ '(1d)2d[use 2D-encoding]' \ 'fill[byte-align EOL codes]' && ret=0 ;; jpeg) _message -e values "compression quality (0-100), or \`r' (output RGB)" ret=0 ;; lzw|zip) _values 'LZW and deflate options' \ '1[without differencing]' \ '2[with differencing]' && ret=0 ;; esac else _tags values while _tags; do while _next_label values expl 'compression scheme'; do compadd "$expl[@]" - none g4 packbits && ret=0 compadd "$expl[@]" -qS: - lzw zip jpeg g3 && ret=0 done (( ret )) || return 0 done fi fi return ret PK[Ubbfunctions/_makenuW+A#compdef make gmake pmake dmake # TODO: Based on targets given on the command line, show only variables that # are used in those targets and their dependencies. local prev="$words[CURRENT-1]" file expl tmp is_gnu dir incl match local -A TARGETS VARIABLES expandVars() { local open close var val front ret tmp=$1 front=${tmp%%\$*} case $tmp in (\(*) # Variable of the form $(foobar) open='(' close=')' ;; ({*) # ${foobar} open='{' close='}' ;; ([[:alpha:]]*) # $foobar. This is exactly $(f)oobar. open='' close='' var=${(s::)var[1]} ;; (\$*) # Escaped $. print -- "${front}\$$(expandVars ${tmp#\$})" return ;; (*) # Nothing left to substitute. print -- $tmp return ;; esac if [[ -n $open ]] then var=${tmp#$open} var=${var%%$close*} fi case $var in ([[:alnum:]_]#) val=${VARIABLES[$var]} ret=${ret//\$$open$var$close/$val} ;; (*) # Improper variable name. No replacement. # I'm not sure if this is desired behavior. front+="\$$open$var$close" ret=${ret/\$$open$var$close/} ;; esac print -- "${front}$(expandVars ${ret})" } parseMakefile () { local input var val target dep TAB=$'\t' dir=$1 tmp while read input do case "$input " in # VARIABLE = value ([[:alnum:]][[:alnum:]_]#[ $TAB]#=*) var=${input%%[ $TAB]#=*} val=${input#*=} val=${val##[ $TAB]#} VARIABLES[$var]=$val ;; # VARIABLE := value # Evaluated immediately ([[:alnum:]][[:alnum:]_]#[ $TAB]#:=*) var=${input%%[ $TAB]#:=*} val=${input#*=} val=${val##[ $TAB]#} val=$(expandVars $val) VARIABLES[$var]=$val ;; # TARGET: dependencies # TARGET1 TARGET2 TARGET3: dependencies ([[:alnum:]][^$TAB:=]#:[^=]*) input=$(expandVars $input) target=${input%%:*} dep=${input#*:} dep=${(z)dep} dep="$dep" for tmp in ${(z)target} do TARGETS[$tmp]=$dep done ;; # Include another makefile (${~incl} *) local f=${input##${~incl} ##} if [[ $incl == '.include' ]] then f=${f#[\"<]} f=${f%[\">]} fi f=$(expandVars $f) case $f in (/*) ;; (*) f=$dir/$f ;; esac if [[ -r $f ]] then parseMakefile ${f%%/[^/]##} < $f fi ;; esac done } findBasedir () { local file index basedir basedir=$PWD for (( index=0; index < $#@; index++ )) do if [[ $@[index] == -C ]] then file=${~@[index+1]}; if [[ -z $file ]] then # make returns with an error if an empty arg is given # even if the concatenated path is a valid directory return elif [[ $file == /* ]] then # Absolute path, replace base directory basedir=$file else # Relative, concatenate path basedir=$basedir/$file fi fi done print -- $basedir } _pick_variant -r is_gnu gnu=GNU unix -v -f if [[ $is_gnu == gnu ]] then incl="(-|)include" else incl=.include fi if [[ "$prev" == -[CI] ]] then _files -W ${(q)$(findBasedir ${words[1,CURRENT-1]})} -/ elif [[ "$prev" == -[foW] ]] then _files -W ${(q)$(findBasedir $words)} else file="$words[(I)-f]" if (( file )) then file=${~words[file+1]} [[ $file == [^/]* ]] && file=${(q)$(findBasedir $words)}/$file [[ -r $file ]] || file= else local basedir basedir=${(q)$(findBasedir $words)} if [[ $is_gnu == gnu && -r $basedir/GNUmakefile ]] then file=$basedir/GNUmakefile elif [[ -r $basedir/makefile ]] then file=$basedir/makefile elif [[ -r $basedir/Makefile ]] then file=$basedir/Makefile else file='' fi fi if [[ -n "$file" ]] then if [[ $is_gnu == gnu ]] && zstyle -t ":completion:${curcontext}:targets" call-command then parseMakefile $PWD < <(_call_program targets "$words[1]" -nsp --no-print-directory -f "$file" .PHONY 2> /dev/null) else case "$OSTYPE" in freebsd*) parseMakefile $PWD < <(_call_program targets "$words[1]" -nsp -f "$file" .PHONY 2> /dev/null) ;; *) parseMakefile $PWD < $file esac fi fi if [[ $PREFIX == *'='* ]] then # Complete make variable as if shell variable compstate[parameter]="${PREFIX%%\=*}" compset -P 1 '*=' _value "$@" else _tags targets variables while _tags do _requested targets expl 'make targets' \ compadd -- ${(k)TARGETS} _requested variables expl 'make variables' \ compadd -S '=' -- ${(k)VARIABLES} done fi fi PK[functions/VCS_INFO_get_data_gitnuW+A## vim:ft=zsh ## git support by: Frank Terbeck ## Distributed under the same BSD-ish license as zsh itself. setopt localoptions extendedglob NO_shwordsplit local gitdir gitbase gitbranch gitaction gitunstaged gitstaged gitsha1 local stgitpatch stgitunapplied local -xA hook_com VCS_INFO_git_getaction () { local gitaction='' gitdir=$1 local tmp for tmp in "${gitdir}/rebase-apply" \ "${gitdir}/rebase" \ "${gitdir}/../.dotest" ; do if [[ -d ${tmp} ]] ; then if [[ -f "${tmp}/rebasing" ]] ; then gitaction="rebase" elif [[ -f "${tmp}/applying" ]] ; then gitaction="am" else gitaction="am/rebase" fi printf '%s' ${gitaction} return 0 fi done for tmp in "${gitdir}/rebase-merge/interactive" \ "${gitdir}/.dotest-merge/interactive" ; do if [[ -f "${tmp}" ]] ; then printf '%s' "rebase-i" return 0 fi done for tmp in "${gitdir}/rebase-merge" \ "${gitdir}/.dotest-merge" ; do if [[ -d "${tmp}" ]] ; then printf '%s' "rebase-m" return 0 fi done if [[ -f "${gitdir}/MERGE_HEAD" ]] ; then printf '%s' "merge" return 0 fi if [[ -f "${gitdir}/BISECT_LOG" ]] ; then printf '%s' "bisect" return 0 fi return 1 } VCS_INFO_git_getbranch () { local gitbranch gitdir=$1 tmp actiondir local gitsymref="${vcs_comm[cmd]} symbolic-ref HEAD" actiondir='' for tmp in "${gitdir}/rebase-apply" \ "${gitdir}/rebase" \ "${gitdir}/../.dotest"; do if [[ -d ${tmp} ]]; then actiondir=${tmp} break fi done if [[ -n ${actiondir} ]]; then gitbranch="$(${(z)gitsymref} 2> /dev/null)" [[ -z ${gitbranch} ]] && [[ -r ${actiondir}/head-name ]] \ && gitbranch="$(< ${actiondir}/head-name)" elif [[ -f "${gitdir}/MERGE_HEAD" ]] ; then gitbranch="$(${(z)gitsymref} 2> /dev/null)" [[ -z ${gitbranch} ]] && gitbranch="$(< ${gitdir}/MERGE_HEAD)" elif [[ -d "${gitdir}/rebase-merge" ]] ; then gitbranch="$(< ${gitdir}/rebase-merge/head-name)" elif [[ -d "${gitdir}/.dotest-merge" ]] ; then gitbranch="$(< ${gitdir}/.dotest-merge/head-name)" else gitbranch="$(${(z)gitsymref} 2> /dev/null)" if [[ $? -ne 0 ]] ; then gitbranch="refs/tags/$(${vcs_comm[cmd]} describe --exact-match HEAD 2>/dev/null)" if [[ $? -ne 0 ]] ; then gitbranch="${${"$(< $gitdir/HEAD)"}[1,7]}..." fi fi fi printf '%s' "${gitbranch}" return 0 } gitdir=${vcs_comm[gitdir]} gitbranch="$(VCS_INFO_git_getbranch ${gitdir})" if zstyle -t ":vcs_info:${vcs}:${usercontext}:${rrn}" get-revision ; then gitsha1=$(${vcs_comm[cmd]} rev-parse --quiet --verify HEAD) else gitsha1='' fi gitbranch="${gitbranch##refs/[^/]##/}" if [[ -z ${gitdir} ]] || [[ -z ${gitbranch} ]] ; then return 1 fi if zstyle -t ":vcs_info:${vcs}:${usercontext}:${rrn}" "check-for-changes" && \ [[ "$(${vcs_comm[cmd]} rev-parse --is-inside-git-dir 2> /dev/null)" != 'true' ]] && \ ${vcs_comm[cmd]} rev-parse --quiet --verify HEAD &> /dev/null ; then # Default: off - these are potentially expensive on big repositories ${vcs_comm[cmd]} diff --no-ext-diff --ignore-submodules --quiet --exit-code || gitunstaged=1 ${vcs_comm[cmd]} diff-index --cached --quiet --ignore-submodules HEAD 2> /dev/null (( $? && $? != 128 )) && gitstaged=1 fi VCS_INFO_adjust gitaction="$(VCS_INFO_git_getaction ${gitdir})" gitbase=${PWD%/${$( ${vcs_comm[cmd]} rev-parse --show-prefix )%/##}} rrn=${gitbase:t} local patchdir=${gitdir}/patches/${gitbranch} if [[ -d $patchdir ]] ; then local -a stgit_applied stgit_unapplied stgit_applied=(${(f)"$(< "${patchdir}/applied")"}) stgit_applied=( ${(Oa)stgit_applied} ) stgit_unapplied=(${(f)"$(< "${patchdir}/unapplied")"}) stgit_unapplied=( ${(oa)stgit_applied} ) if VCS_INFO_hook 'gen-applied-string' "${stgit_applied[@]}"; then if (( ${#stgit_applied} )); then stgitpatch=${stgit_applied[1]} else stgitpatch="" fi else stgitpatch=${hook_com[patch-string]} fi hook_com=() if VCS_INFO_hook 'gen-unapplied-string' "${stgit_unapplied[@]}"; then stgitunapplied=${#stgit_unapplied} else stgitunapplied=${hook_com[unapplied-string]} fi if (( ${#stgit_applied} )); then zstyle -s ":vcs_info:${vcs}:${usercontext}:${rrn}" patch-format stgitmsg || stgitmsg="%p (%n applied)" else zstyle -s ":vcs_info:${vcs}:${usercontext}:${rrn}" nopatch-format stgitmsg || stgitmsg="no patch applied" fi hook_com=( applied "${stgitpatch}" unapplied "${stgitunapplied}" applied-n ${#stgit_applied} unapplied-n ${#stgit_unapplied} ) if VCS_INFO_hook 'set-patch-format' "${stgitmsg}"; then zformat -f stgitmsg "${stgitmsg}" "p:${hook_com[applied]}" "u:${hook_com[unapplied]}" \ "n:${#stgit_applied}" "c:${#stgit_unapplied}" else stgitmsg=${hook_com[patch-replace]} fi hook_com=() else stgitmsg='' fi backend_misc[patches]="${stgitmsg}" VCS_INFO_formats "${gitaction}" "${gitbranch}" "${gitbase}" "${gitstaged}" "${gitunstaged}" "${gitsha1}" "${stgitmsg}" return 0 PK[ J Jfunctions/_perforcenuW+A#compdef p4 p4d -value-,P4CLIENT,-default- -value-,P4PORT,-default- -value-,P4MERGE,-default- -value-,P4USER,-default- # Maintainer: Peter Stephenson . # Increasingly loosely based on _cvs version 1.17. # Completions currently based on Perforce release 2006.2. # Styles, tags and contexts # ========================= # # If the `verbose' style is set (it is assumed by default), verbose # descriptions are provided for many completed quantities derived # dynamically such as subcommand names, labels, changes -- in fact, # just about anything for which Perforce itself produces a verbose, # one-line description. It may be turned off in the context of each # subcommand e.g. # zstyle ':completion:*:p4-labelsync:*' verbose false # or for a particular tag, e.g. changes, # zstyle ':completion:*:changes' verbose false # or just for top-level completion (i.e. up to and including completion # of the subcommand): # zstyle ':completion:*:p4:*' verbose false # or for p4 as a whole, # zstyle ':completion:*:p4(-*|):*' verbose false # This is actually handled by the `_describe' function underneath the # Perforce completion system; it's mentioned here as verbosity adds # significantly to a lot of the Perforce completions. # # Note that completing change numbers is not very useful if `verbose' is # turned off. There is no speed advantage for turning it off, either. # (Changes are also known as changelists or changesets. The functions # and tags here all consistently use `changes'.) # # The style `max' can be set to a number which limits how many # possibilities can be shown when selecting changes or jobs. This is # handled within Perforce, so the completion code may limit the number even # further. If not set explicitly, the value is taken to be 20 to avoid a # huge database being output. Set it to a larger number if necessary. # Setting it explicitly to zero removes the maximum. Because you see only # the most recent, changes and jobs are shown in the order given by # Perforce without further sorting. # # Completion of jobs can also be controlled by the `jobview' style. # This uses the standard Perforce JobView syntax, and is applied # in connection with the `max' style. In other words, # if you set # zstyle ':completion:*:p4-*:jobs' max 0 # zstyle ':completion:*:p4-*:jobs' jobview 'user=pws' # then jobs to be completed will be those from the output of # p4 jobs -e 'user=pws' # i.e. those assigned to Perforce user `pws'. # # Completion of changes can be controlled by the `changes' style. # This takes additional arguments to be passed to `p4 changes'. # An obvious example is: # zstyle ':completion:*:p4-*:changes' changes -u $USER # to limit changes to the present user. # # The style `all-files' is used to tell the completion system to # complete any file in a given context. This is for use in places # where it would, for example, only complete files opened for editing. # See the next section for more. # # The style `depot-files' tells the system to complete files by asking # Perforce for a list where it would otherwise complete files locally by # the standard mechanism --- basically any time you don't use // notation # and there is no restriction e.g. to opened files only. There is likely # to be a significant speed penalty for this; it is turned off by default # in all contexts. The advantage is that it cuts out files not maintained # by Perforce. (Again, note this is a style, not a tag.) Contexts # where this might be particularly useful include p4-diff or p4-diff2. # # The tags depot-files and depot-dirs also exist; they are used whenever # the system is completing files or directories by asking Perforce # to list them, rather than by using normal file completion. # # The tag subdirs is used to complete the special `...' which tells # Perforce to search all subdirectories. Hence you can turn this # feature off by suitably manipulating your tags. # # The function will usually try to limit the files it lists by # context; for example, to just opened files. By default it does # this by retrieving the complete list from Perforce and then # relying on the completion system to do the matching. If this is # slow, it is possible to set the style "glob", in which case the # matching is done within Perforce, potentially reducing the amount of # searching of Perforce's internal database. The tag used for # this is the same as the command used to retrieve the file name: # integrated, opened, resolved, dirs, files. The disadvantage # of doing the matching within Perforce is that no matcher specification # is applied; for example, it's not possible to match a_u.c against # admin_utils.c. # # Actually, a hybrid strategy is used when the glob style is not set: the # directory is passed literally to Perforce, but the file or directory # being matched is passed as "*", so that matching on the contents of the # directory is performed by the completion system. # # Experiment suggests that the glob style isn't usually needed: only # "p4 integrated" is likely to be significantly slowed if no limiting # pattern is applied, and completing only integrated files is uncommon. # # Completion of files and their revisions # ======================================= # # File completion handles @ and # suffixes. If the filename is completed, # typing @ or # removes the space which was automatically added. # The context used has `at-suffix' or `hash-suffix' in the position # before the tag to indicate suffix completion (as always, ^Xh will # show you all possible contexts). This makes it possible # to select changes, dates, labels and clients using the tag-order # style. For example, # zstyle ':completion:*:p4-*:at-suffix:*' tag-order changes '*' # will force all completion after `@' to show changes first. Executing # _next_tags (usually ^x^n) will cycle between that and the remaining # tags (dates, labels, clients). I recommend, at least, keeping labels # later than changes since the former are less useful and can take a long # time to complete. # # A # is automatically quoted when handled in this way; if the file is # typed by hand or the completion didn't finish (e.g. you typed a character # in the middle of menu completion), you probably need to type `\#' by # hand. The problem is that the completion system uses extended globbing # and hence a pattern of the form `filename#' always matches `filename' # (since e# matches any number of e's including one). Hence this can look # like an expansion which expands to `filename'. # # After @, you can complete changes (note the use of the style `max' # above), labels, clients or even dates, while after `#' you can # complete numeric revisions or the special revision names head, none, # have. These are available whether or not you completed the filename; if # the file doesn't exist, numeric revisions won't work, but the rest will # (though what Perforce will do with the resulting command is another matter). # # In addition, when completing after `file@', only changes specific to `file' # will be shown (exactly the list of changes Perforce shows from the # command `p4 changes file'). If this doesn't work, chances are that # `file' does not exist. Having a multi-directory match (literal `...') # in `file' should work fine, since `p4 changes' recognises all normal # Perforce file syntax. # # Some perforce commands allow you to specify a range of revisions or # changes as `file@1,@2' or `file#1,#2'. Currently, the second part of the # revision range can always be completed (whether the command accepts them # or not), but the comma after the first part of the range is only added # automatically if the documentation suggests the command accepts ranges at # that point. This is an auto-removable suffix, so it will disappear if # you hit space or return. Typing a `#' at this point will insert a # backslash, as before. The # and @ are never added automatically; you # have to select one by hand. # # Perforce allows change and revision numbers to be preceded by =, <, <=, > # or >=. See `p4 help undoc' for details. (In particular, `=' is # an extremely useful shortcut when integrating single changes.) # This syntax is handled, but currently the < and > must be quoted # with a backslash, not by any other mechanism. For example, # p4 files myfile@\>=3 # will complete a change number. The valid syntax where the second # change or revision in a range does not have the @ or # in front # (for example `file@32183,32185') is not currently handled; the @ # must be repeated. # # File completion for some functions is restricted by the Perforce # status of the file; for example, `p4 opened' only completes opened # files (surprised?) However, you can set the style (N.B. not tag) # `all-files'; so, for example, you can turn off the limit in this case by # zstyle ':completion:*:p4-opened:*' all-files true # Normally the `file-patterns' style would be used to control matching, # but as the file types are not selected by globbing it doesn't work here # However, if you set the all-files style, all filename completion is done # by the standard mechanism; in this case, the `file-patterns' style works # as usual. The style `ignored-patterns' is available in any case, even # without `all-files'; this is therefore generally the one to use. # # The style `whole-path' allows you complete the entire path to a file # at once. This is useful in cases such as opened files where the # list of files is likely to be short but may include files with # widely different paths. As with the `glob' style, the tag is the # Perforce disposition of the file: integrated, opened, resolved, dirs, # files. For example, with # zstyle ':completion:*:p4-revert:*:opened' whole-path true # completion after `p4 revert' will offer you the entire depot path # to a file rather than just part of the path at once (with the # usual methods of disambiguation). Directory completion is turned # off during a `whole-path' completion. The `whole-path' style can # also take the value `absolute'; this means that an initial `/' # activates `whole-path' completion, otherwise a relative file path # will be completed in the normal way. For example, with # zstyle ':completion:*:p4-revert:*:opened' whole-path absolute # then after `p4 revert ' you are offered open files in the # current directory plus directories; after `p4 revert /' you # are offered all open files in depot syntax. # # With `p4 diff', the shell will spot if you have used an option that # allows you to diff unopened files (such as -f) and in that case offer # all files; otherwise, it just offers opened files. # # Completion of changes # ===================== # # There is various extra magic available any time change numbers # are completed, regardless of how this was reached, i.e. # `p4 fixes -c ...' and `p4 diff filename.c@...' are treated the same way. # Note, however, these only work if you are at the point where a change # number would be completed. # # Firstly, as mentioned above there is a maximum for the number of # changes which will be shown, given by the style max, or defaulting to 20. # Only the most recent changes will be shown. This is to avoid a speed # penalty or clumsy output. If a positive numeric argument is given # when changes are being completed, the maximum is set (unconditionally) # to that number instead. # # It is also possible to give a negative numeric prefix to a listing widget # (i.e. typically whatever is bound to ^D). If there is already a change # number on the line, e.g. from cycling through a menu of choices, the full # description for that change is shown in the format of a completion # listing. [TODO: this could be made configurable with a style.] # # It may be necessary to abandon the current completion attempt before # typing this to force the completion system to display the new text. # Replacing delete-char-or-list with the following user defined widget # (create with `zle -N ...') will force this for any negative prefix argument. # (( ${NUMERIC:-0} < 0 )) && (( CURSOR = CURSOR )) # zle delete-char-or-list # # Completion of jobs # ================= # # Completing jobs uses the same logic for the numeric prefix as completing # changes: a positive prefix changes the maximum number of jobs which # will be shown, and a negative prefix when listing shows the full # text for the job whose name is currently inserted on the command line. # In this case, the entire text of the word being completed is assumed # to constitute the job name (which is almost certainly correct). # # Completion of dates # =================== # # In a file revision specification it is possible to give a date # in the form file@YYYY/MM/DD:hh:mm:ss, which may be completed. This # is ever so slightly less silly than it sounds. Any component entered # by hand with the appropriate suffix will be ignored; any component # completed will be set to the current value. Hence you can easily # specify, say, one month ago by using the completed value for all # components except the month and setting that to one less. The shell # will also happily append the appropriate suffix if you try to complete # after anything which is already the appropriate width. (Perforce # supports two-digit years, but these are confusing and no longer # particularly useful as they refer to the twentieth century, so # the shell does not.) # # Calls to p4 # =========== # # Much of the information from Perforce is provided by calls to p4 # commands. This is done via the _call_program interface, as described # in the zshcompsys manual page. Hence a suitable context with the # `command' style allows the user to take control of this call. # The tags used are the name of the p4 command, or in the case of # calls to help subcommands, `help-'. Note that if the # value of the style begins with `-', the arguments to the perforce # command are appended to the remaining words of the style before calling # the command. # # Programmes taking p4-style arguments # ==================================== # # It is possible to use the _perforce completion with other commands # which behave like a subcommand of p4 by setting the service type # to p4-. For example, # compdef _perforce p4cvsmap=p4-files # says that the command `p4cvsmap' takes arguments like `p4 files'. # Often the options will be different; if this is a problem, you # will need to write your own completer which loads _perforce and # calls its functions directly. You can add -global to the end # of the service to say that the command also handles global # Perforce options, comme ca: # compdef _perforce p4reopen=p4-job-global # # Anything more complicated should be modelled on one of the # _perforce_cmd_* handlers below. To get this to work, the full # set of _perforce functions must be loaded; because of the way # autoloading works, a trick is required: call "_perforce -l" which # causes the function to be executed, loading all the associated # functions as a side effect, but tells _perforce to return without # generating any completions. For example, here is the completion # for my `p4desc' function which is an enhanced version of `p4 describe' # (without any handling for global Perforce arguments): # # #compdef p4desc # # _perforce -l # # _arguments -s : \ # '-d-[select diff option]:diff option:((b\:ignore\ blanks c\:context d\:basic\ diff n\:RCS s\:summary u\:unified w\:ignore\ all\ whitespace))' \ # '-s[short form]' \ # '-j[select by job]:job:_perforce_jobs' \ # '*::change:_perforce_changes' # # To add handling of global options to this, see the end of the _perforce # function below. Something like: # # local -a _perforce_global_options _perforce_option_dispatch # if _perforce_global_options; then # _arguments -s : $_perforce_option_dispatch \ # '' # fi # # TODO # ==== # # No mechanism is provided for completely ignoring certain files not # handled by Perforce as with .cvsignore. This could be done ad hoc. # However, the ignored-patterns style and the parameter $fignore are # of course applied as usual, so setting ignored-patterns for the # context `:completion:*:p4[-:]*' should work. _perforce() { # rely on localoptions setopt nonomatch local p4cmd==p4 match mbegin mend integer _perforce_cmd_ind if [[ $1 = -l ]]; then # Run to load _perforce and associated functions but do # nothing else. return fi if [[ $service = -value-* ]]; then # Completing parameter value. # Some of these --- in particular P4PORT --- don't need # the perforce server. case $compstate[parameter] in (P4PORT) _perforce_hosts_ports ;; (P4CLIENT) _perforce_clients ;; (P4MERGE) _command_names -e ;; (P4USER) _perforce_users ;; esac # We do not handle values anywhere else. return fi if [[ $p4cmd = '=p4' ]]; then _message "p4 executable not found: completion not available" return fi # If we are at or after the command word, remember the # global arguments to p4 as we will need to pass these down # when generating completion lists. # This is both an array and a function, but luckily I never # get confused... local -a _perforce_global_options local -a _perforce_option_dispatch # If we are given a service of the form p4-cmd, treat this # as if it was after `p4 cmd'. This provides an easy way in # for scripts and functions that emulate the behaviour of # p4 subcommands. Note we don't shorten the command line arguments. if [[ $service = p4-(#b)(*) ]]; then local curcontext="$curcontext" local p4cmd=$words[1] cmd=$match[1] gbl if [[ $cmd = (#b)(*)-global ]]; then # Handles global options. cmd=$match[1] _perforce_global_options && gbl=1 fi if (( $+functions[_perforce_cmd_$cmd] )); then curcontext="${curcontext%:*:*}:p4-${cmd}:" if [[ -n $gbl ]]; then # We are handling global Perforce options as well as the # arguments to the specific command. # To handle the latter, we need the command name, plus # all the arguments for the command with the global options # removed. The function _perforce_service_dispatch handles # this by unshifting the command ($p4cmd) into words, # then dispatching for the Perforce subcommand $cmd. # # Has anyone noticed this is getting rather complicated? _arguments -s : $_perforce_option_dispatch \ "*::p4-$cmd arguments: _perforce_service_dispatch $p4cmd $cmd" else _perforce_cmd_$cmd fi # Don't try to do full command handling. return else _message "unhandled _perforce service: $service" return 1 fi fi if [[ $service = p4d ]]; then _arguments -s : \ '-d[run as daemon]' \ '-f[run as single threaded server]' \ '-i[run for inetd using sockets]' \ '-q[suppress startup message]' \ '-s[run as NT service]' \ '-xi[switch server database to unicode mode and quit]' \ '-xu[run database upgrade and quit]' \ '-c[run command and exit]:command of some sort: ' \ '-Id[specify description]:description: ' \ '-In[specify unique name]:name: ' \ '-jc[checkpoint, save and truncate journal]::optional prefix: ' \ '-jd[checkpoint, not saving journal]::optional file:_files' \ '-jj[save and truncate journal]::optional prefix: ' \ '-jr[incremental restore from checkpoint/journal]:'\ 'file:_files:file:_files' \ '-z[gzip checkpoint and journal files]' \ '-h[show help]' \ '-V[print server version]' \ '-A[set audit log ($P4AUDIT)]:audit file:_files' \ '-J[set journal file ($P4JOURNAL) or "off"]:journal file:_files' \ '-L[set error log ($P4LOG or stderr)]:error log:_files' \ '-p[set port ($P4PORT o perforce:1666)]:port:_perforce_hosts_ports' \ '-r[set root directory ($P4ROOT)]:root directory:_path_files -g "*(/)"' \ '-v[debug level]:level: ' elif _perforce_global_options; then _arguments -s : $_perforce_option_dispatch \ '1:perforce command:_perforce_commands' else (( _perforce_cmd_ind-- )) (( CURRENT -= _perforce_cmd_ind )) shift $_perforce_cmd_ind words _perforce_command_args fi } # # Command and argument dispatchers # # Front end to _call_program to add in the global arguments # passed to p4. The first argument is the tag, the remaining # arguments are passed to p4. Typically the tag is the same # as the first p4 argument. (( $+functions[_perforce_call_p4] )) || _perforce_call_p4() { local cp_tag=$1 shift # This is for our own use for parsing, and we need English output, # so... local +x P4LANGUAGE _call_program $cp_tag p4 "${_perforce_global_options[@]}" "$@" } # The list of commands is cached in _perforce_cmd_list, but we # only generate it via this function when we need it. (( $+functions[_perforce_gen_cmd_list] )) || _perforce_gen_cmd_list() { (( ${+_perforce_cmd_list} )) || typeset -ga _perforce_cmd_list local hline line match mbegin mend # Output looks like command-namedescription in words... # Ignore blank lines and the heading line beginning `Perforce...' # Just gets run once, then cached, so don't bother optimising # this to a grossly unreadable parameter substitution. _perforce_call_p4 help-commands help commands | while read -A hline; do (( ${#hline} < 2 )) && continue [[ $hline[1] = (#i)perforce ]] && continue _perforce_cmd_list+=("${hline[1]}:${hline[2,-1]}") done # Also cache the server version for nefarious purposes. _perforce_call_p4 info info | while read line; do if [[ $line = (#b)"Server version: "*/*/(<->.<->)(.[^/]|)/*" "* ]]; then _perforce_server_version=$match[1] fi done # Unsupported commands: we could look through p4 help undoc, I suppose. # I can't be bothered to check the date when they appeared any more, # but let's at least check they're not already there. local -a unsup unsup=( "attribute:set attributes for open file (EXPERIMENTAL)" "dbschema:report meta database information" "export:extract journal or checkpoint records" "interchanges:report changes not yet integrated between branches" "replicate:poll for journal changes and apply to another server" "spec:allows limited changes to form specifications (admin)" ) for line in $unsup; do if [[ ${_perforce_cmd_list[(r)${line%%:*}:*]} = '' ]]; then _perforce_cmd_list+=($line) fi done } (( $+functions[_perforce_commands] )) || _perforce_commands() { (( ${#_perforce_cmd_list} )) || _perforce_gen_cmd_list _describe -t p4-commands 'Perforce command' _perforce_cmd_list } (( $+functions[_perforce_command_args] )) || _perforce_command_args() { local curcontext="$curcontext" cmd=${words[1]} if (( $+functions[_perforce_cmd_$cmd] )); then curcontext="${curcontext%:*:*}:p4-${cmd}:" _perforce_cmd_$cmd else _message "unhandled perforce command: $cmd" fi } (( $+functions[_perforce_service_dispatch] )) || _perforce_service_dispatch() { # Put the original command name back, then dispatch for # our Perforce handler. words=($1 "$words[@]") (( CURRENT++ )) _perforce_cmd_$2 } # # Helper functions # (( $+functions[_perforce_global_options] )) || _perforce_global_options() { # Options with arguments we need to pass down when calling # p4 from completers. There are no options without arguments # we need to pass. (Don't pass down -L language since we # parse based on English output.) local argopts_pass="cCdHpPu" # Other options which have arguments but we shouldn't pass down. # There are some debugging options, but they tend to get used # with the argument in the same word as the option, in which # case they will be handled OK anyway. local argopts_ignore="Lx" # The options we support in the form for _arguments. # This is here for modularity and convenience, but note that since the # actual dispatch takes place later, this is not local to this # function and so must be made local in the caller. _perforce_option_dispatch=( '-c+[client]:client:_perforce_clients' \ '-C+[charset]:charset:_perforce_charsets' \ '-d+[current directory]:directory:_path_files -g "*(/)"' \ '-H+[hostname]:host:_perforce_hosts' \ '-G[python output]' \ '-L+[message language]:language: ' \ '-p+[server port]:port:_perforce_hosts_ports' \ '-P+[password on server]:password: ' \ '-s[output script tags]' \ '-u+[user]:user name:_perforce_users' \ '-x+[filename or -]:file:_perforce_files_or_minus' \ '-z+[select output format]:output format:(tag)' ) integer i # We need to try and check if we are before or after the # subcommand, since some of the options with arguments, in particular -c, # work differently. It didn't work if I just added '*::...' to the # end of the arguments list, anyway. for (( i = 2; i < CURRENT; i++ )); do if [[ $words[i] = -[$argopts_pass$argopts_ignore] ]]; then # word with following argument --- check this # is less than the current word, else we are completing # this and shouldn't pass it down if [[ $(( i + 1 )) -lt $CURRENT && \ $words[i] = -[$argopts_pass] ]]; then _perforce_global_options+=(${words[i,i+1]}) fi (( i++ )) elif [[ $words[i] = -[$argopts_pass]* ]]; then # word including argument which we want to keep _perforce_global_options+=(${words[i]}) elif [[ $words[i] != -* ]]; then break fi done (( _perforce_cmd_ind = i )) (( _perforce_cmd_ind >= CURRENT )) } (( $+functions[_perforce_branches] )) || _perforce_branches() { local bline match mbegin mend local -a bl bl=(${${${(f)"$(_perforce_call_p4 branches branches 2>/dev/null)"}##Branch }/ /:}) [[ $#bl -eq 1 && $bl[1] = '' ]] && bl=() (( $#bl )) && _describe -t branches 'Perforce branch' bl } (( $+functions[_perforce_changes] )) || _perforce_changes() { local cline match mbegin mend max ctype num comma file local -a cl cstatus amax xargs zstyle -s ":completion:${curcontext}:changes" max max || max=20 zstyle -a ":completion:${curcontext}:changes" changes xargs if [[ ${NUMERIC:-0} -lt 0 && -z $compstate[insert] ]]; then # Not inserting (i.e. just listing) and given a negative # prefix argument. Instead of listing possible completions, # show the full description for the change number on the line at # the moment. [[ $PREFIX = (|*[^[:digit:]])(#b)(<->) ]] && num+=$match[1] [[ $SUFFIX = (#b)(<->)* ]] && num+=$match[1] if [[ -n $num ]]; then _message -r "$(_perforce_call_p4 describe describe $num)" return 0 fi elif [[ ${NUMERIC:-0} -gt 0 ]]; then max=$NUMERIC fi (( max )) && amax=(-m $max) # Hack: assume the arguments we want are at the end. while [[ $argv[-1] = -t? ]]; do case $argv[-1] in # Change embedded in filename; extract that and remove # the corresponding prefix. Remove possible `#'s, too, # in case we are looking at a range. (-tf) file=${${(Q)PREFIX}%%[\#@]*} compset -P '*@(|\\\<|\\\>)(|=)' ;; # Changes already submitted (-ts) cstatus=(-s submitted) ctype="submitted " ;; # Changes still pending (-tp) cstatus=(-s pending) ctype="pending " ;; # Changes still pending and on the current client. # Many uses of pending changes must be on the current client # to be meaningful, in particular submitting a change or # associating a file or operation with a particular change. (-tc) # Don't like this way of extracting the client to use, # but I don't see a simpler one. We do at least make sure # we call p4 with the same arguments as we will use with p4 changes. cstatus=(-s pending -c "$(_perforce_call_p4 client client -o | awk '/^Client:/ { print $2 }')") ctype="local pending " ;; # Changes that were shelved (-tS) cstatus=(-s shelved) ctype="shelved " ;; # Range allowed: append comma and supply rules for # removing and handling subsequent `#'. (-tR) comma=(-S, -R _perforce_file_suffix) esac argv=($argv[1,-2]) done # Limit to the 20 most recent changes by default to avoid huge # output. cl=( ${${${${(f)"$(_perforce_call_p4 changes changes $amax $xargs $cstatus \$file)"}##Change\ }//\ on\ /:}/\ by\ /\ } ) # "default" can't have shelved files in it... [[ $ctype = shelved* ]] || cl+=("default:change not yet numbered") [[ $#cl -eq 1 && $cl[1] = '' ]] && cl=() _describe -t changes "${ctype}change" cl -V changes-unsorted $comma } (( $+functions[_perforce_charsets] )) || _perforce_charsets() { local expl _wanted charset expl 'character set' \ compadd eucjp iso8859-1 shiftjis utf8 winansi } (( $+functions[_perforce_clients] )) || _perforce_clients() { local -a slash cl # Are we completing after an @, or a client view in a filespec? if ! compset -P '*@'; then compset -P '//' && slash=(-S/ -q) fi cl=(${${${(f)"$(_perforce_call_p4 clients clients)"}##Client\ }/\ /:}) [[ $#cl -eq 1 && $cl[1] = '' ]] && cl=() _describe -t clients 'Perforce client' cl $slash } (( $+functions[_perforce_counters] )) || _perforce_counters() { local cline match mbegin mend local -a cl cl=(${${${(f)"$(_perforce_call_p4 counters counters)"}/\ /:}/\=/current value}) [[ $#cl -eq 1 && $cl[1] = '' ]] && cl=() _describe -t counters 'Perforce counter' cl } (( $+functions[_perforce_counter_values] )) || _perforce_counter_values() { if [[ -n $words[CURRENT-1] ]]; then local value="$(_perforce_call_p4 counter counter $words[CURRENT-1] 2>/dev/null)" if [[ -n $value ]]; then # No space. This allows stuff like incarg and decarg. compstate[insert]=1 _wanted value expl 'counter value' compadd $value fi fi } (( $+functions[_perforce_dates] )) || _perforce_dates() { # Only useful in a file spec after `@'. compset -P '*@(|\\\<|\\\>)(|=)' # Date/time now in format required by Perforce. local now="$(date +%Y:%m:%d:%T)" name prefix local -a nowarray offer opts matchpats suffixes names nowarray=(${(s.:.)now}) names=( year month day\ of\ month hour minute second) suffixes=( / / : : : '' ) integer i prefix=${(Q)PREFIX} for (( i = 6; i >= 1; i-- )); do # Match from the most specific back. # The following is one of those occasions where zsh # substitution skips to the right answer without ever # passing through the real world on the way. if [[ $prefix = *${(j.*.)~suffixes[1,i-1]}* ]]; then (( i > 1 )) && compset -P "*$suffixes[i-1]" # If what's there already is the right length, # just accept it and add the suffix. prefix=${(Q)PREFIX} if [[ ${#prefix} = ${#nowarray[i]} ]]; then offer=($prefix) else offer=($nowarray[i]) fi [[ -n $suffixes[i] ]] && opts=(-S $suffixes[i] -q) name=$names[i] break fi done _describe -t dates $name offer $opts } (( $+functions[_perforce_dbtables] )) || _perforce_dbtables() { local -a tables tables=(archmap bodtext change changex counters depot domain have integ integed ixtext label locks resolve rev revcx revdx revhx revsx trigger user view working) _describe -t db-table "DB table" tables } (( $+functions[_perforce_depots] )) || _perforce_depots() { local dline match mbegin mend local -a dl dl=(${${${(f)"$(_perforce_call_p4 depots depots)"}##Depot\ }/\ /:}) [[ $#dl -eq 1 && $dl[1] = '' ]] && dl=() _describe -t depots 'depot name' dl } (( $+functions[_perforce_files_or_minus] )) || _perforce_files_or_minus() { _alternative 'minus:minus sign:(-)' 'files:file name:_files' } (( $+functions[_perforce_file_suffix] )) || _perforce_file_suffix() { # Used with compadd -R to handle @ or # after a file name. # Differs from compadd -r '...' in that it quotes `#' if typed. [[ $1 = 1 ]] || return if [[ $LBUFFER[-1] = [\ ,] ]]; then if [[ $KEYS = '#' ]]; then if [[ $LBUFFER[-1] = , ]]; then # Range: no suffix removal but add a backslash LBUFFER+=\\ else # Suffix removal with an added backslash LBUFFER="$LBUFFER[1,-2]\\" fi elif [[ $KEYS = (*[^[:print:]]*|[[:blank:]\;\&\|]) || \ ( $KEYS = @ && $LBUFFER[-1] = ' ' ) ]] ; then # Normal suffix removal LBUFFER="$LBUFFER[1,-2]" fi elif [[ $LBUFFER[-1] = / ]]; then # Normal suffix removal for directories. if [[ $KEYS = (*[^[:print:]]*|[[:blank:]\;\&\|/]) ]]; then LBUFFER="$LBUFFER[1,-2]" fi fi } # Helper function for the helper function for the helper functions # for the helper function _perforce_files. # # Check if we should do whole-path completion. # The argument is the Perforce disposition of files are looking at. _perforce_whole_path() { local wp zstyle -s ":completion:${curcontext}:$1" whole-path wp case $wp in (true|yes|on|1) return 0 ;; (absolute) [[ ${(Q)PREFIX} = /* ]] && return 0 ;; esac return 1 } # # Helper function for the helper functions for the helper function # _perforce_files. This is common code to retrieve a list of files # from Perforce. # # First argument is the p4 subcommand used to list the files. # This is also used as a tag for the style to decide whether # to limit the list within Perforce. # Remaining arguments are additional arguments to compadd. # (( $+functions[_perforce_retrieve_files] )) || _perforce_retrieve_files() { local pfx local -a files if _perforce_whole_path $1; then files=(${${(f)"$(_perforce_call_p4 $1 $1 2>/dev/null)"}%%\#*}) elif zstyle -t ":completion:${curcontext}:$1" glob; then # Limit the list by using Perforce to glob the pattern. # This may be faster, but won't use matcher specs etc. pfx=${(Q)PREFIX} compset -P '*/' files=(${${${(f)"$(_perforce_call_p4 $1 $1 \"\$pfx\*\$\{\(Q\)SUFFIX\}\" 2>/dev/null)"}%%\#*}##*/}) else # We need to limit the list to a directory. if [[ $PREFIX = */* ]]; then pfx="${(Q)${PREFIX%/*}}/*" else pfx="*" fi compset -P '*/' files=(${${${(f)"$(_perforce_call_p4 $1 $1 \$pfx 2>/dev/null)"}%%\#*}##*/}) fi [[ $#files -eq 1 && $files[1] = '' ]] && files=() shift compadd "$@" -a files } # # Helper functions for the helper function _perforce_files. These files # are low-level enough that they don't handle tags; this is done # by the _alternative handler in _perforce_files. # (( $+functions[_perforce_integrated_files] )) || _perforce_integrated_files() { local pfx=${(Q)PREFIX} type local -a files _perforce_retrieve_files integrated "$@" } (( $+functions[_perforce_opened_files] )) || _perforce_opened_files() { local type local -a files _perforce_retrieve_files opened "$@" } (( $+functions[_perforce_resolved_files] )) || _perforce_resolved_files() { _perforce_retrieve_files resolved "$@" } # This has no other function than to offer to add the `...' used # by Perforce to indicate a recursive search of directories. # Bit pathetic, really. # # This has been causing odd effects with prefixes so is turned off. #(( $+functions[_perforce_subdirs] )) || #_perforce_subdirs() { # if [[ $PREFIX = */* ]]; then # local dir=${PREFIX%%[^/]#} # compadd "$@" -J subdirs -p $dir ... # else # compadd "$@" -J subdirs ... # fi #} (( $+functions[_perforce_depot_dirs] )) || _perforce_depot_dirs() { # Normal completion of directories in depots _perforce_retrieve_files dirs "$@" -S / -q } (( $+functions[_perforce_depot_files] )) || _perforce_depot_files() { # Normal completion of files in depots _perforce_retrieve_files files "$@" -R _perforce_file_suffix } (( $+functions[_perforce_client_dirs] )) || _perforce_client_dirs() { # This is a slightly odd addition which isn't often necessary. # When completing directories in a client specification, Perforce # doesn't tell you about intermediate directories which are in # the client, but not in the depot. (Well... sometimes. I've # had some odd results with this. I suspect there may be a bug # but I don't really know enough to be sure.) # # For example, if my view contains # //depot/branches/rev1.2/... //pws_client/branches/rev1.2/... # then `p4 dirs "//pws_client/*"' won't mention the `branches' # directory because the view actually starts lower down. So # we add it by hand when necessary. # # We don't want to waste time on this, since it's not the usual # case, so we cache the results where necessary. This means # recording all the clients that we can later ask about if necessary. # To flush the cache, `unset _perforce_client_list _perforce_client_dirs'. if (( ! ${+_perforce_client_list} )); then # Retrieve the list of clients. typeset -gA _perforce_client_list local -a tmplist local tmpelt tmplist=(${${${(f)"$(_perforce_call_p4 clients clients)"}##Client\ }%%\ *}) [[ $#tmplist -eq 1 && $tmplist[1] = '' ]] && tmplist=() for tmpelt in $tmplist; do _perforce_client_list[$tmpelt]=1 done fi # See if the first path element is a client. Very often it # will actually be a depot, so we test this as quickly as possible. local client=${${PREFIX##//}%%/*} [[ -z ${_perforce_client_list[$client]} ]] && return 1 local oldifs=$IFS IFS= type dir line dirs (( ${+_perforce_client_dirs} )) || typeset -gA _perforce_client_dirs if (( ${+_perforce_client_dirs[$client]} )); then # Already cached, although may be empty. dirs=${_perforce_client_dirs[$client]} else # We need to look at the View stanza of the client record # to see what directories exist in the client view. _perforce_call_p4 client "client -o $client" 2>/dev/null | while read line do case $line in ([[:blank:]]##) type= ;; ((#b)([[:alpha:]]##):*) type=${match[1]} ;; (*) if [[ $type = View ]]; then dir=${${line##[[:blank:]]##//*[[:blank:]]//$client}%%/...(/*|)} if [[ $#dir -gt 1 ]]; then dirs+="${dirs:+ }${(q)dir##/}" fi fi ;; esac done fi (( ${#dirs} )) || return 1 # Turn our string of space-separated backquoted elements into an array. dirs=(${(z)dirs}) # Get the current prefix also as an array of elements compset -P '//[^/]##/' pfx=(${(s./.)${(Q)PREFIX}}) local -a ndirs local match mbegin mend # Check matching path segments while (( ${#pfx} > 1 )); do ndirs=() for dir in $dirs; do if [[ $dir = $pfx/(#b)(*) ]]; then ndirs+=($match[1]) fi done (( ${#ndirs} )) || return 1 dirs=($ndirs) shift pfx compset -P '[^/]' done compadd -S / -q "$@" -- ${dirs%%/*} } (( $+functions[_perforce_files] )) || _perforce_files() { local pfx fline expl opt match mbegin mend range type local -a files types local dodirs unmaintained # Suffix operations can modify context local curcontext="$curcontext" # Used to inhibit directory completion local nodirs while (( $# )); do if [[ $1 = -t(#b)(?) ]]; then case $match[1] in (d) dodirs=-/ ;; (u) unmaintained=1 ;; (i) types+=(integrated) ;; (o) types+=(opened) ;; (r) types+=(resolved) ;; (R) range="-tR" ;; esac fi shift done # Remove the quotes present in the word on the command line, # since we will treat this as a literal string from now on. # We might get into problems with characters recognised as # special by p4 files and p4 dirs, but worry about that later. pfx=${(Q)PREFIX} if [[ -prefix *@ ]]; then # Modify context to indicate we are in a suffix. curcontext="${curcontext%:*}:at-suffix" # Check for existing range syntax [[ $PREFIX = *[@\#]*,* ]] && range= # After @ you can specify changes, clients, labels or dates. # Note we don't remove the prefix here; we leave it to the # subcommand. This is in case it needs information from # the prefix; _perforce_changes uses this to limit the # output to relevant changes. _alternative \ "changes:change:_perforce_changes $range -tf" \ clients:client:_perforce_clients \ "labels:label:_perforce_labels -tf" \ 'dates:date (+ time):_perforce_dates' elif [[ -prefix *\# ]]; then # Modify context to indicate we are in a suffix. curcontext="${curcontext%:*}:hash-suffix" # Check for existing range syntax [[ $PREFIX = *[@\#]*,* ]] && range= # Remove longest possible tail match to get name --- this # automatically handles filenames in ranges e.g. `foo#1,#3'. # (Note the compset removes the maximum possible head match, # so we only complete the second part of the range in that case.) _perforce_revisions $range elif [[ $PREFIX = //* ]]; then # This specifies files already handled by Perforce, so there's # no point trying to look for unmaintained files. Assume # the user knows what they're doing. local -a altfiles integer whole_path for type in $types; do _perforce_whole_path $type && whole_path=1 done # If we're doing whole-path completion, and the user starts # a completion early, assume they want just those files, # rather than a client spec. This isn't necessarily the case, # but there's an excellent chance it does fit the user's intention # in a case where it's not really worth adding a special option. # A client list can be huge and they're not actually used very # often to refer to files. In fact, this whole completion # probably ought to be optional (you can do it with tags if # you really want). if [[ $PREFIX = //[^/]# && $whole_path -eq 0 ]]; then # Complete //clientname spec. Don't complete non-directories... # I don't actually know if they are valid here. altfiles+=("clients:Perforce client:_perforce_clients") else local donefiles=1 if [[ -z $dodirs ]]; then if [[ ${#types} -gt 0 ]] && ! zstyle -t ":completion:${curcontext}:" all-files; then for type in $types; do altfiles+=("$type-files:$type file:_perforce_${type}_files") done (( whole_path )) && nodirs=1 else altfiles+=("depot-files:file in depot:_perforce_depot_files") fi fi if [[ -z $nodirs ]]; then # Intermediate directories in a client view. # See function for notes. altfiles+=("client-dirs:client directory:_perforce_client_dirs") fi fi altfiles+=("depot-dirs:directory in depot:_perforce_depot_dirs" # "subdirs:subdirectory search:_perforce_subdirs" ) _alternative $altfiles elif [[ -n $unmaintained && -z $dodirs ]]; then # a la _cvs_nonentried_files: directories are never maintained, # so skip 'em. Unmaintained files can't be integrated, opened # or resolved, so treat as exclusive (just as well, since # this bit's messy). local MATCH MBEGIN MEND local -a omitpats match=() : ${PREFIX:#(#b)(*/)(*)} pfx="$match[1]" pfx=${(e)~pfx} # Exclude both files already known to perforce, plus # those opened. There will be some overlap but we need # to exclude files that are already opened for add. omitpats=( ${${${${(f)"$(_perforce_call_p4 files files \"\$pfx\*\$\{\(Q\)SUFFIX\}\" 2>/dev/null)"}%\#*}##*/}//(#m)[][*?()<|^~#\\]/\\$MATCH} ${${${${(f)"$(_perforce_call_p4 opened opened \"\$pfx\*\$\{\(Q\)SUFFIX\}\" 2>/dev/null)"}%\#*}##*/}//(#m)[][*?()<|^~#\\]/\\$MATCH} ) [[ $#omitpats -eq 1 && $omitpats[1] = '' ]] && omitpats=() if (( ${#omitpats} )); then _path_files -g "*~(*/|)(${(j:|:)~omitpats})(D.)" else _path_files fi # Don't handle suffixes for non-entried files elif (( ${#types} )) && ! zstyle -t ":completion:${curcontext}:" all-files then local -a altfiles for type in $types; do altfiles+=("$type-files:$type file:_perforce_${type}_files") _perforce_whole_path $type && nodirs=1 done if [[ -z $nodirs ]]; then # altfiles+=("subdirs:subdirectory search:_perforce_subdirs") if zstyle -t ":completion:${curcontext}:" depot-files; then altfiles+=("depot-dirs:directory in depot:_perforce_depot_dirs") else altfiles+=("directories:directory:_path_files -/") fi fi _alternative $altfiles elif zstyle -t ":completion:${curcontext}:" depot-files; then local -a altfiles if [[ -z $dodirs ]]; then altfiles+=("depot-files:file in depot:_perforce_depot_files") fi altfiles+=("depot-dirs:directory in depot:_perforce_depot_dirs" # "subdirs:subdirectory search:_perforce_subdirs" ) _alternative $altfiles else # Look locally. # _alternative \ # "files:file:_path_files -R _perforce_file_suffix $dodirs" \ # "subdirs:subdirectory search:_perforce_subdirs" _path_files -R _perforce_file_suffix $dodirs fi } # # Remaining helpers for other types of Perforce metadata. # (( $+functions[_perforce_filetypes] )) || _perforce_filetypes() { local -a values if compset -P '*+*'; then # That second `*' is deliberate --- only complete the last # letter since we can have a whole string of them. values=( "m:always set modtime on client" "w:always writeable on client" "x:set exec bit on client" "k:full RCS keyword expansion" "ko:RCS expansion only for Id, Header" "l:exclusive open, disallow multiple opens" "C:server stores compress file per revision" "D:server stores deltas in RCS format" "F:server stores full file per revision" "S:server stores only head revision" "X:externally archived file" ) _describe -t file-modifiers 'Perforce file modifier' values else values=( "text:text, translate newlines" "binary:raw bytes" "symlink:symbolic link" "apple:Mac resource + data" "unicode:text, translate newlines, store as UTF-8") _describe -t file-types 'Perforce file type' values -S+ -q fi } (( $+functions[_perforce_fstat_fields] )) || _perforce_fstat_fields() { local sep if [[ $argv[-1] = -tv ]]; then # jobview, space is separator sep=' ' else sep=',' fi local -a values # yes, "phew", sorry. # output from "p4 help fstat" gives fields like # digest -- MD5 digest (fingerprint) # etc. etc. values=( ${${${${(M)${(f)"$(_perforce_call_p4 help-fstat help fstat)"}:#[[:blank:]]#[a-zA-Z]##(|\#)[[:blank:]]##--*}##[[:blank:]]#}:#fstat *}//[[:blank:]]##--[[:blank:]]##/:} ) compset -P '*[,[:blank:]]' _describe -t fstat-fields 'Perforce fstat fields' values -S, -q } (( $+functions[_perforce_groups] )) || _perforce_groups() { local -a values values=($(_perforce_call_p4 groups groups)) _describe -t groups 'Perforce group' values } (( $+functions[_perforce_hosts] )) || _perforce_hosts() { local expl host # Completion for p4 -H; other forms of host completion # go through _perforce_hosts_ports. # From Felix: if the client specifies a hostname, there's # no point using any other host, since it won't work. host=$(_perforce_call_p4 client client -o | awk '$1 ~ /^Host:/ {print $2}' ) if [[ -n $host ]]; then _wanted hosts expl host compadd "$@" $host else _hosts fi } (( $+functions[_perforce_hosts_ports] )) || _perforce_hosts_ports() { if compset -P '*:'; then _ports local expl _wanted ports expl port compadd "$@" 1666 else # is this -q-able? _hosts -S : fi } (( $+functions[_perforce_jobs] )) || _perforce_jobs() { # Optional argument is jobview for limiting jobs. local jline match mbegin mend max jobview local -a jl amax ajobview zstyle -s ":completion:${curcontext}:jobs" max max || max=20 # Hack: if there is a job view, it is at the end. # This is nasty, it's really unnecessarily difficult to # pass arguments within completion functions... if [[ $argv[-2] = -e ]]; then ajobview=(-e "${(q)argv[-1]}") argv=("${(@)argv[1,-3]}") else zstyle -s ":completion:${curcontext}:jobs" jobview jobview && ajobview=(-e $jobview) fi if [[ ${NUMERIC:-0} -lt 0 && -z $compstate[insert] ]]; then # Not inserting (i.e. just listing) and given a negative # prefix argument. Instead of listing possible completions, # show the full description for the job which is on the line at # the moment. _message -r "$(_perforce_call_p4 jobs jobs -e \"Job=\$PREFIX\$SUFFIX\" -l 2>/dev/null)" return 0 elif [[ ${NUMERIC:-0} -gt 0 ]]; then max=$NUMERIC fi (( max )) && amax=(-m $max) _perforce_call_p4 jobs jobs $ajobview $amax | while read jline; do if [[ $jline = (#b)([^[:blank:]]##)' '[^[:blank:]]##' '(*) ]]; then jl+=("${match[1]}:${match[2]}") fi done _describe -t jobs 'Perforce job' jl -V jobs-unsorted } (( $+functions[_perforce_jobviews] )) || _perforce_jobviews() { # Jobviews (see `p4 help jobview') are ways of interrogating the # jobs/fixes database. It's basically either a set of strings, # or a set of key=value pairs, or some combination, separated # by various logical operators. The `=' could be a comparison, # but we don't currently bother with that here; it's a bit cumbersome # to complete. local line type oldifs=$IFS IFS= key value slash=/ local match mbegin mend # This is simply to split out two space-delimited words a backreferences. local m2words m2words='(#b)[[:blank:]]##([[:alnum:]]##)[[:blank:]]##([^[:blank:]]##)' local -a valuespec local -A p4fields p4values # All the characters which can separate multiple match attempts. # Ignore up to the last one. We don't try to complete these. compset -P '*[[:blank:]\^\&\|\(\)]' # According to the manual, `p4 jobspec' requires admin privileges. # If this is true even of `p4 jobspec -o', we are a bit screwed. _perforce_call_p4 jobspec jobspec -o 2>/dev/null | while read line; do case $line in ([[:blank:]]##) type= ;; ((#b)([[:alpha:]]##):*) type=${match[1]} ;; (*) case $type in # This stanza tells us all the allowed fields. (Fields) if [[ $line = [[:blank:]]##<->${~m2words}* ]]; then p4fields[${(L)match[1]}]=${match[2]} fi ;; # This stanza gives allowed values for the `select' types. (Values) if [[ $line = ${~m2words}* ]]; then p4values[${(L)match[1]}]=${match[2]} fi ;; esac ;; esac done IFS=$oldifs if (( ! ${#p4fields} )); then # We didn't get anything; add the defaults. p4fields=( date date description text job word status select user word ) p4values=( status open/suspended/closed ) fi for key in ${(k)p4fields}; do if [[ -n ${p4values[$key]} ]]; then valuespec+=("${key}:${p4fields[$key]}:(${p4values[$key]//$slash/ })") elif [[ $key = job ]]; then # Nothing special for jobs; add our own completion. valuespec+=("${key}:Perforce job:_perforce_jobs") elif [[ $key = user ]]; then # Nothing provided for user; add our own completion. valuespec+=("${key}:user:_perforce_users") else valuespec+=("${key}:${p4fields[$key]}: ") fi done _values 'Job specification parameter' $valuespec } (( $+functions[_perforce_labels] )) || _perforce_labels() { local lline file local -a ll match mbegin mend if [[ $argv[-1] = -tf ]]; then argv=($argv[1,-2]) # Completing after `@'. file=${${(Q)PREFIX}%%@*} compset -P '*@(|\\\<|\\\>)(|=)' fi ll=(${${(f)"$(_perforce_call_p4 labels labels ${file:+\$file})"}//(#b)Label\ ([^[:blank:]]##)\ (*)/$match[1]:$match[2]}) _describe -t labels 'Perforce label' ll } (( $+functions[_perforce_revisions] )) || _perforce_revisions() { # Doesn't handle standard completion options; requires space # in front if used as action in _arguments. local rline match mbegin mend comma expl pfx local -a rl if [[ $1 = -tR ]]; then # handle ranges comma=(-S, -R _perforce_file_suffix) shift fi # Beware of @foo,#bar; stupid but valid. pfx=${${(Q)PREFIX}%%[\#@]*} compset -P '*\#(|\\\<|\\\>)(|=)' # Numerical revision numbers, possibly with text. if [[ -z $PREFIX || $PREFIX = <-> ]]; then # always allowed (same as none) rl+=(0) _perforce_call_p4 filelog 'filelog $pfx' 2>/dev/null | while read rline; do if [[ $rline = (#b)'... #'(<->)' change '(*) ]]; then rl+=("${match[1]}:${match[2]}") fi done fi # Non-numerical (special) revision names. if [[ -z $PREFIX || $PREFIX != <-> ]]; then rl+=('head:head revision' 'none:empty revision' 'have:current synced revision') fi _describe -t revisions 'revision' rl -V revisions-unsorted $comma } (( $+functions[_perforce_statuses] )) || _perforce_statuses() { # Perforce statuses are usually limited to a set of values # given by the jobspec. local jline match mbegin mend local -a statuses _perforce_call_p4 jobspec jobspec -o | while read jline; do if [[ $jline = (#b)Status[[:blank:]]##(*/*) ]]; then statuses=(${(s./.)match[1]}) break fi done if (( !${#statuses} )); then # Couldn't find anything from the jobspec; add defaults. statuses=(closed open suspended) fi _describe -t statuses 'job status' statuses } (( $+functions[_perforce_submit_options] )) || _perforce_submit_options() { local -a soptions soptions=('submitunchanged:submit all open files (default)' 'revertunchanged:revert unchanged files' 'leaveunchanged:move unchanged files to default changelist') soptions+=(${^${soptions//:/+reopen:}}", leave submitted open") _describe -t submit-options 'submit option' soptions } (( $+functions[_perforce_pids] )) || _perforce_pids() { local -a ul ul=(${${${(f)"$(_perforce_call_p4 monitor monitor show 2>/dev/null)"}# *}/\ /:}) [[ $#ul -eq 1 && $ul[1] = '' ]] && ul=() _describe -t id 'process ID' ul } (( $+functions[_perforce_users] )) || _perforce_users() { local -a ul ul=(${${(f)"$(_perforce_call_p4 users users)"}/\ /:}) [[ $#ul -eq 1 && $ul[1] = '' ]] && ul=() _describe -t users 'Perforce user' ul } (( $+functions[_perforce_users_or_groups] )) || _perforce_users_or_groups() { _alternative 'groups:Perforce group:_perforce_groups' \ 'users:Perforce user:_perforce_users' } (( $+functions[_perforce_variables] )) || _perforce_variables() { local line match mbegin mend expl local -a vars _perforce_call_p4 help-environment help environment | while IFS= read line do if [[ $line = $'\t'(#b)([A-Z][A-Z0-9_]##)* ]]; then vars+=($match[1]) fi done _wanted variable expl 'environment variable' compadd -S= -q $vars } # # Completions for p4 commands # (( $+functions[_perforce_cmd_add] )) || _perforce_cmd_add() { _arguments -s : \ '-c+[select by change]:change:_perforce_changes -tc' \ '-d[reopen removed file for add (downgrade)]' \ '-f[allow filenames with wild cards]' \ '-n[display operation without doing it]' \ '-t+[set file type]:file type:_perforce_filetypes' \ '*:file:_perforce_files -tu' } (( $+functions[_perforce_cmd_admin] )) || _perforce_cmd_admin() { if (( CURRENT == 2 )); then local -a adcmds adcmds=( "checkpoint:checkpoint, save copy of journal file" "dbstat:db tables" "journal:save and truncate journal file" "logstat:report sizes of log files" "stop:stop the server") _describe -t commands 'Perforce admin command' adcmds else case $words[2] in (checkpoint|journal) shift words (( CURRENT-- )) _arguments -s : \ '-z[gzip journal file]' \ '1::journal file prefix: ' ;; (dbstat) shift words (( CURRENT -- )) _arguments -s : \ '-s[show sizes]' esac fi } (( $+functions[_perforce_cmd_annotate] )) || _perforce_cmd_annotate() { # New in release 2002.2. # -c was new in about 2003.2. _arguments -s : \ '-a[all, show both added and deleted lines]' \ '-c[output change numbers instead of revisions]' \ '-i[follow branches (integration records)]' \ '-q[quiet, suppress one-line file header]' \ '*::file:_perforce_files -tR' } (( $+functions[_perforce_cmd_attribute] )) || _perforce_cmd_attribute() { # This is currently (2005.1) an unsupported command. # See "p4 help undoc". local limit # If -f is present, search unopened files, else don't [[ ${words[(I)-f]} -eq 0 ]] && limit=" -to" _arguments -s : \ '-e[value is in hex]' \ '-f[set the attribute on a submitted file]' \ '-n[set name of attribute]:attribute: ' \ '-p[propagate attribute when opened for edit etc.]' \ '-v[set value of attribute]:value: ' \ "*::file:_perforce_files$limit" } (( $+functions[_perforce_cmd_branch] )) || _perforce_cmd_branch() { _arguments -s : \ '(-o)-f[force operation by superuser]' \ '(-o -i)-d[delete branch]' \ '(-d -i -f)-o[write specification to standard output]' \ '(-d -o)-i[read specification from standard input]' \ '(-i)*::branch name:_perforce_branches' } (( $+functions[_perforce_cmd_branches] )) || _perforce_cmd_branches() { _arguments -s : \ '-e[limit by wildcard]:wildcard on branches: ' \ '-u+[select by user]:user:_perforce_users' \ '-m+[set maximum to show]:max branches: ' } (( $+functions[_perforce_cmd_change] )) || _perforce_cmd_change() { local ctype # Unless forcing or outputting, we don't # complete committed changes since they can't be altered. # If deleting and not forcing, the change must be on the current client. if [[ ${words[(I)-*(f|o)*]} -eq 0 ]]; then if [[ ${words[(I)-d]} -gt 0 ]]; then ctype=" -tc" else ctype=" -tp" fi fi _arguments -s : \ '(-o)-f[allow force by superuser]' \ '-s[joblist includes the fix status]' \ '(-o -i)-d[discard newly created pending change]' \ '(-d -i -f)-o[output specification to standard output]' \ '(-d -o)-i[read specification from standard input]' \ '(-d -o)-u[force change of jobs or description by owner]' \ "(-i)1::change:_perforce_changes$ctype" } (( $+functions[_perforce_cmd_changelist] )) || _perforce_cmd_changelist() { _perforce_cmd_change "$@" } (( $+functions[_perforce_cmd_changes] )) || _perforce_cmd_changes() { _arguments -s : \ '-i[include integrated changes]' \ '-t[output time as well as date]' \ '-l[long output, full change text]' \ '-L[long output, truncated change text]' \ '-c+[select by client]:client:_perforce_clients' \ '-m+[most recent N changes]:max changes: ' \ '-s+[select by status]:status:(pending shelved submitted)' \ '-u+[select by user]:user:_perforce_users' \ '*::file:_perforce_files -tR' } (( $+functions[_perforce_cmd_changelists] )) || _perforce_cmd_changelists() { _perforce_cmd_changes "$@" } (( $+functions[_perforce_cmd_client] )) || _perforce_cmd_client() { _arguments -s : \ '(-o)-f[force modification by superuser]' \ '-t[use template]:template client:_perforce_clients' \ '(-o -i -t)-d[delete client]' \ '(-d -i -f)-o[print to standard output]' \ '(-d -o -t)-i[read from standard input]' \ '1::file:_perforce_clients' } (( $+functions[_perforce_cmd_clients] )) || _perforce_cmd_clients() { _arguments -s : \ '-e[limit by wildcard]:wildcard on clients: ' \ '-u+[select by user]:user:_perforce_users' \ '-m+[set maximum to show]:max clients: ' } (( $+functions[_perforce_cmd_counter] )) || _perforce_cmd_counter() { _arguments -s : \ '-d[delete counter]' \ '-f[force setting of internal counter]' \ '-i[increment by one atomically]' \ '1:counter:_perforce_counters' \ '(-d -i)2::numeric value:_perforce_counter_values' } (( $+functions[_perforce_cmd_counters] )) || _perforce_cmd_counters() { # No arguments _arguments -s : } (( $+functions[_perforce_cmd_cstat] )) || _perforce_cmd_cstat() { _arguments -s : \ '*::file:_perforce_files' } (( $+functions[_perforce_cmd_dbschema] )) || _perforce_cmd_dbschema() { if [[ $PREFIX = *:* ]]; then _message 'table version' else _perforce_dbtables fi } (( $+functions[_perforce_cmd_dbstat] )) || _perforce_cmd_dbstat() { _arguments -s : \ '(-s)-h[histogram of leaf pages in DB table]' \ '(-s)-a[all tables]' \ '(-h -a)-s[report sizes of tables]' \ '(-s -a)*::DB table:_perforce_dbtable' } (( $+functions[_perforce_cmd_delete] )) || _perforce_cmd_delete() { _arguments -s : \ '-c[select change for deletion]:change:_perforce_changes -tc' \ '-n[show deletions without doing them]' \ '*::file:_perforce_files' } (( $+functions[_perforce_cmd_depot] )) || _perforce_cmd_depot() { _arguments -s : \ '-d[delete depot]' \ '-o[print to stdout]' \ '-i[read name from stdin]' \ '(-i)*::depot name:_perforce_depots' } (( $+functions[_perforce_cmd_depots] )) || _perforce_cmd_depots() { # No arguments _arguments -s : } (( $+functions[_perforce_cmd_describe] )) || _perforce_cmd_describe() { _arguments -s : \ '-d-[select diff option]:diff option:((b\:ignore\ blanks c\:context n\:RCS s\:summary u\:unified w\:ignore\ all\ whitespace))' \ '-s[short form]' \ '-S[show shelved changes]' \ '*::change:_perforce_changes' } (( $+functions[_perforce_cmd_diff] )) || _perforce_cmd_diff() { local limit [[ ${words[(I)-(f|sd|se)]} -eq 0 ]] && limit=" -to" _arguments -s : \ '-d-[select diff option]:diff option:((b\:ignore\ blanks c\:context l\:ignore\ line\ endings n\:RCS s\:summary u\:unified w\:ignore\ all\ whitespace))' \ '-f[diff every file]' \ '-m+[set maximum files to show]:max files: ' \ '(-sd -se -sl -sr)-sa[opened files, different or missing]' \ '(-sa -se -sl -sr)-sd[unopened files, missing]' \ '(-sa -sd -sl -sr)-se[unopened files, different]' \ '(-sa -sd -se -sr)-sl[all unopened files with status]' \ '(-sa -sd -se -sl)-sr[opened files, same as depot]' \ '-t[include non-text files]' \ "*::file:_perforce_files$limit" } (( $+functions[_perforce_cmd_diff2] )) || _perforce_cmd_diff2() { _arguments -s : \ '-b[specify branch view]:branch name:_perforce_branches' \ '-d-[select diff option]:diff option:((b\:ignore\ blanks c\:context n\:RCS s\:summary u\:unified w\:ignore\ all\ whitespace))' \ '-q[only list different files]' \ '-t[include non-text files]' \ '-u[use patch-friendly output]' \ '1::first file:_perforce_files' \ '2::second file:_perforce_files' } (( $+functions[_perforce_cmd_dirs] )) || _perforce_cmd_dirs() { _arguments -s : \ '-C[only dirs on current client]' \ '-D[include dirs with deleted files]' \ '-H[only dirs on the `have'\'' list]' \ '*::directory:_perforce_files -td' } (( $+functions[_perforce_cmd_edit] )) || _perforce_cmd_edit() { _arguments -s : \ '-c[set change for edit]:change:_perforce_changes -tc' \ '-k[no resync from server]' \ '-n[show files to edit without opening them]' \ '-t[set filetype]:filetype:_perforce_filetypes' \ '*::file:_perforce_files' } (( $+functions[_perforce_cmd_export] )) || _perforce_cmd_export() { _arguments -s : \ '(-j)-c[specify checkpoint number (/ position)]:checkpoint number: ' \ '(-c)-j[specify journal number (/ position)]:journal number: ' \ '(-j)-f[reformat non-textual data types]' \ '(-j)-l[specify number of lines]:number of lines: ' \ '(-j)-F[specify filter]:filter pattern: ' \ '(-c)-r[raw format]' \ '-J[specify file prefix]:file prefix: ' } (( $+functions[_perforce_cmd_filelog] )) || _perforce_cmd_filelog() { _arguments -s : \ '-c[select by changelist]:change:_perforce_changes -ts' \ '-h[follow branc/copy from records]' \ '-i[follow branches]' \ '-l[long output, full change text]' \ '-L[long output, truncated change text]' \ '-m[set maximum number of revisions to show]:max revisions: ' \ '-s[short output]' \ '-t[include time with date]' \ '*::file:_perforce_files' } (( $+functions[_perforce_cmd_files] )) || _perforce_cmd_files() { _arguments -s : \ '-a[display all revisions in given range]' \ '*::file:_perforce_files -tR' } (( $+functions[_perforce_cmd_fix] )) || _perforce_cmd_fix() { local job local -a jobs if [[ -n $words[(R)-d] && -n $words[(R)-c] && -n $words[$words[(i)-c]+1] ]] then # Deleting a fix from a change. We can find out which fixes # are present. local -a jobs jobs=(${${(f)"$(_perforce_call_p4 fixes fixes -c $words[$words[(i)-c]+1])"}%" fixed by change "*}) if (( ${#jobs} )); then jobs=("Job="${^jobs}) job=" -e \"${(j.|.)jobs}\"" fi fi _arguments -s : \ '-d[delete the fix]' \ '-s[set job status]:status:_perforce_statuses' \ '1::-c required:(-c)' \ '2::change:_perforce_changes' \ "3::job:_perforce_jobs$job" } (( $+functions[_perforce_cmd_fixes] )) || _perforce_cmd_fixes() { _arguments -s : \ '-i[include integrated changes]' \ '-j[select by job]:job:_perforce_jobs' \ '-c[select by change]:change:_perforce_changes' \ '-m[set max fixes to show]:max fixes: ' \ '*::fixed file:_perforce_files -tR' } (( $+functions[_perforce_cmd_flush] )) || _perforce_cmd_flush() { _arguments -s : \ '-f[force resynchronisation]' \ '-k[bypass client file update]' \ '-n[show operations but don'\''t perform them]' \ '*::file:_perforce_files -tR' } (( $+functions[_perforce_cmd_fstat] )) || _perforce_cmd_fstat() { local Oattr Aattr if [[ ${_perforce_cmd_list[(r)attribute:*]} != '' ]]; then # Unsupported feature, try not to show if not present Oattr=' a\:show\ attributes d\:attributes\ digest e\:attributes\ in\ hex' Aattr='-A[restrict attributes by pattern]:attribute pattern: ' fi _arguments -s : \ '-c+[affected since change]:change:_perforce_changes -ts' \ '-e+[affected by change]:change:_perforce_changes -ts' \ '-C[select mapped files (-Rc)]' \ '-F[pick filter for files]:filter:_perforce_fstat_fields -tv' \ '-H[select synced files (-Rh)]' \ '-W[select opened files (-Ro)]' \ '-l[include fileSize, possibly slow (-Ol)]' \ '-m[set max files to show]:max files: ' \ "-O-[select output type]:output type:((f\:all\ revisions l\:fileSize p\:client\ path\ format r\:pending\ integrations s\:exclude\ local\ path$Oattr))" \ '-P[output clientFile in full Perforce syntax (deprecated: use -Op)]' \ '-r[show in reverse order]' \ '-R-[restrict selected files]:restriction:((c\:mapped\ in\ client h\:synced\ to\ client n\:not\ synced\ to\ head o\:opened r\:resolved s\:shelved u\:unresolved))' \ '-s[shorten, no client-related data (deprecated: use -Os)]' \ '-S-[changes sort order]:sort criterion:((t\:filetype d\:date r\:head\ revision h\:have\ revision s\:filesize))' \ '-T[select output fields]:output field:_perforce_fstat_fields' \ $Aattr \ '*::file:_perforce_files' } (( $+functions[_perforce_cmd_grep] )) || _perforce_cmd_grep() { _arguments -s : \ '-a[search all revisions]' \ '-i[case insensitive match]' \ '-n[display matching line]' \ '-v[display file name]' \ '-F[interpret as fixed string]' \ '-G[interpret as regexp (default)]' \ '-L[list non-matching file/revisions]' \ '-l[list matching file/revisions]' \ '-s[suppresses errors on long lines]' \ '-t[treat all files as text]' \ '-A[]:trailing context lines: ' \ '-V[]:leading context lines: ' \ '-C[]:context lines: ' \ '1:-e required before pattern:(-e)' \ '2:pattern: ' \ '*::file:_perforce_files' } (( $+functions[_perforce_cmd_group] )) || _perforce_cmd_group() { _arguments -s : \ '-d[delete group]' \ '-o[output to stdout]' \ '-i[read from stdin]' \ '(-o)-a[allow non-super owner to modify group]' \ '1::perforce group:_perforce_groups' } (( $+functions[_perforce_cmd_groups] )) || _perforce_cmd_groups() { _arguments -s : \ '-i[show indirect membership by subgroups]' \ '-m[set max groups to show]:max groups: ' \ '-v[show summary data]' \ '1::user or group name:_perforce_users_or_groups' } (( $+functions[_perforce_cmd_have] )) || _perforce_cmd_have() { _perforce_files } (( $+functions[_perforce_cmd_help] )) || _perforce_cmd_help() { local hline if (( ! ${#_perforce_help_list} )); then (( ${+_perforce_help_list} )) || typeset -ga _perforce_help_list # All commands have help. (( ${#_perforce_cmd_list} )) || _perforce_gen_cmd_list _perforce_help_list=($_perforce_cmd_list) _perforce_call_p4 help help | while read -A hline; do if [[ $hline[1] = p4 && $hline[2] = help ]]; then _perforce_help_list+=("$hline[3]:${hline[4,-1]}") fi done if [[ -z ${_perforce_help_list[(r)undoc:*]} ]]; then _perforce_help_list+=("undoc:help for otherwise undocumented features") fi fi _describe -t help-options 'Perforce help option' _perforce_help_list } (( $+functions[_perforce_cmd_info] )) || _perforce_cmd_info() { # No arguments _arguments -s : } (( $+functions[_perforce_cmd_integrate] )) || _perforce_cmd_integrate() { local range # If -s is present, the first normal argument can't have revRange. [[ ${words[(I)-s]} -eq 0 ]] && range=" -tR" _arguments -s : \ '-b[select branch]:branch:_perforce_branches' \ '-c[select change for integration]:change:_perforce_changes -tc' \ '-f[force reintegration]' \ '-d[reintegrate deleted files]' \ '-D-[specify allowed deletions]:deletion type:(( t\:rebranch\ on\ deleted\ file s\:delete\ modified\ target\ file i\:ignore\ readded\ source\ file ))' \ '-h[integrate to revision had on client]' \ '-i[integrate if no common file base]' \ '-I[same as -i from 2004.2]' \ '-n[no action, dummy run]' \ '-o[display base file name for subsequent resolve]' \ '-r[reverse direction of integration with branch]' \ '-s[select source with -b]:source file:_perforce_files -tR' \ '-t[propagate type changes]' \ '-v[leave newly branched files uncopied till sync]' \ "1:file:_perforce_files$range" \ '*::file:_perforce_files' } (( $+functions[_perforce_cmd_integ] )) || _perforce_cmd_integ() { _perforce_cmd_integrate "$@" } (( $+functions[_perforce_cmd_integrated] )) || _perforce_cmd_integrated() { _arguments -s : \ '-r[reverse mapping in branch view with -b]' \ '-b[select files integrated via branch]:branch:_perforce_branches' \ '*::file:_perforce_files -ti' } # interchanges is an unsupported but useful command that reports # changes that haven't been integrated between source and target; # see "p4 help undoc". (( $+functions[_perforce_cmd_interchanges] )) || _perforce_cmd_interchanges() { local -a fileargs if [[ ${words[(I)-b*]} -ne 0 ]]; then if [[ ${words[(I)-*s*]} -eq 0 ]]; then # with -b and no -s, all files are to-files (but -s may come later) fileargs=('-s[specify source file]' '*::to file:_perforce_files -tR') else # with -b and -s we have one from-file and any number of to-files fileargs=('1::from file:_perforce_files -tR' '*::to file:_perforce_files') fi else # with no -b we have one from-file and one to-file fileargs=('1::from file:_perforce_files -tR' '2::to file:_perforce_files') fi _arguments -s : \ '-f[show individual files]' \ '-l[long changelist description]' \ '-b[select files integrated via branch]:branch:_perforce_branches' \ '-r[reverse branch mapping]' \ $fileargs } (( $+functions[_perforce_cmd_job] )) || _perforce_cmd_job() { _arguments -s : \ '(-d -o -i)-f[force setting of readonly fields]' \ '(-f -o -i)-d[delete job]' \ '(-f -d -i)-o[print to stdout]' \ '(-d -o)-i[read from stdin]' \ '(-i)1::job:_perforce_jobs' } (( $+functions[_perforce_cmd_jobs] )) || _perforce_cmd_jobs() { _arguments -s : \ '-e[select by jobview]:jobview:_perforce_jobviews' \ '-i[included integrated changes]' \ '-l[long output, full job descriptions]' \ '-r[reverse order of job names]' \ '-m[limit to most recent N jobs]:number of most recent jobs: ' \ '(-e -i -l -m)-R[rebuild jobs table on upgrade]' \ '*::file:_perforce_files -tR' } (( $+functions[_perforce_cmd_jobspec] )) || _perforce_cmd_jobspec() { _arguments -s : \ '-i[read form from stdin]' \ '-o[write form from to stdout]' } (( $+functions[_perforce_cmd_label] )) || _perforce_cmd_label() { _arguments -s : \ '-f[force operation]' \ '-t+[copy template]:template: ' \ '(-o -i -t)-d[delete label]' \ '(-d -f -i)-o[write to standard output]' \ '(-o -d -t)-i[read from standard input]' \ '*::label:_perforce_labels' } (( $+functions[_perforce_cmd_labels] )) || _perforce_cmd_labels() { _arguments -s : \ '-e[limit by wildcard]:label wildcard: ' \ '-m+[set maximum to show]:max labels: ' \ '-t[output time as well as date]' \ '-u+[select by user]:user:_perforce_users' \ '1::file or revisions which must contain label:_perforce_files -tR' } (( $+functions[_perforce_cmd_labelsync] )) || _perforce_cmd_labelsync() { _arguments -s : \ '-a[add files to label]' \ '-d[delete files from label]' \ '-n[no effect, dummy run]' \ '-l[specify label]:label:_perforce_labels' \ '*::file:_perforce_files -tR' } (( $+functions[_perforce_cmd_license] )) || _perforce_cmd_license() { _arguments -s : \ '-o[write license to stdout]' \ '-i[read license from stdin]' } (( $+functions[_perforce_cmd_lock] )) || _perforce_cmd_lock() { _arguments -s : \ '-c[select by change]:change:_perforce_changes -tc' \ '*::file:_perforce_files -to' } (( $+functions[_perforce_cmd_lockstat] )) || _perforce_cmd_lockstat() { _message 'no arguments' } (( $+functions[_perforce_cmd_logger] )) || _perforce_cmd_logger() { _arguments -s : \ '-c[limit by counter no]:number: ' \ '-t[use counter instead of logger]:counter:_perforce_counters' } (( $+functions[_perforce_cmd_login] )) || _perforce_cmd_login() { _arguments -s : \ '-a[ticket valid on all machines]' \ '-p[display ticket, do not store]' \ '-s[show status of ticket]' \ '(-s)1::user:_perforce_users' } (( $+functions[_perforce_cmd_logout] )) || _perforce_cmd_logout() { _arguments -s : \ '-a[invalidate ticket on server]' } (( $+functions[_perforce_cmd_logstat] )) || _perforce_cmd_logstat() { _message 'no arguments' } (( $+functions[_perforce_cmd_logtail] )) || _perforce_cmd_logtail() { _arguments -s : \ '-b[specify block size, default 8192]:block size: ' \ '-s[specify start offset]:offset: ' \ '-m[specify max blocks]:max blocks: ' } (( $+functions[_perforce_cmd_monitor] )) || _perforce_cmd_monitor() { if (( CURRENT > 2 )); then case $words[2] in (show) shift words (( CURRENT-- )) _arguments -s : \ '-a[show command arguments]' \ '-e[show command environment]' \ '-l[long output format]' ;; (terminate) _perforce_pids ;; (clear) _alternative 'pids:pid:_perforce_pids' 'all:all processes:(all)' ;; (*) _message "no such monitor command: $words[1]" ;; esac else local expl _wanted monitor-command expl 'monitor command' compadd show terminate clear fi } (( $+functions[_perforce_cmd_move] )) || _perforce_cmd_move() { _arguments -s : \ '-c[specify new change list]:change:_perforce_changes -tc' \ '-f[force move when already synced]' \ '-k[no resync from server]' \ '-t[specify new file type]:filetype:_perforce_filetypes' \ '-n[show files to move without moving them]' \ '1::source file, wildcards allowed:_perforce_files -to' \ '2::destination file, wildcards match source:_perforce_files' } (( $+functions[_perforce_cmd_obliterate] )) || _perforce_cmd_obliterate() { if [[ ${words[(I)-y]} -gt 0 ]]; then _message \ ": don't complete after -y; run obliterate without, then add the -y" else _arguments -s : \ '-y[actually perform the operation]' \ '*::file:_perforce_files -tR' fi } (( $+functions[_perforce_cmd_opened] )) || _perforce_cmd_opened() { # You might think you could check for files opened on another # client, and hence the -c completion should have the argument # -tp, but currently Perforce doesn't allow that, so -tc is correct. # This is true even if -a is also given. _arguments -s : \ '-a[list for all clients]' \ '-c+[select by change]:change:_perforce_changes -tc' \ '-C[select by client]:client:_perforce_clients' \ '-m[max files to show]:max files: ' \ '-u[select by user]:user name:_perforce_users' \ '*::file:_perforce_files -to' } (( $+functions[_perforce_cmd_passwd] )) || _perforce_cmd_passwd() { _arguments -s : \ '-O[explicit old password]:old password: ' \ '-P[explicit new password]:new password: ' \ '1::user name:_perforce_users' } (( $+functions[_perforce_cmd_print] )) || _perforce_cmd_print() { _arguments -s : \ '-a[display all revisions in a range]' \ '-o[select output file]:output file:_files' \ '-q[suppress header]' \ '*::file:_perforce_files -tR' } (( $+functions[_perforce_cmd_protect] )) || _perforce_cmd_protect() { _arguments -s : \ '-o[write spec to stdout]' \ '-i[read spec from stdin]' } (( $+functions[_perforce_cmd_protects] )) || _perforce_cmd_protects() { _arguments -s : \ '(-g -u)-a[show for all users]' \ '(-a -u)-g[select by group]:perforce group:_perforce_groups' \ '(-a -g)-u[select by user]:perforce user:_perforce_users' \ '-h[limit to host]:host:_perforce_hosts' \ '-m[single word summary]' \ '*:file:_perforce_files' } (( $+functions[_perforce_cmd_reopen] )) || _perforce_cmd_reopen() { _arguments -s : \ '-c+[select change to reopen on]:change:_perforce_changes -tc' \ '-t+[set file type]:file type:_perforce_filetypes' \ '*::file:_perforce_files -to' } (( $+functions[_perforce_cmd_replicate] )) || _perforce_cmd_replicate() { _arguments -s : \ '-i[specify interval in seconds]:interval: ' \ '-j[specify journal number (/ position)]:journal number: ' \ '-J[specify file prefix]:file prefix: ' \ '-k[keep pipe open]' \ '-o[specify output file]:output file:_files' \ '-s[specify file to track state]:state file:_files' \ '-x[terminate when journal rotates]' \ '*::->_command' } (( $+functions[_perforce_cmd_resolve] )) || _perforce_cmd_resolve() { _arguments -s : \ '-a-[select automatic merge type]:automation type:((f\:force\ acceptance m\:skip\ conflicts s\:safe t\:use\ theirs y\:use\ yours))' \ '-d-[select diff option]:diff option:((b\:ignore\ blanks w\:ignore\ all\ whitespace))' \ '-f[force re-resolution]' \ '-n[no action, just list]' \ '-o[display base file name and revision for merge]' \ '-t[force textual merge on binary files]' \ '-v[verbose, mark all changes]' \ '*::file:_perforce_files -to' } (( $+functions[_perforce_cmd_resolved] )) || _perforce_cmd_resolved() { _arguments -s : \ '-o[report revision used as base for resolve]' \ '*::file:_perforce_files -tr' } (( $+functions[_perforce_cmd_revert] )) || _perforce_cmd_revert() { _arguments -s : \ '-a[revert unaltered files]' \ '-c[limit reversions to change]:change:_perforce_changes -tc' \ '-k[bypass client refresh]' \ '-n[no action, show effect only]' \ '*::file:_perforce_files -to' } (( $+functions[_perforce_cmd_review] )) || _perforce_cmd_review() { _arguments -s : \ '-c[select change for counter]:change:_perforce_changes -ts' \ '-t[limit change number by counter]:counter:_perforce_counters' } (( $+functions[_perforce_cmd_reviews] )) || _perforce_cmd_reviews() { _arguments -s : \ '-c[show users by change]:change:_perforce_changes -ts' \ '*::file:_perforce_files' } (( $+functions[_perforce_cmd_set] )) || _perforce_cmd_set() { # Only works under Windoze but maybe we are on Cygwin. _arguments -s : \ '-s[set for whole system]' \ '-S[set for specified service]:service: ' \ "*::environment variable:_perforce_variables" } (( $+functions[_perforce_cmd_shelve] )) || _perforce_cmd_shelve() { _arguments -s : \ '(-i)-c[specify changlist if not default]:change:_perforce_changes -tc' \ '(-i -r)-d[delete shelved files]' \ '(-r)-f[force by admin user or force to overwrite]' \ '(-c)-i[read from standard input]' \ '(-d)-r[replace shelved files in changelist]' \ '(-i -r)*::file:_perforce_files -to' } (( $+functions[_perforce_cmd_sizes] )) || _perforce_cmd_sizes() { _arguments -s : \ '-a[show for all revisions]' \ '-b[set blocksize]:blocksize in bytes: ' \ '-s[sum the file sizes]' \ '-S[show sizes of shelved files]' \ '*:file:_perforce_files -tR' } (( $+functions[_perforce_cmd_spec] )) || _perforce_cmd_spec() { _arguments -s : \ '-d[delete a custom spec]' \ '-i[read spec from stdin]' \ '-o[write spec to stdout]' \ "*::spec type:(branch change client depot group job label spec trigger typemap user)" } (( $+functions[_perforce_cmd_submit] )) || _perforce_cmd_submit() { _arguments -s : \ '-r[files open for add or edit remain open]' \ '-s[include fix status in list]' \ '-f[override submit option]:submit option:_perforce_submit_options' \ '(-s -i)-c[submit specific change]:change:_perforce_changes -tc' \ '(-s -c)-d[specify description on command line]:description: ' \ '(-c)-i[read change spec from stdin]' \ '*::file:_perforce_files -to -tr' } (( $+functions[_perforce_cmd_sync] )) || _perforce_cmd_sync() { _arguments -s : \ '-f[force resynchronisation]' \ '-n[show operations but don'\''t perform them]' \ '-k[bypass client file update]' \ '*::file:_perforce_files -tR' } (( $+functions[_perforce_cmd_tag] )) || _perforce_cmd_tag() { _arguments -s : \ '-d[delete association between label and files]' \ '-n[show what files would be tagged]' \ '-l[specify label]:label:_perforce_labels' \ '*::file:_perforce_files -tR' } (( $+functions[_perforce_cmd_tickets] )) || _perforce_cmd_tickets() { # No arguments. _arguments -s : } (( $+functions[_perforce_cmd_triggers] )) || _perforce_cmd_triggers() { _arguments -s : \ '-o[output form to stdout]' \ '-i[read from from stdin]' } (( $+functions[_perforce_cmd_typemap] )) || _perforce_cmd_typemap() { _arguments -s : \ '-o[output table to stdout]' \ '-i[read table from stdin]' } (( $+functions[_perforce_cmd_unlock] )) || _perforce_cmd_unlock() { _arguments -s : \ '-c[non-default change to unlock]:change:_perforce_changes -tc' \ '-f[allow superuser to unlock any file]' \ '*::file:_perforce_files' } (( $+functions[_perforce_cmd_unshelve] )) || _perforce_cmd_unshelve() { _arguments -s : \ '-s[specify shelving change]:change:_perforce_changes -tS' \ '-c[specify change for unshelve]:change:_perforce_changes -tc' \ '-f[force clobbering of writeable files]' \ '-n[preview unshelve]' \ '*::file, pattern allowed:_perforce_files' } (( $+functions[_perforce_cmd_user] )) || _perforce_cmd_user() { _arguments -s : \ '(-o)-f[force edit by superuser]' \ '(-o -i)-d[delete user]' \ '(-o -d)-i[read form from stdin]' \ '(-f -i -d)-o[write form to stdout]' \ '(-i)1::username:_perforce_users' } (( $+functions[_perforce_cmd_users] )) || _perforce_cmd_users() { _arguments -s : \ '-m[set max users to show]:max users: ' \ '*::username:_perforce_users' } (( $+functions[_perforce_cmd_verify] )) || _perforce_cmd_verify() { _arguments -s : \ '-m[limit revisions]:max revisions: ' \ '-q[operate quietly]' \ '-u[compute and save digest if missing]' \ '-v[compute and save all digets]' \ '-z[skip duplicates]' \ '*::file:_perforce_files -tR' } (( $+functions[_perforce_cmd_where] )) || _perforce_cmd_where() { _perforce_files } (( $+functions[_perforce_cmd_workspace] )) || _perforce_cmd_workspace() { _perforce_cmd_client "$@" } (( $+functions[_perforce_cmd_workspaces] )) || _perforce_cmd_workspaces() { _perforce_cmd_clients "$@" } _perforce "$@" PK[+ȇfunctions/_ptreenuW+A#compdef ptree _ptree() { local curcontext="$curcontext" context state line ret=1 typeset -A opt_args _arguments -s \ '-a[all processes]' \ '-c[show contract memberships]' \ '-z[show processes in zone]:zone:($(zoneadm list))' \ '*:pid or user:->pidoruser' && ret=0 if [[ $ret -ne 0 ]]; then _alternative \ 'users:logged-in user:compadd ${$(who -q)\:#(users=*|\#)}' \ 'pids:pid:_pids' ret=$? fi return $ret } _ptree "$@" PK[++functions/_unhashnuW+A#compdef unhash local expl state line curcontext="$curcontext" _arguments -C -s -S \ '(-a -f -s *)-d[remove named directories]:*:named directory:->nameddir' \ '(-d -f -s *)-a[remove aliases]:*:alias:_aliases' \ '(-a -d -f *)-s[remove suffix aliases]:*:suffix alias:_aliases -s s' \ '(-d -a -s *)-f[remove functions]:*:shell function:_functions' \ '-m[treat arguments as patterns]' \ '(-a -d -f -m)*:command: _command_names -e' && return 0 [[ "$state" = nameddir ]] && _wanted named-directories expl 'named directory' compadd -k nameddirs PK[;ffunctions/_globflagsnuW+A#autoload local ret=1 local -a flags if compset -P a; then _message -e numbers 'errors' return elif compset -P q; then _globquals return fi flags=( 'i:case insensitive' 'l:lower case characters match uppercase' 'I:case sensitive matching' 's:match start of string' 'e:match end of string' ) [[ $compstate[context] = condition ]] && flags+=( 'b:activate backreferences' 'B:deactivate backreferences' 'm:set reference to entire matched data' 'M:deactivate m flag' ) _describe -t globflags "glob flag" flags -Q -S ')' && ret=0 flags=( 'a:approximate matching' 'q:introduce glob qualifier' ) _describe -t globflags "glob flag" flags -Q -S '' && ret=0 return ret PK[ l l functions/_sambanuW+A#compdef smbcontrol smbclient nmblookup smbstatus local expl msgs args case $service in smbcontrol) case $CURRENT in 3) msgs=( debug ping profile debuglevel profilelevel ) case $words[CURRENT-1] in nmbd) msgs=( $msgs force-election ) ;; smbd) msgs=( $msgs printer-notify ) ;; -i) return 1 ;; esac _wanted message-type expl 'message types' compadd -a msgs ;; 4) case $words[CURRENT-1] in profile) _wanted parameter expl 'parameter' compadd on off flush count ;; debug) _message -e levels 'debug level' ;; ping) _message -e numbers 'number of ping messages' ;; esac ;; *) _arguments \ '-i[run interactively]' \ ':destination:(nmbd smbd)' ;; esac ;; smbclient) args=( '(-N -A)2:password' '(2)-s+[specify location of smb.conf]:smb.conf location:_files' '(2)-O+[specify socket options]:socket options' '(2)-R+[specify name resolution order]:name resolution order:_values -s " " "name resolution order" lmhosts host wins bcast' '(2 -L -D -T)-M+[send message]:host:_hosts' '(2)-i+[specify NetBIOS scope]:scope' '(2)-N[suppress password prompt]' '(2)-n+[specify local NetBIOS name]:local machine name' '(2)-d+[specify debug level]:debug level:(0 1 2 3 4 5 6 7 8 9 10)' '(2)-p+[specify tcp port]:tcp port' '(2)-l+[specify base log filename]:base log filename' '(2)-I+[specify IP address of server]:IP address' '(2)-E[output messages to stderr]' '(2)-U+[specify username]:username:_users' '(2)-A+[specify file containing username/password]:file:_files' '(2 -M -D -T)-L+[list services on server]:host:_hosts' '(2)-t+[specify terminal code]:terminal code' '(2)-b+[specify buffersize]:transmit/send buffer size (bytes)' '(2)-W+[specify workgroup]:workgroup' '(2 -M -L)-T+[specify tar options]:tar options' '(2 -M -L)-D+[initial directory]:initial directory' '(2)-c[specify commands]:command string' ) if (( CURRENT == 2 )); then args=( $args '1:service name:_hosts -P // -S /' '(-s -O -R -M -i -N -n -d -p -l -I -E -U -A -L -t -b -W -T -D -c)-h[display usage information]' ) fi _arguments -s "$args[@]" ;; nmblookup) _arguments -s -A "-*" \ '(-h)-R[set recursion desired in packet]' \ '(-h)-M[search for a master browser]' \ '(-h)-S[lookup node status as well]' \ '(-h)-T[perform reverse DNS on IP addresses]' \ '(-h)-r[use root port 137]' \ '(-h)-A[query node status on IP address]' \ '(-R -M -S -T -r -A -B -U -d -s -i *)-h[print help message]' \ '(-h)-B+[specify broadcast address]:broadcast address' \ '(-h)-U+[specify unicast address]:unicast address' \ '(-h)-d+[specify debug level]:debug level:(0 1 2 3 4 5 6 7 8 9 10)' \ '(-h)-s+[specify location of smb.conf]:smb.conf location:_files' \ '(-h)-i+[specify NetBIOS scope]:scope' \ '(-h)*:NetBIOS name:_hosts' ;; smbstatus) args='(-b -d -L -p -S)' _arguments -s \ "$args-b[brief output]" \ "$args-d[detailed output]" \ "$args-L[list only locks]" \ "$args-p[list smbd(8) processes]" \ "$args-S[list only shares]" \ '-s+[specify location of smb.conf]:smb.conf location:_files' \ '-u+[specify user to restrict information to]:user:_users' ;; esac PK[functions/tcp_pointnuW+Aemulate -L zsh setopt extendedglob cbases if [[ $# -ne 1 ]]; then print "Usage: $0 port Listen on the given port; send anything that arrives to standard output." >&2 return 1 fi local REPLY lfd afd if ! ztcp -l $1; then print "Failed to listen on port $1" >&2 return 1 fi lfd=$REPLY if ! ztcp -a $lfd; then print "Failed to accept on fd $lfd" >&2 ztcp -c $lfd fi afd=$REPLY cat <&$afd ztcp -c $lfd ztcp -c $afd PK[ 0Ӿfunctions/_unsetoptnuW+A#compdef unsetopt # If you first want to complete only unset options, uncomment the lines # setting the _options_set array and then use: # # _options_set || _options # # here. _options PK[%GGfunctions/_tcptraceroutenuW+A#compdef tcptraceroute _arguments \ '-n[no reverse lookups]' \ '-N[always reverse lookup]' \ '-f:first ttl:' \ '-m:maximum ttl:' \ '-p:local tcp port:_ports' \ '-s:source address:_hosts' \ '-i:interface for outgoing packets:_net_interfaces' \ '-q:number of probes to each hop:' \ '-w:timeout in seconds:' \ '-S[set TCP SYN flag]' \ '-A[set TCP ACK flag]' \ '-E[send ECN SYN packets]' \ '-t:IP TOS:' \ '-F[set IP don'"'"'t fragment bit]' \ '-l:total packet length:' \ '-d[enable debugging]' \ ':destination:_hosts' \ ':port:_ports' \ ':length:' PK[rȬ[[functions/_javanuW+A#compdef javac java javadoc appletviewer jar jdb javah javap extcheck rmic rmiregistry rmid serialver native2ascii keytool jarsigner policytool local expl tmp jdb_args jar_cmd match basedir ret=1 local curcontext="$curcontext" state line jf typeset -A opt_args tmpassoc jdb_args=() case "$service" in javac) _arguments -C \ '-g-[generate debugging information]:debug:->debug' \ '-nowarn[generate no warnings]' \ '-verbose[output messages about what the compiler is doing]' \ '-deprecation[output source locations where deprecated APIs are used]' \ '-classpath[specify where to find user class files]:class path:->classpath' \ '-sourcepath[specify where to find input source files]:source path:->sourcepath' \ '-bootclasspath[override location of bootstrap class files]:bootstrap class path:->bootstrapclasspath' \ '-extdirs[override location of installed extensions]:extensions directories:->extdirs' \ '-d[specify where to place generated class files]:directory:_files -/' \ '-encoding[specify character encoding used by source files]:encoding:->encoding' \ '-source[provide source compatibility with specified release]:release:(1.{2..5})' \ '-target[specify VM version]:release:(1.{1..5})' \ '-help[print a synopsis of standard options]' \ '*:java source file:_files -g \*.java\(-.\)' && return 0 ;; jdb) jdb_args=( '-host[specify host to connect to]:host:_hosts' '-password[specify password]:password:' ) ;& java) _arguments -C \ "$jdb_args[@]" \ '(-cp -classpath)'{-cp,-classpath}'[specify path for user class files]:class path:->classpath' \ '-D-[specify a property]:property:->property' \ '(-verbose:class)-verbose[print class information]' \ '(-verbose)-verbose\:class[print class information]' \ '-verbose\:gc[print gc information]' \ '-verbose\:jni[print JNI information]' \ '-version[print version]' \ '-help[print help message]' \ '(- 1)-jar[specify a program capsulated as jar]:jar:_files -g \*.jar\(-.\)' \ '(-):class:_java_class -m main ${(kv)opt_args[(i)(-classpath|-cp)]}' \ '*::args: _normal' \ && return 0 ;; javadoc) _arguments -C \ '-overview[specify overview file]:_files' \ '-public[display public classes and members only]' \ '-protected[display public/protected classes and members only (default)]' \ '-package[display packages, public/protected classes and members only]' \ '-private[display all classes and members]' \ '-help[print help message]' \ '-doclet[specify a doclet]:doclet:_java_class -t doclet ${(kv)opt_args[(i)-classpath]}' \ '-docletpath[specify a path to search doclet]:doclet path:->docletpath' \ '-1.1[Javadoc 1.1 compatible output]' \ '-sourcepath[specify path for source files]:source path:->sourcepath' \ '-classpath[specify path for user class files]:class path:->classpath' \ '-bootclasspath[specify path for bootstrap class files]:bootstrap class path:->bootstrapclasspath' \ '-extdirs[specify directories for extensions]:extensions directories:->extdirs' \ '-verbose[print verbose messages]' \ '-locale[specify locale]:language_country_variant:' \ '-encoding[specify character encoding for source files]:encoding:->encoding' \ '-J-[specify java option]:java option:' \ '-d[specify destination directory]:destination directory:_files -/' \ '-use[display pages for use]' \ '-version[include @version text]' \ '-author[include @author text]' \ '-splitindex[split index file for each alphabet]' \ '-windowtitle[specify HTML title element]:title element:' \ '-doctitle[specify title]:document title:' \ '-header[specify header text]:header text:' \ '-footer[specify footer text]:footer text:' \ '-bottom[specify bottom text]:bottom text:' \ '-link[generate a link to external reference classes]:document URL:' \ '-linkoffline[generate a link for external reference class names]:document URL::package list URL:' \ '-group[generate tables for each groupes]:group heading::package patterns:' \ '-nodeprecated[do not document deprecated API]' \ '-nodeprecatedlist[do not generate deprecated API list]' \ '-notree[do not generate class and interface hierarchy]' \ '-noindex[do not generate index]' \ '-nohelp[do not generate help link]' \ '-nonavbar[do not generate navigation bar]' \ '-helpfile[specify alternative help link]:helpfile path/filename:' \ '-stylesheet[specify alternative HTML style sheet]:stylesheet path/filename:' \ '-docencoding[specify character encoding for output HTML files]:encoding:->encoding' \ '*:package name, source file or @list:->docsrc' && ret=0 ;; appletviewer) _arguments -C \ '-debug[run applet on jdb]' \ '-encoding[specify character encoding for source files]:encoding:->encoding' \ '-J-[specify java option]:java option:' \ '*:URL:_urls' && return 0 ;; jar) if (( CURRENT == 2 )); then compset -P - _values -s '' 'jar command' \ '( t x u)c[create new archive]' \ '(c x u)t[list the table of archive]' \ '(c t u)x[extract files from archive]' \ '(c t x )u[update archive]' \ 'f[specify archive file]' \ 'v[verbose mode]' \ 'm[specify manifest file]' \ '0[store only without using ZIP compression]' \ 'M[do not create manifest file]' && return else jar_cmd="${words[2]#-}" tmpassoc=( m ':manifest file:_files' f ':archive file:_files -g "*.([ejw]ar|zip)(-.)"' ) _arguments -C \ "${jar_cmd/[^-]*/:dummy:}" \ ${${(s::)jar_cmd}/(#b)(?)/$tmpassoc[$match[1]]} \ '*:file:->jararg' && return 0 fi ;; javah|javah_g) _arguments -C \ '-o[specify output file]:output file:_files' \ '-d[specify destination directory]:directory:_files -/' \ '-stubs[generate stubs]' \ '-verbose[print verbose messages]' \ '-help[print help message]' \ '-version[print version]' \ '-jni[JNI-style native method function prototypes]' \ '-classpath[specify path for user class files]:class path:->classpath' \ '-bootclasspath[specify path for bootstrap class files]:bootstrap class path:->bootstrapclasspath' \ '-old[generate old JDK1.0-style header files]' \ '-force[force output]' \ '*:class:_java_class -m main ${(kv)opt_args[(i)-classpath]}' && return 0 ;; javap) _arguments -C \ '-help[print help message]' \ '-l[line and local variable tables]' \ '-b[backward compatible to JDK1.1]' \ '-public[only public classes and members]' \ '-protected[only protected and public classes and members]' \ '-package[only package, protected and public classes and members (default)]' \ '-private[all classes and members]' \ '-J-[specify java option]:java option:' \ '-s[internal type signatures]' \ '-c[disassemble code]' \ '-verbose[stack size, number of locals and args for methods]' \ '-classpath[specify path for user class files]:class path:->classpath' \ '-bootclasspath[specify path for bootstrap class files]:bootstrap class path:->bootstrapclasspath' \ '-extdirs[specify directories for extensions]:extensions directories:->extdirs' \ '*:class:_java_class ${(kv)opt_args[(i)-classpath]}' && return 0 ;; extcheck) _arguments \ '-verbose[print verbose messages]' \ ':target jar file:_files -g \*.jar\(-.\)' && return 0 ;; rmic) _arguments -C \ '-classpath[specify path for user class files]:class path:->classpath' \ '-d[specify destination directory]:directory:_files -/' \ '-depend[treat dependencies]' \ '-g[enable debugging]' \ '-J-[specify java option]:java option:' \ '-keepgenerated[retain generated source files]' \ '-nowarn[disable warnings]' \ '-show[GUI mode]' \ '-vcompat[compatible with JDK 1.1 and 1.2 (default)]' \ '-verbose[print verbose messages]' \ '-v1.1[JDK 1.1 stub protocol]' \ '-v1.2[JDK 1.2 stub protocol]' \ '*:package qualified class name:_java_class ${(kv)opt_args[(i)-classpath]}' && return 0 ;; rmiregistry) if (( CURRENT == 2 )); then _wanted ports expl 'port to listen on' _ports && return else _message 'no more arguments' fi ;; rmid) _arguments \ '-C-[specify command line argument for child process]:command line argument for child process:' \ '-log[specify log directory]:directory to place logs:_files -/' \ '-port[specify port]:port:_ports' \ '-stop[stop rmid]:' && return 0 ;; serialver) _arguments \ '-classpath[specify where to find user class files]:class path:->classpath' \ '(*)-show[display user interface]' \ '(-show)*:class:_java_class ${(kv)opt_args[(i)-classpath]}' && return 0 ;; native2ascii) _arguments -C \ '-reverse[convert Latin-1 (with \udddd) to native encoding]' \ '-encoding[specify character encoding]:encoding:->encoding' \ ':input file:_files' \ ':output file:_files' && return 0 ;; keytool) _arguments \ '-J-[specify java option]:java option:' \ - genkey \ '-genkey[command to generate a key pair]' \ '-alias[alias]:alias:' \ '-keyalg[key algorithm]:key algorithm:' \ '-keysize[key size]:key size:' \ '-sigalg[signature algorithm]:signature algorithm:' \ '-dname[X.500 distinguish name]:X.500 distinguish name:' \ '-keypass[password for private key]:password for private key:' \ '-validity[valid days]:number of days:' \ '-storetype[keystore type]:store type:' \ '-keystore[keystore location]:keystore location:' \ '-storepass[password for keystore]:password:' \ '-v[verbose mode]' \ - import \ '-import[command to import certificate or certificate chain]' \ '-alias[alias]:alias:' \ '-file[specify certificate file]:certificate file:_files' \ '-keypass[password for private key]:password for private key:' \ '-noprompt[disable interaction with the user]' \ '-trustcacerts[use cacerts]' \ '-storetype[keystore type]:store type:' \ '-keystore[keystore location]:keystore location:' \ '-storepass[password for keystore]:password:' \ '-v[verbose mode]' \ - selfcert \ '-selfcert[command to generate X.509 v1 self-signed certificate]' \ '-alias[alias]:alias:' \ '-sigalg[signature algorithm]:signature algorithm:' \ '-dname[X.500 distinguish name]:X.500 distinguish name:' \ '-validity[valid days]:number of days:' \ '-keypass[password for private key]:password for private key:' \ '-storetype[keystore type]:store type:' \ '-keystore[keystore location]:keystore location:' \ '-storepass[password for keystore]:password:' \ '-v[verbose mode]' \ - identitydb \ '-identitydb[command to read identity database]' \ '-file[specify identity database file]:identity database file:_files' \ '-storetype[keystore type]:store type:' \ '-keystore[keystore location]:keystore location:' \ '-storepass[password for keystore]:password:' \ '-v[verbose mode]' \ - certreq \ '-certreq[command to generate certificate signing request]' \ '-alias[alias]:alias:' \ '-sigalg[signature algorithm]:signature algorithm:' \ '-file[specify certificate signing request file]:certificate signing request file:_files' \ '-keypass[password for private key]:password for private key:' \ '-storetype[keystore type]:store type:' \ '-keystore[keystore location]:keystore location:' \ '-storepass[password for keystore]:password:' \ '-v[verbose mode]' \ - export \ '-export[command to store certificate]' \ '-alias[alias]:alias:' \ '-file[specify certificate file]:certificate file:_files' \ '-rfc[make certificate format printable as RFC 1421]' \ '-storetype[keystore type]:store type:' \ '-keystore[keystore location]:keystore location:' \ '-storepass[password for keystore]:password:' \ '-v[verbose mode]' \ - list \ '-list[command to print keystore entry]' \ '-alias[alias]:alias:' \ '-storetype[keystore type]:store type:' \ '-keystore[keystore location]:keystore location:' \ '-storepass[password for keystore]:password:' \ '(-rfc)-v[make certificate format human-readable]' \ '(-v)-rfc[make certificate format printable as RFC 1421]' \ - printcert \ '-printcert[command to print certificate in a human-readable format]' \ '-file[specify certificate file]:certificate file:_files' \ '-v[verbose mode]' \ - keyclone \ '-keyclone[command to create new keystore entry]' \ '-alias[alias]:alias:' \ '-dest[destination alias]:destination alias:' \ '-keypass[password for private key]:password for private key:' \ '-new[password for private key of new entry]:password for private key of new entry:' \ '-storetype[keystore type]:store type:' \ '-keystore[keystore location]:keystore location:' \ '-storepass[password for keystore]:password:' \ '-v[verbose mode]' \ - storepasswd \ '-storepasswd[command to change password for keystore]' \ '-new[new password]:new password:' \ '-storetype[keystore type]:store type:' \ '-keystore[keystore location]:keystore location:' \ '-storepass[password for keystore]:password:' \ '-v[verbose mode]' \ - keypasswd \ '-keypasswd[command to change password for private key]' \ '-alias[alias]:alias:' \ '-keypass[old password for private key]:old password for private key:' \ '-new[nwe password for private key]:new password for private key:' \ '-storetype[keystore type]:store type:' \ '-keystore[keystore location]:keystore location:' \ '-storepass[password for keystore]:password:' \ '-v[verbose mode]' \ - delete \ '-delete[command to delete entry]' \ '-alias[alias]:alias:' \ '-storetype[keystore type]:store type:' \ '-keystore[keystore location]:keystore location:' \ '-storepass[password for keystore]:password:' \ '-v[verbose mode]' \ - help \ '(-J)-help[command to print help message]' && return 0 ;; jarsigner) _arguments \ '-keystore[specify URL for keystore location]:URL for keystore location:' \ '-storetype[specify keystore type]:store type:' \ '-storepass[specify password for keystore]:password:' \ '-keypass[specify password for private key]:password:' \ '-sigfile[specify base file name of .SF and .DSA files to be generated]:sigfile:_files' \ '-signedjar[specify signed JAR file]:_files -g "*.(jar|zip)(-.)"' \ '(2)-verify[verify mode]' \ '-certs[output certificate information in verify mode]' \ '-verbose[print verbose messages]' \ '-internalsf[old behaviour]' \ '-sectionsonly[omit header of hash of the whole manifest file]' \ '-J-[specify java option]:java option:' \ ':jar file:_files -g "*.(jar|zip)(-.)"' \ ':alias:' && return 0 ;; policytool) _arguments \ '-file:policy file:_files' && return 0 ;; *) _message 'unknown command' ;; esac [[ -n "$state" ]] && case "$state" in debug) if [[ -prefix :*, ]]; then compset -P : _values -s , "debug info" lines vars source && return else _description debuginfo expl "debug info" compadd -P: "$expl[@]" none && ret=0 compadd -P: -qS, "$expl[@]" lines vars source && ret=0 fi ;; classpath|sourcepath|bootstrapclasspath|docletpath) compset -P '*:' compset -S ':*' _alternative \ "classpath:$state:_path_files -qS: -g '*.(jar|zip)(-.)'" \ "classpath:$state:_path_files -r': ' -/" && return ;; extdirs) compset -P '*:' _path_files -/ && return ;; encoding) tmp=( 'US-ASCII:American Standard Code for Information Interchange' 'Cp1252:Windows Latin-1' 'ISO-8859-1:ISO 8859-1, Latin alphabet No. 1 ' 'ISO-8859-15:Latin alphabet No. 9 ' 'UTF-8:Eight-bit UCS Transformation Format' 'UTF-16:Sixteen-bit UCS Transformation Format, byte order identified by an' 'UTF-16BE:Sixteen-bit UCS Transformation Format, big-endian byte order ' 'UTF-16LE:Sixteen-bit UCS Transformation Format, little-endian byte order ' 'ASCII:American Standard Code for Information Interchange' 'ISO8859_1:ISO 8859-1, Latin alphabet No. 1' 'UnicodeBig:Sixteen-bit Unicode Transformation Format, big-endian' 'UnicodeBigUnmarked:Sixteen-bit Unicode Transformation Format, big-endian' 'UnicodeLittle:Sixteen-bit Unicode Transformation Format, little-endian' 'UnicodeLittleUnmarked:Sixteen-bit Unicode Transformation Format, little-endian' 'UTF8:Eight-bit Unicode Transformation Format' 'UTF-16:Sixteen-bit Unicode Transformation Format, byte order' 'Big5:Big5, Traditional Chinese' 'Big5_HKSCS:Big5 with Hong Kong extensions, Traditional Chinese' 'Big5_Solaris:Big5 with seven additional Hanzi ideograph character mappings ' 'Cp037:USA, Canada (Bilingual, French), Netherlands, Portugal, Brazil, Australia' 'Cp273:IBM Austria, Germany' 'Cp277:IBM Denmark, Norway' 'Cp278:IBM Finland, Sweden' 'Cp280:IBM Italy' 'Cp284:IBM Catalan/Spain, Spanish Latin America' 'Cp285:IBM United Kingdom, Ireland' 'Cp297:IBM France' 'Cp420:IBM Arabic' 'Cp424:IBM Hebrew' 'Cp437:MS-DOS United States, Australia, New Zealand, South Africa' 'Cp500:EBCDIC 500V1' 'Cp737:PC Greek' 'Cp775:PC Baltic' 'Cp838:IBM Thailand extended SBCS' 'Cp850:MS-DOS Latin-1' 'Cp852:MS-DOS Latin-2' 'Cp855:IBM Cyrillic' 'Cp856:IBM Hebrew' 'Cp857:IBM Turkish' 'Cp858:Variant of Cp850 with Euro character' 'Cp860:MS-DOS Portuguese' 'Cp861:MS-DOS Icelandic' 'Cp862:PC Hebrew' 'Cp863:MS-DOS Canadian French' 'Cp864:PC Arabic' 'Cp865:MS-DOS Nordic' 'Cp866:MS-DOS Russian' 'Cp868:MS-DOS Pakistan' 'Cp869:IBM Modern Greek' 'Cp870:IBM Multilingual Latin-2' 'Cp871:IBM Iceland' 'Cp874:IBM Thai' 'Cp875:IBM Greek' 'Cp918:IBM Pakistan (Urdu)' 'Cp921:IBM Latvia, Lithuania (AIX, DOS)' 'Cp922:IBM Estonia (AIX, DOS)' 'Cp930:Japanese Katakana-Kanji mixed with 4370 UDC, superset of 5026' 'Cp933:Korean Mixed with 1880 UDC, superset of 5029' 'Cp935:Simplified Chinese Host mixed with 1880 UDC, superset of 5031' 'Cp937:Traditional Chinese Host miexed with 6204 UDC, superset 5033' 'Cp939:Japanese Latin Kanji mixed with 4370 UDC, superset of 5035' 'Cp942:IBM OS/2 Japanese, superset of Cp932' 'Cp942C:Variant of Cp942' 'Cp943:IBM OS/2 Japanese, superset of Cp932 and Shift-JIS' 'Cp943C:Variant of Cp943' 'Cp948:OS/2 Chinese (Taiwan) superset of 938' 'Cp949:PC Korean' 'Cp949C:Variant of Cp949' 'Cp950:PC Chinese (Hong Kong, Taiwan)' 'Cp964:AIX Chinese (Taiwan)' 'Cp970:AIX Korean' 'Cp1006:IBM AIX Pakistan (Urdu)' 'Cp1025:IBM Multilingual Cyrillic (Bulgaria, Bosnia)' 'Cp1025:IBM Multilingual Cyrillic - Bulgaria, Bosnia, Herzegovinia, Macedonia (FYR)' 'Cp1026:IBM Latin-5, Turkey' 'Cp1046:IBM Arabic - Windows' 'Cp1097:IBM Iran (Farsi)/Persian' 'Cp1098:IBM Iran (Farsi)/Persian (PC)' 'Cp1112:IBM Latvia, Lithuania' 'Cp1122:IBM Estonia' 'Cp1123:IBM Ukraine' 'Cp1124:IBM AIX Ukraine' 'Cp1140:Variant of Cp037 with Euro character' 'Cp1141:Variant of Cp273 with Euro character' 'Cp1142:Variant of Cp277 with Euro character' 'Cp1143:Variant of Cp278 with Euro character' 'Cp1144:Variant of Cp280 with Euro character' 'Cp1145:Variant of Cp284 with Euro character' 'Cp1146:Variant of Cp285 with Euro character' 'Cp1147:Variant of Cp297 with Euro character' 'Cp1148:Variant of Cp500 with Euro character' 'Cp1149:Variant of Cp871 with Euro character' 'Cp1250:Windows Eastern European' 'Cp1251:Windows Cyrillic' 'Cp1253:Windows Greek' 'Cp1254:Windows Turkish' 'Cp1255:Windows Hebrew' 'Cp1256:Windows Arabic' 'Cp1257:Windows Baltic' 'Cp1258:Windows Vietnamese' "Cp1381:IBM OS/2, DOS People's Republic of China (PRC)" "Cp1383:IBM AIX People's Republic of China (PRC)" 'Cp33722:IBM-eucJP - Japanese (superset of 5050)' 'EUC_CN:GB2312, EUC encoding, Simplified Chinese' 'EUC_JP:JIS X 0201, 0208, 0212, EUC encoding, Japanese' 'EUC_KR:KS C 5601, EUC encoding, Korean' 'EUC_TW:CNS11643 (Plane 1-3), EUC encoding, Traditional Chinese' 'GB18030:Simplified Chinese, PRC standard' 'GBK:GBK, Simplified Chinese' 'ISCII91:ISCII91 encoding of Indic scripts' 'ISO2022CN:ISO 2022 CN, Chinese (conversion to Unicode only)' 'ISO2022CN_CNS:CNS 11643 in ISO 2022 CN form, Traditional Chinese' 'ISO2022CN_GB:GB 2312 in ISO 2022 CN form, Simplified Chinese' 'ISO2022JP:JIS X 0201, 0208 in ISO 2022 form, Japanese' 'ISO2022KR:ISO 2022 KR, Korean' 'ISO8859_2:ISO 8859-2, Latin alphabet No. 2' 'ISO8859_3:ISO 8859-3, Latin alphabet No. 3' 'ISO8859_4:ISO 8859-4, Latin alphabet No. 4' 'ISO8859_5:ISO 8859-5, Latin/Cyrillic alphabet' 'ISO8859_6:ISO 8859-6, Latin/Arabic alphabet' 'ISO8859_7:ISO 8859-7, Latin/Greek alphabet' 'ISO8859_8:ISO 8859-8, Latin/Hebrew alphabet' 'ISO8859_9:ISO 8859-9, Latin alphabet No. 5' 'ISO8859_13:ISO 8859-13, Latin alphabet No. 7' 'ISO8859_15:ISO 8859-15, Latin alphabet No. 9' 'JIS0201:JIS X 0201, Japanese' 'JIS0208:JIS X 0208, Japanese' 'JIS0212:JIS X 0212, Japanese' 'JISAutoDetect:Detects and converts from Shift-JIS, EUC-JP, ISO 2022 JP' 'Johab:Johab, Korean' 'KOI8_R:KOI8-R, Russian' 'MS874:Windows Thai' 'MS932:Windows Japanese' 'MS936:Windows Simplified Chinese' 'MS949:Windows Korean' 'MS950:Windows Traditional Chinese' 'MacArabic:Macintosh Arabic' 'MacCentralEurope:Macintosh Latin-2' 'MacCroatian:Macintosh Croatian' 'MacCyrillic:Macintosh Cyrillic' 'MacDingbat:Macintosh Dingbat' 'MacGreek:Macintosh Greek' 'MacHebrew:Macintosh Hebrew' 'MacIceland:Macintosh Iceland' 'MacRoman:Macintosh Roman' 'MacRomania:Macintosh Romania' 'MacSymbol:Macintosh Symbol' 'MacThai:Macintosh Thai' 'MacTurkish:Macintosh Turkish' 'MacUkraine:Macintosh Ukraine' 'SJIS:Shift-JIS, Japanese' 'TIS620:TIS620, Thai' ) _describe 'character encoding' tmp -- ;; property) if compset -P '*='; then _default && return else _message -e property-names 'property name' fi ;; docsrc) if compset -P @; then _wanted files expl 'package/source list file' _files && return else _wanted files expl 'package or source' _files -g '*.java(-.)' && return fi ;; jararg) if [[ -prefix - ]]; then tmp=('-C:chdir') _describe -o 'option' tmp -- && return elif [[ "$words[CURRENT - 2]" == -C ]]; then _wanted file expl 'input file' _files -W "($words[CURRENT - 1])" && return elif [[ "$words[CURRENT - 1]" == -C ]]; then _wanted directories expl 'chdir to' _files -/ && return elif [[ $words[2] = *x* ]]; then jf="$words[3]" if [[ $jf != $_jar_cache_name && -f $jf ]]; then _jar_cache_list=("${(@f)$($words[1] tf $jf)}") _jar_cache_name=$jf fi _wanted files expl 'file from archive' _multi_parts / _jar_cache_list && return else _wanted files expl 'input file' _files && return fi ;; *) _message "unknown state: $state" ;; esac return ret PK[2 Ξ++functions/_lynxnuW+A#compdef lynx # Lynx Version 2.8.7rel.1 (05 Jul 2009) local curcontext="$curcontext" state line ret=1 typeset -A opt_args _arguments -C \ '-accept_all_cookies[accept cookies without prompting if Set-Cookie handling is on (off)]' \ '-anonymous[apply restrictions for anonymous account, see also -restrictions]' \ "-assume_charset=[charset for documents that don't specify it]:character set:" \ '-assume_local_charset=[charset assumed for local files]:character set:' \ '-assume_unrec_charset=[use this instead of unrecognized charsets]:character set:' \ '-auth=[authentication information for protected documents]:username\:password:' \ '-base[prepend a request URL comment and BASE tag to text/html outputs for -source dumps]' \ '-bibp=[specify a local bibp server (default http://bibhost/)]:bibp server:_urls' \ '-blink[forces high intensity background colors for color mode, if available and supported by the terminal]' \ '-book[use the bookmark page as the startfile (off)]' \ '-buried_news[toggles scanning of news articles for buried references (on)]' \ '-cache=[specify number of documents cached in memory]:number of documents:' \ '-case[enable case sensitive user searching (off)]' \ '-center[toggle center alignment in HTML TABLE (off)]' \ '-cfg=[specifies a lynx.cfg file other than the default]:configuration file:_files' \ '-child[exit on left-arrow in startfile, and disable save to disk]' \ '-child_relaxed[exit on left-arrow in startfile (allows save to disk)]' \ '-cmd_log=[log keystroke commands to the given file]:keystroke log:_files' \ '-cmd_script=[read keystroke commands from the given file (see -cmd_log)]:keystroke log:_files' \ '-color[forces color mode on, if available]' \ '-connect_timeout=[set the N-second connection timeout (18000)]:connection timeout (seconds):' \ '-cookie_file=[specifies a file to use to read cookies]:cookie file:_files' \ '-cookie_save_file=[specifies a file to use to store cookies]:cookie file:_files' \ '-cookies[toggles handling of Set-Cookie headers (on)]' \ '-core[toggles forced core dumps on fatal errors (off)]' \ '-crawl[with -traversal, output each page to a file with -dump, format output as with -traversal, but to stdout]' \ '-curses_pads[uses curses pad feature to support left/right shifting (on)]' \ '-debug_partial[incremental display stages with MessageSecs delay (off)]' \ '-delay=[set NNN-second delay at statusline message (0.000)]:delay (seconds):' \ "-display=[set the display variable for X exec'ed programs]:display:_x_display" \ '-display_charset=[charset for the terminal output]:character set:' \ "-dont_wrap_pre[inhibit wrapping of text in
     when -dump'ing and -crawl'ing, mark wrapped lines in interactive session (off)]" \
      '-dump[dump the first file to stdout and exit]' \
      '-editor=[enable edit mode with specified editor]:editor:_command_names -e' \
      '-emacskeys[enable emacs-like key movement (off)]' \
      "-enable_scrollback[toggles compatibility with comm programs' scrollback keys (may be incompatible with some curses packages) (off)]" \
      '-error_file=[write the HTTP status code here]:error file:_files' \
      '-exec[enable local program execution (normally not configured)]' \
      '-fileversions[include all versions of files in local VMS directory listings]' \
      '-force_empty_hrefless_a[force HREF-less 'A' elements to be empty (close them as soon as they are seen) (off)]' \
      '-force_html[forces the first document to be interpreted as HTML (off)]' \
      '-force_secure[toggles forms-based vs old-style options menu (on)]' \
      '-forms_options[toggles forms-based vs old-style options menu (on)]' \
      '-from[toggle transmission of From headers (on)]' \
      '-ftp[disable ftp access (off)]' \
      '-get_data[user data for get forms, read from stdin, terminated by '---' on a line]' \
      '-head[send a HEAD request (off)]' \
      '(- *)-help[print this usage message]' \
      '-hiddenlinks=[hidden links: options are merge, listonly, or ignore]:option:(merge listonly ignore)' \
      "-historical[toggles use of '>' or '-->' as terminator for comments (off)]" \
      '-homepage=[set homepage separate from start page]:URL:->html' \
      '-image_links[toggles inclusion of links for all images (off)]' \
      '-index=[set the default index file to URL]:URL:->html' \
      '-ismap[toggles inclusion of ISMAP links when client-side MAPs are present (off)]' \
      '-justify[do justification of text (off)]' \
      '-link=[starting count for lnk#.dat files produced by -crawl (0)]:starting count:' \
      '-listonly[with -dump, forces it to show only the list of links (off)]' \
      '-localhost[disable URLs that point to remote hosts (off)]' \
      '-locexec[enable local program execution from local files only (if lynx was compiled with local execution enabled)]' \
      '-lss=[specifies a lynx.lss file other than the default]:color-style file:_files' \
      '-mime_header[include mime headers and force source dump]' \
      '-minimal[toggles minimal versus valid comment parsing (on)]' \
      '-newschunksize=[number of articles in chunked news listings]:number of news articles:' \
      '-newsmaxchunk=[maximum news articles in listings before chunking]:maximum number of news articles:' \
      '-nobold[disable bold video-attribute]' \
      '-nobrowse[disable directory browsing]' \
      '-nocc[disable Cc: prompts for self copies of mailings (off)]' \
      '-nocolor[turn off color support]' \
      '-noexec[disable local program execution]' \
      '-nofilereferer[disable transmission of Referer headers for file URLs (on)]' \
      '-nolist[disable the link list feature in dumps (off)]' \
      '-nolog[disable mailing of error messages to document owners (on)]' \
      '-nomargins[disable the right/left margins in the default style-sheet (off)]' \
      '-nomore[disable -more- string in statusline messages]' \
      '-nonrestarting_sigwinch[make window size change handler non-restarting (off)]' \
      '-nonumbers[disable the link/form numbering feature in dumps (off)]' \
      '-nopause[disable forced pauses for statusline messages]' \
      '-noprint[disable some print functions, like -restrictions=print (off)]' \
      "-noredir[don't follow Location: redirection (off)]" \
      '-noreferer[disable transmission of Referer headers (off)]' \
      '-noreverse[disable reverse video-attribute]' \
      '-nosocks[disable SOCKS proxy usage by a SOCKSified Lynx]' \
      '-nostatus[disable the miscellaneous information messages (off)]' \
      '-notitle[disable the title at the top of each page (off)]' \
      '-nounderline[disable underline video-attribute]' \
      '-number_fields[force numbering of links as well as form input fields (off)]' \
      '-number_links[force numbering of links (off)]' \
      '-partial[toggles display partial pages while downloading (on)]' \
      '-partial_thres=[number of lines to render before repainting display with partial-display logic (-1)]:number of lines:' \
      '-passive-ftp[toggles passive ftp connection (on)]' \
      '-pauth=[authentication information for protected proxy server]:username\:password:' \
      '-popup[toggles handling of single-choice SELECT options via popup windows or as lists of radio buttons (off)]' \
      '-post_data[user data for post forms, read from stdin, terminated by '---' on a line]' \
      '-preparsed[show parsed text/html with -source and in source view to visualize how lynx behaves with invalid HTML (off)]' \
      '-prettysrc[do syntax highlighting and hyperlink handling in source view (off)]' \
      '-print[enable print functions (DEFAULT), opposite of -noprint (on)]' \
      '-pseudo_inlines[toggles pseudo-ALTs for inlines with no ALT string (on)]' \
      '-raw[toggles default setting of 8-bit character translations or CJK mode for the startup character set (off)]' \
      '-realm[restricts access to URLs in the starting realm (off)]' \
      '-read_timeout=[set the N-second read-timeout (18000)]:timeout (seconds):' \
      '-reload[flushes the cache on a proxy server (only the first document affected) (off)]' \
      '-restrictions=[use -restrictions to see list]:options:->restrictions' \
      '-resubmit_posts[toggles forced resubmissions (no-cache) of forms with method POST when the documents they returned are sought with the PREV_DOC command or from the History List (off)]' \
      '-rlogin[disable rlogins (off)]' \
      '-scrollbar[toggles showing scrollbar (off)]' \
      '-scrollbar_arrow[toggles showing arrows at ends of the scrollbar (on)]' \
      '-selective[require .www_browsable files to browse directories]' \
      '-short_url[enables examination of beginning and end of long URL in status line (off)]' \
      "-show_cfg[show 'LYNX.CFG' setting (off)]" \
      '-show_cursor[toggles hiding of the cursor in the lower right corner (on)]' \
      '-show_rate[toggles display of transfer rate (on)]' \
      "-soft_dquotes[toggles emulation of the old Netscape and Mosaic bug which treated '>' as a co-terminator for double-quotes and tags (off)]" \
      '-source[dump the source of the first file to stdout and exit]' \
      '-stack_dump[disable SIGINT cleanup handler (off)]' \
      '-startfile_ok[allow non-http startfile and homepage with -validate (off)]' \
      '-stderr[write warning messages to standard error when -dump or -source is used (off)]' \
      '-stdin[read startfile from standard input (off)]' \
      '-tagsoup[use TagSoup rather than SortaSGML parser (off)]' \
      '-telnet[disable telnets (off)]' \
      '-term=[set terminal type]:terminal name:_terminals' \
      '-tlog[toggles use of a Lynx Trace Log for the current session (on)]' \
      '-tna[turn on "Textfields Need Activation" mode (off)]' \
      '-trace[turns on Lynx trace mode (off)]' \
      '-trace_mask=[customize Lynx trace mode]:trace mask:(0 1 2 3 4 5 6 7)' \
      '-traversal[traverse all http links derived from startfile]' \
      '-trim_input_fields[trim input text/textarea fields in forms (off)]' \
      '-underline_links[toggles use of underline/bold attribute for links (off)]' \
      '-underscore[toggles use of _underline_ format in dumps (off)]' \
      '-use_mouse[turn on mouse support (off)]' \
      '-useragent=[set alternate Lynx User-Agent header]:user-agent header:' \
      '-validate[accept only http URLs (meant for validation) implies more restrictions than -anonymous, but goto is allowed for http and https (off)]' \
      '-verbose[toggles [LINK\], [IMAGE\] and [INLINE\] comments with filenames of these images (on)]' \
      '(- *)-version[print Lynx version information]' \
      '-vikeys[enable vi-like key movement (off)]' \
      '-width=[screen width for formatting of dumps (default is 80)]:number of columns:' \
      '-with_backspaces[emit backspaces in output if -dumping or -crawling]' \
      '-xhtml-parsing[enable XHTML 1.0 parsing (off)]' \
      ':URL:->html' && ret=0
    
    case "$state" in
    restrictions)
      _values -s ',' 'restriction' \
        \? all bookmark bookmark_exec change_exec_perms chdir default \
        dired_support disk_save dotfiles download editor exec exec_frozen \
        externals file_url goto inside_ftp inside_news inside_rlogin \
        inside_telnet jump lynx_cgi mail multibook news_post options_save \
        outside_ftp outside_news outside_rlogin outside_telnet print shell \
        suspend telnet_port useragent && return
      ;;
    html)
      _alternative 'files:file:_files -g "*.x#html#(-.)"' 'urls:URL:_urls' && return
      ;;
    esac
    
    return ret
    PK[m!i33functions/_zfs_poolnuW+A#autoload
    
    compadd "$@" - $(zpool list -H -o name)
    PK[wfunctions/_dcopnuW+A#compdef dcop dcopstart dcopfind dcopref dcopclient dcopobject
    
    local curcontext="$curcontext" desc vals arg base max=0 ret=1
    local app obj fun
    local -a state line expl
    
    case $service in
      dcop(client|object))
        state=( dcopref )
        max=2
      ;;
      dcopref) max=3 ;;
      dcopstart)
        if (( CURRENT > 2 )); then
          _urls && return
        fi
      ;;
      dcopfind)
        local cmd=$words[1]
        _arguments -C \
          '-a[print application id instead of DCOPRef]' \
          '-l[if object not found, run dcopstart and retry]' \
          '*::args:->args' && ret=0
        unset state
        words=( $cmd $words )
        (( CURRENT++ ))
      ;;
    esac
    
    if (( max && CURRENT > max )); then
      _message 'no more arguments'
      return 1
    fi
    
    if [[ -z "$state" ]]; then
      state=(application object function)
      [[ $words[2] = DCOPRef* && CURRENT -ne 2 ]]
      base=$?
      state=( ${state[CURRENT-base]:-arg} )
    
      [[ $state[1] = application && $service = dcop(|find) ]] && state+=( dcopref )
    fi
    
    while (( $#state )); do
      unset app obj fun
    
      if [[ $words[2] = (#b)DCOPRef*\(([^,]#)((#e)|,)([^\\\)]#)(*) ]]; then
        if [[ -n $match[2] ]]; then
          app=$match[1]
          if [[ -n $match[4] ]]; then
            obj=$match[3]
    	[[ -n $words[3] && CURRENT -gt 3 ]] && fun=$words[3]
          fi
        fi
      else
        case $CURRENT in
          <5->) fun="$words[4]" ;&
          4) obj="$words[3]" ;&
          3) app="$words[2]" ;;
        esac
      fi
      vals=( ${(f)"$(_call_program dcop-$state[1]s ${(M)words[1]##*/}dcop $app $obj 2>/dev/null)"} )
    
      case "$state[1]" in
        application|object)
          [[ -n ${(M)vals:#*\(default\)} ]] && vals+=( default )
          _wanted dcop-$state[1]s expl $state[1] compadd "$@" - ${vals% \(default\)} && ret=0
        ;;
    
        function)
          [[ $service = dcopfind ]] && vals=( ${(M)vals:#bool *} )
          _wanted dcop-$state[1]s expl $state[1] compadd "$@" - ${${vals#* }%\(*} && ret=0
        ;;
    
        arg)
          arg=${${${(M)vals:#*$fun\(*}#*\(}%\)*},
          arg=${${(s.,.)arg}[CURRENT-base-3]}
          if [[ -n $arg ]]; then
    	if [[ $arg = (Q(|C)String|*int )* || $arg != *\ * ]]; then
    	  # don't mention the argument's type
    	  desc="${arg##* }"
    	else
    	  desc="${arg##* } (${arg% *})"
    	fi
    	case $arg in
    	  bool*) _wanted argument expl "$desc" compadd true false && return ;;
    	  (#i)*(file|path|dir)*) _wanted argument expl "$desc" _files && return ;;
    	  (#i)*url*) _wanted argument expl "$desc" _urls && return ;;
    	  *) _message -e argument "$desc" ;;
    	esac
          else
    	_message 'no more arguments'
          fi
        ;;
    
        dcopref)
          if ! compset -P '*\('; then
    	_wanted dcoprefs expl 'dcop ref' compadd -S '' 'DCOPRef(' && ret=0
          elif compset -P '*,'; then
            if compset -S '(|\\)\)*'; then
    	  set -- -S '' "$@"
    	else
    	  set -- "$@" -S"${${QIPREFIX:+)}:-\)}$compstate[quote] "
    	fi
            state+=( object )
          else
            if compset -S ',*'; then
    	  set -- "$@" -S ''
    	else
    	  set -- "$@" -S ,
    	fi
            state+=( application )
          fi
        ;;
      esac
      shift state
    done
    
    return ret
    PK[HR>functions/_wantednuW+A#autoload
    
    local -a __targs __gopt
    
    zparseopts -D -a __gopt 1 2 V J x C:=__targs
    
    _tags "$__targs[@]" "$1"
    
    while _tags; do
      _all_labels "$__gopt[@]" "$@" && return 0
    done
    
    return 1
    PK[zfunctions/tcp_talknuW+A# Make line editor input go straight to the current TCP session.
    # Returns when the string $TCP_TALK_ESCAPE (default :) is read on its own.
    # Otherwise, $TCP_TALK_ESCAPE followed by whitespace at the start of a line
    # is stripped off and the rest of the line passed to the shell.
    #
    # History is not currently handled, because this is difficult.
    
    : ${TCP_TALK_ESCAPE:=:}
    
    tcp-accept-line-or-exit() {
      emulate -L zsh
      setopt extendedglob
      local match mbegin mend
    
      if [[ $BUFFER = ${TCP_TALK_ESCAPE}[[:blank:]]#(#b)(*) ]]; then
        if [[ -z $match[1] ]]; then
          BUFFER=
          zle -A .accept-line accept-line
          PS1=$TCP_SAVE_PS1
          unset TCP_SAVE_PS1
          zle -I
          print '\r[Normal keyboard input restored]' >&2
        else
          BUFFER=$match[1]
        fi
        zle .accept-line
      else
        # BUGS: is deleted from the command line and doesn't appear in
        # the history.
    
        # The following attempt to get the BUFFER into the history falls
        # foul of the fact that we need to accept the current line first.
        # But we don't actually want to accept the current line at all.
        # print -s -r - $BUFFER
    
        # This is my function to send data over a TCP connection; replace
        # it with something else or nothing.
        tcp_send $BUFFER
        BUFFER=
      fi
    }
    
    TCP_SAVE_PS1=${PS1##\[T*\]}
    if [[ -o prompt_subst ]]; then
      PS1="T[\$TCP_SESS]$TCP_SAVE_PS1"
    else
      PS1="[T]$TCP_SAVE_PS1"
    fi
    zle -N tcp-accept-line-or-exit
    zle -A tcp-accept-line-or-exit accept-line
    PK[Qfunctions/_fshnuW+A#compdef fsh
    
    local curcontext="$curcontext" state line ret=1
    
    _arguments -C \
      '(- : *)'{-h,--help}'[display help information]' \
      '(- : *)'{-V,--version}'[display version information]' \
      '-r[specify method]:method:(rsh ssh)' \
      '-l[specify login id]:login:_users' \
      '(-T --timeout)'{-T,--timeout}':idle timeout:' \
      ':remote host name:_hosts' \
      '(-):command: _command_names -e' \
      '*::args:->command' && ret=0
    
    if [[ -n "$state" ]]; then
      shift 1 words
      (( CURRENT-- ))
      _normal && ret=0
    fi
    
    return ret
    PK[tm=functions/_rarnuW+A#compdef rar unrar
    
    local common expl
    
    common=(
      '-ad[append archive name to destination path]'
      '-ap[set path inside archive]'
      '-av\-[disable authenticity verification check]'
      '-c\-[disable comments show]'
      '-cfg\-[disable read configuration]'
      '-cl\-[convert names to lower case]'
      '-cu[convert names to upper case]'
      '-dh[open shared files]'
      '-ep[exclude paths from name]'
      '-f[freshen files]'
      '-idp[disable percentage display]'
      '-ierr[send all messages to stderr]'
      '-inul[disable all messages]'
      '-kb[keep broken extracted files]'
      '-o\+[overwrite existing files]'
      '-o\-[do not overwrite existing files]'
      '-ow[save or restore file owner and group]'
      '-p+:password'
      '-p\-[do not query password]'
      '-r[recurse subdirectorie]'
      '-ta+[process files modified after a date]:date (YYYYMMDDHHMMSS)'
      '-tb+[process files modified before a date]:date (YYYYMMDDHHMMSS)'
      '-tn+[process files newer than a specified time]:time'
      '-to+[process files older than a specified time]:time'
      '-u[update files]'
      '-v[create volumes with size autodetection or list all volumes]'
      '-ver[file version control]'
      '-vp[pause before each volume]'
      '-x[exclude specified file]'
      '-y[assume yes answer to all queries]'
    )
    
    case $service in
      unrar)
        if (( CURRENT == 2 )); then
           _values 'rar command' \
    	'e[extract files to current directory]' \
    	'l[list archive]' \
    	'lt[list archive (technical format)]' \
    	'lb[list archive (bare format)]' \
    	'p[print file to stdout]' \
    	't[test archive files]' \
    	'v[verbosely list archive]' \
    	'vt[verbosely list archive (technical format)]' \
    	'vb[verbosely list archive (bare format)]' \
    	'x[extract files with full path]' && return
        else
          _arguments -S \
    	'-ep3[expand paths to full including the drive letter]' \
            '-idc[disable ___ display]' \
            '-idd[disable ___ display]' \
            '-idq[disable ___ display]' \
    	'-n+:file to include:_files' \
    	'-n@+:file of files to include:_files' \
            "$common[@]" \
            '*:RAR files:_files -g \*.rar\(-.\)' && return
        fi
      ;;
      rar)
        if (( CURRENT == 2 )); then
          _values 'rar command' \
    	'a[add files to archive]' \
    	'c[add archive comment]' \
    	'cf[add files comment]' \
    	'cw[write archive comment to file]' \
    	'd[delete files from archive]' \
    	'e[extract files to current directory]' \
    	'f[freshen files in archive]' \
    	'i[find string in archives]' \
    	'k[lock archive]' \
    	'l[list archive]' \
    	'lt[list archive (technical format)]' \
    	'lb[list archive (bare format)]' \
    	'm[move to archive]' \
    	'mf[move to archive (files only)]' \
    	'p[print file to stdout]' \
    	'r[repair archive]' \
    	'rc[reconstruct missing volumes]' \
    	'rr[add data recovery record]' \
    	'rv[create recovery volumes]' \
    	's[convert archive to or from SFX]' \
    	't[test archive files]' \
    	'u[update files in archive]' \
    	'v[verbosely list archive]' \
    	'vt[verbosely list archive (technical format)]' \
    	'vb[verbosely list archive (bare format)]' \
    	'x[extract files with full path]' && return
        else
          _arguments -S \
    	'-ag[generate archive name using the current date]' \
    	'-as[synchronize archive contents]' \
    	'-av[put authenticity verification (registered versions only)]' \
    	'-df[delete files after archiving]' \
    	'-ds[disable name sort for solid archive]' \
    	'-e[set file exclude attributes]' \
    	'-ed[do not add empty directories]' \
    	'-en[do not put end of archive block]' \
    	'-ep1[exclude base directory from names]' \
    	'-ep2[expand paths to full]' \
    	'-hp[encrypt both file data and headers]' \
    	'-ilog[log errors to file (registered versions only)]' \
    	'-isnd[enable sound]' \
    	'-k[lock archive]' \
    	'-m+[set compression level]:compression level:(( 0\:store 1\:fastest 2\:fast 3\:normal 4\:good 5\:maximal ))' \
    	'-md+[dictionary size]:dictionary size (KB):( 64 128 256 512 1024 2048 4096 a b c d e f g )' \
    	'-ms[specify file types to store]' \
    	'-ol[save symbolic links as the link instead of the file]' \
    	'-p[set password]' \
    	'-r0[recurse subdirectories for wildcard names only]' \
    	'-rr[add data recovery record]' \
    	'-rv[create recovery volumes]' \
    	'-s[create solid archive]' \
    	'-se[create solid archive using extension]' \
    	'-sv[create solid archive using volumes]' \
    	'-s\-[disable solid archiving]' \
    	'-sfx[create SFX archive]' \
    	'-t[test files after archiving]' \
    	'-tk[keep original archive time]' \
    	'-tl[set archive time to latest file]' \
    	'-vn[use the old style volume naming scheme]' \
    	'-w+[assign work directory]:work directory:_files -/' \
    	"$common[@]" \
    	'-z+[read archive comment from file]:comment file:_files' \
    	'*:files:_files' && return
        fi
      ;;
    esac
    PK[wE
    
    'functions/history-beginning-search-menunuW+A# Menu-driven alternative to history-beginning-search-backward.
    # As it uses a menu there is no sense of "forward" or "backward", however;
    # the entire history is searched.
    #
    # Configuration:
    #   autoload -Uz history-beginning-search-menu
    #   zle -N history-beginning-search-menu
    #   bindkey '\eP' history-beginning-search-menu
    #
    # Example:
    #   % /bin/su
    #   Enter digit:
    #   1 /bin/su -c 'make install'            4 /bin/su - perforce
    #   2 /bin/su                              5 /bin/su -c
    #   3 /bin/su -c 'chown pws:pws **/*(u0)'
    #
    # Typing "1" expands the line to
    #   % /bin/su -c 'make install'
    #
    # With a prefix argument, the search is not anchored to the beginning,
    # so for example "/su" could expand to "p4 files //depot/support/..."
    #
    # If this is bound to a widget containing "-end", e.g.
    #   zle -N history-beginning-search-menu-end history-beginning-search-menu
    # then the cursor is put at the end of the line, else it is left
    # after the matched characters.
    #
    # If this is bound to a widget containing "-space", then any space in
    # the line so far is matched as a wildcard.  (This means putting a space
    # at the start of the line is equivalent to specifying a prefix
    # argument.)
    
    emulate -L zsh
    setopt extendedglob
    
    zmodload -i zsh/parameter
    
    local -aU matches
    local -a display
    
    local search=$LBUFFER MATCH MBEGIN MEND
    
    search=${search//(#m)[\][()\\*?#<>~^]/\\$MATCH}
    if [[ $WIDGET = *-space* ]]; then
      # We need to quote metacharacters in the search string
      # since they are otherwise active in the reverse subscript.
      # We need to avoid quoting other characters since they aren't
      # and just stay quoted, rather annoyingly.
      search=${search// /*}
    fi
    
    if (( ${+NUMERIC} )); then
      matches=(${(o)history[(R)*${search}*]})
    else
      matches=(${(o)history[(R)${search}*]})
    fi
    
    # Filter out any match that's the same as the original.
    # Note this isn't a pattern this time.
    matches=(${matches:#${LBUFFER}})
    
    integer n=${#matches}
    integer width=${#n}
    
    (( n == 0 )) && return 1
    
    # Hey, this works...
    integer i
    display=(${matches/(#m)*/${(l.$width..0.):-$((++i))} $MATCH})
    zle -R "Enter digit${${width##1}:+s}:" $display
    
    integer i
    local char chars
    
    # Hmmm... this isn't great.  The only way of clearing the display
    # appears to be to overwrite it completely.  I think that's because
    # displaying strings in this way doesn't set the completion list
    # properly.
    display=(${display//?/ })
    
    # Abort on first non-digit entry instead of requiring all
    # characters to be typed (as "read -k$width chars" would do).
    for (( i = 0; i < $width; i++ )); do
      read -k char
      if [[ $char != [[:digit:]] ]]; then
        zle -R '' $display
        return 1
      fi
      chars+=$char
    done
    
    if [[ $chars -eq 0 || $chars -gt $n ]]; then
      zle -R '' $display
      return 1
    fi
    
    integer newcursor
    if [[ $WIDGET != *-end* ]]; then
      if (( ${+NUMERIC} )); then
        # Advance cursor so that it's still after the string typed
        local -a match mbegin mend
        if [[ $matches[$chars] = (#b)(*${LBUFFER})* ]]; then
           newcursor=${#match[1]}
        fi
      else
        # Maintain cursor
        newcursor=$CURSOR
      fi
    fi
    
    # Find the history lines that contain the matched string and
    # go to the last one.  This allows accept-line-and-down-history etc.
    # to work.
    local -a lines
    local matchq=${matches[$chars]//(#m)[\][()\\*?#<>~^]/\\$MATCH}
    lines=(${(kon)history[(R)$matchq]})
    HISTNO=$lines[-1]
    
    if (( newcursor )); then
      CURSOR=$newcursor
    elif [[ $WIDGET = *-end* ]]; then
      CURSOR=${#BUFFER}
    fi
    
    zle -R '' $display
    PK[$bڳfunctions/_dhcpinfonuW+A#compdef dhcpinfo
    
    _dhcpinfo() {
    	local -a mnemonics_v4 mnemonics_v6
    
    	mnemonics_v4=(
    		Subnet UTCoffst Router Timeserv IEN116ns DNSserv Logserv
    		Cookie Lprserv Impress Resource Hostname Bootsize Dumpfile
    		DNSdmain Swapserv Rootpath ExtendP IpFwdF NLrouteF PFilter
    		MaxIpSiz IpTTL PathTO PathTbl MTU SameMtuF Broadcst
    		MaskDscF MaskSupF RDiscvyF RSolictS StaticRt TrailerF
    		ArpTimeO EthEncap TcpTTL TcpKaInt TcpKaGbF NISdmain
    		NISservs NTPservs NetBNms NetBDsts NetBNdT NetBScop
    		XFontSrv XDispMgr LeaseTim Message T1Time T2Time NW_dmain
    		NWIPOpts NIS+dom NIS+serv TFTPsrvN OptBootF MblIPAgt
    		OptBootF MblIPAgt SMTPserv POP3serv NNTPserv WWWservs
    		Fingersv IRCservs STservs STDAservs UserClas SLP_DA SLP_SS
    		AgentOpt FQDN PXEarch BootFile BootPath BootSrvA BootSrvN
    		EchoVC LeaseNeg
    	)
    
    	mnemonics_v6=(
    		ClientID ServerID Preference Unicast UserClass VendorClass
    		SIPNames SIPAddresses DNSAddresses DNSSearch NISServers
    		NIS+Servers NISDomain NIS+Domain SNTPServers InfoRefresh
    		BCMCDomain BCMCAddresses
    	)
    
    	_arguments -A \
    		'-c[]' \
    		'-i[interface]:interface:' \
    		'-n[maximum number of lines]:limit:' \
    		':DHCP Parameter:_values "DHCP Parameter" $mnemonics_v4' \
    }
    
    _dhcpinfo "$@"
    PK[z1functions/prompt_special_charsnuW+A# Utility function to set up some special characters
    # used by prompts.
    #
    # These used to be defined to characters found in particular
    # character sets (e.g. IBM852) which now aren't widely used.
    # We still provide them in that form if the current character
    # set isn't UTF-8.  We could in principle use iconv if available.
    
    typeset -gA schars
    
    if [[ ${LC_ALL:-${LC_CTYPE:-$LANG}} = *(UTF-8|utf8)* ]]; then
      schars[300]=$'\xe2\x94\x94'
      schars[304]=$'\xe2\x94\x8c'
      schars[332]=$'\xe2\x94\x8c'
      schars[333]=$'\xe2\x96\x88'
      schars[371]=$'\xc2\xa8'
      schars[372]=$'\xcb\x99'
      schars[262]=$'\xe2\x96\x93'
      schars[261]=$'\xe2\x96\x92'
      schars[260]=$'\xe2\x96\x91'
    else
      for code in 300 304 332 333 371 372 262 261 260; do
        eval "schars[$code]=\$'\\$code'"
      done
    fi
    PK[+Gfunctions/_gnome-gvnuW+A#compdef gnome-gv ggv
    
    _arguments \
      '(--help)-\\?[help]' \
      '(--windows)-w[number of empty windows]:number:' \
      '*:file: _pspdf -z' --
    PK[qfunctions/_retrieve_cachenuW+A#autoload
    #
    # Retrieval component of completions caching layer
    
    local _cache_ident _cache_dir _cache_path _cache_policy
    _cache_ident="$1"
    
    if zstyle -t ":completion:${curcontext}:" use-cache; then
      # Decide which directory to retrieve cache from, and ensure it exists
      zstyle -s ":completion:${curcontext}:" cache-path _cache_dir
      : ${_cache_dir:=${ZDOTDIR:-$HOME}/.zcompcache}
      if [[ ! -d "$_cache_dir" ]]; then
        [[ -e "$_cache_dir" ]] &&
          _message "cache-dir ($_cache_dir) isn't a directory\!"
        return 1
      fi
    
      _cache_path="$_cache_dir/$_cache_ident"
    
      if [[ -e "$_cache_path" ]]; then
        _cache_invalid "$_cache_ident" && return 1
    
        . "$_cache_path"
        return 0
      else
        return 1
      fi
    else
      return 1
    fi
    
    PK[V&&functions/zfautochecknuW+A# function zfautocheck {
    # This function is used to implement auto-open behaviour.
    #
    # With first argument including n, don't change to the old directory; else do.
    #
    # Set do_close to 1 if the connection was not previously open, 0 otherwise
    # With first arguemnt including d, don't set do_close to 1.  Broadly
    # speaking, we use this mechanism to shut the connection after use
    # if the connection had been explicitly closed (i.e. didn't time out,
    # which zftp test investigates) and we are not using a directory
    # command, which implies we are looking for something so should stay open
    # for it.
    
    # Remember the old location:  will be overwritten by
    # a successful open.
    local lastloc=$zfconfig[lastloc_$ZFTP_SESSION]
    
    # Don't print out user messages when re-opening the connection.
    local ZFTP_VERBOSE=${ZFTP_VERBOSE//0}
    
    # Unset the delay counter from the progress meter in case there was an
    # abnormal exit.
    (( ${+zftpseconds} )) && unset zftpseconds
    
    if [[ -z $ZFTP_HOST ]]; then
      zfopen || return 1
      [[ $1 == *d* ]] || do_close=1
    elif zftp test 2>/dev/null; then
      return 0
    else
      zfopen || return 1
    fi
    
    if [[ $1 == *n* ]]; then
      return 0
    elif [[ -n $lastloc && $ZFTP_HOST == ${lastloc%%:*} ]]; then
      # don't print directory since we're just going back where we were.
      zfcd ${lastloc#*:} >& /dev/null
    fi
    
    # }
    PK[R[functions/_acpinuW+A#compdef acpi
    
    _arguments -s \
        '(-b --battery)'{-b,--battery}'[battery information]' \
        '(-B --without-battery)'{-B,--without-battery}'[suppress battery information]' \
        '(-t --thermal)'{-t,--thermal}'[thermal information]' \
        '(-T --without-thermal)'{-T,--without-thermal}'[suppress thermal information]' \
        '(-a --ac-adapter)'{-a,--ac-adapter}'[ac adapter information]' \
        '(-A --without-ac-adapter)'{-A,--without-ac-adapter}'[suppress ac-adapter information]' \
        '(-V --everything)'{-V,--everything}'[show every device, overrides above options]' \
        '(-s --show-empty)'{-s,--show-empty}'[show non-operational devices]' \
        '(-S --hide-empty)'{-S,--hide-empty}'[hide non-operational devices]' \
        '(-c --celsius -f --fahrenheit -k --kelvin)'{-c,--celsius}'[use Celsius as the temperature scale]' \
        '(-c --celsius -f --fahrenheit -k --kelvin)'{-f,--fahrenheit}'[use Fahrenheit as the temperature scale]' \
        '(-c --celsius -f --fahrenheit -k --kelvin)'{-k,--kelvin}'[use Kelvin as the temperature scale]' \
        '(-d --directory)'{-d,--directory}'[path to ACPI info (/proc/acpi)]:directory:_files -/' \
        '(-h --help)'{-h,--help}'[display this help and exit]' \
        '(-v --version)'{-v,--version}'[output version information and exit]'
    PK[%t##functions/_daknuW+A#compdef dak
    
    local curcontext="$curcontext" state line expl cmd args ret=1
    typeset -A opt_args
    
    _arguments -C \
        '1: :->cmd' \
        '*:: :->args' && ret=0
    
    if (( ! $+_dak_cmds )); then
        typeset -gH _dak_cmds
        _dak_cmds=(${${${(f)${"$(_call_program dak dak --help)"#*Availa#ble commands:}}#[^a-z] ##}%%[ 	]*})
    fi
    
    if [[ $state != 'args' ]]; then
        _describe -t subcommand 'subcommand' _dak_cmds
        return 0
    fi
    
    cmd="$words[1]"
    curcontext="${curcontext%:*:*}:dak-$cmd:"
    
    args=( '(-)'{--help,-h}'[show help message]' )
    
    case $cmd in
    (ls)
        args+=(
      '(-a --architecture)'{-a,--architecture=}':arch:_values -s , "architecture list" source all alpha amd64 arm hppa hurd-i386 i386 ia64 mips mipsel'
      '(-b --binary-type)'{-b,--binary-type=}':type:(deb udeb)'
      '(-c --component)'{-c,--component=}':component:_values -s , "component list" main contrib non-free'
      '(-g --greaterorequal)'{-g,--greaterorequal}
      '(-G --greaterthan)'{-G,--greaterthan}
      '(-r --regex)'{-r,--regex}
      '(-s --suite)'{-s,--suite=}':suite:_values -s , "suite list" oldstable stable testing unstable experimental'
      '(-S, --source-and-binary)'{-S,--source-and-binary}
      '*:package:_deb_packages avail'
            )
        ;;
    (override)
        args+=(
      '(-d --done)'{-d,--done=}'[send prioritys/section change as closure to bug]:bug number:'
      '(-n --no-action)'{-n,--no-action}'[do not do anything]'
      '(-s --suite)'{-s,--suite=}':suite:_values -s , "suite list" oldstable stable testing unstable experimental'
      ':package:_deb_packages avail'
      ':section:(admin base comm contrib/admin contrib/comm contrib/devel contrib/doc contrib/games contrib/graphics contrib/interpreters contrib/kde contrib/libdevel contrib/libs contrib/mail contrib/math contrib/misc contrib/net contrib/otherosfs contrib/perl contrib/python contrib/science contrib/sound contrib/tex contrib/text contrib/utils contrib/web contrib/x11 devel doc editors electronics embedded games gnome graphics hamradio interpreters kde libdevel libs mail math misc net news non-free/admin non-free/base non-free/comm non-free/devel non-free/doc non-free/editors non-free/electronics non-free/games non-free/graphics non-free/hamradio non-free/libdevel non-free/libs non-free/mail non-free/math non-free/misc non-free/net non-free/news non-free/otherosfs non-free/python non-free/science non-free/sound non-free/tex non-free/text non-free/utils non-free/web non-free/x11 oldlibs otherosfs perl python science shells sound tex text utils web x11)'
      ':priority:(extra important optional required standard)'
        )
        ;;
    (check-archive)
        args+=(
      '*:mode:((
      md5sums\:validate\ the\ md5sums\ stored\ in\ the\ database
      files\:check\ files\ in\ the\ database\ against\ what\ is\ in\ the\ archive
      dsc-syntax\:validate\ the\ syntax\ of\ .dsc\ files\ in\ the\ archive
      missing-overrides\:check\ for\ missing\ overrides
      source-in-one-dir\:ensure\ the\ source\ for\ each\ package\ is\ in\ one\ directory
      timestamps\:check\ for\ future\ timestamps\ in\ .debs
      tar-gz-in-dsc\:ensure\ each\ .dsc\ lists\ a\ .tar.gz\ file
      validate-indices\:ensure\ files\ mentioned\ in\ Packages\ and\ Sources\ exist
      files-not-symlinks\:check\ files\ in\ the\ database\ are\ not\ symlinks
      validate-builddeps\:validate\ build-dependencies\ of\ .dsc\ files\ in\ the\ archive))'
        )
        ;;
    (queue-report)
        args+=(
       '(-n --new)'{-n,--new}'[produce html output]'
       '(-s --sort)'{-s,--sort=}':sort key:((ao\:age,\ oldest\ first an\:age,\ newest\ first na\:name,\ ascending nd\:name,\ descending nf\:notes,\ first nl\:notes,\ last))'
       '(-a --age)'{-a,--age=}':age key:((m\:minutes h\:hours d\:days w\:weeks o\:months y\:years))'
        )
        ;;
    (rm)
        args+=(
      '(-a --architecture)'{-a,--architecture=}':arch:_values -s , "architecture list" source all alpha amd64 arm hppa hurd-i386 i386 ia64 mips mipsel'
      '(-b --binary)'{-b,--binary}'[remove binaries only]'
      '(-c --component)'{-c,--component=}':component:_values -s , "component list" main contrib non-free'
      '(-C --carbon-copy)'{-C,--carbon-copy=}':cc address:_email_addresses'
      '(-d --done)'{-d,--done=}'[send prioritys/section change as closure to bug]:bug number:'
      '(-m --reason)'{-m,--reason=}':reason for removal:'
      '(-n --no-action)'{-n,--no-action}'[do not do anything]'
      '(-p --partial)'{-p,--partial}'[do not affect override files]'
      '(-R --rdep-check)'{-R,--rdep-check}'[check reverse dependencies]'
      '(-s --suite)'{-s,--suite=}':suite:_values -s , "suite list" oldstable stable testing unstable experimental'
      '(-S, --source-only)'{-S,--source-only}'[remove source only]'
      '*:package:_deb_packages avail'
        )
        ;;
    (process-unchecked|process-accepted)
        args+=(
      '(-a --automatic)'{-a,--automatic}'[automatic run]'
      '(-n --no-action)'{-n,--no-action}'[do not do anything]'
      '(-p --no-lock)'{-p,--no-lock}'[do not check lockfile]'
      '(-s --no-mail)'{-s,--no-mail}'[do not send any mail]'
      '(-V --version)'{-V,--version}'[display the version number and exit]'
        )
        ;;
    
    (make-suite-file-list)
        args+=(
       '(-a --architecture)'{-a,--architecture=}':arch:_values -s , "architecture list" source all alpha amd64 arm hppa hurd-i386 i386 ia64 mips mipsel'
      '(-c --component)'{-c,--component=}':component:_values -s , "component list" main contrib non-free'
      '(-n --no-delete)'{-n,--no-delete}'[do not delete older versions]'
      '(-s --suite)'{-s,--suite=}':suite:_values -s , "suite list" oldstable stable testing unstable experimental'
        )
        ;;
    
    (generate-releases)
        args+=(
       '*:suite:(oldstable stable testing unstable experimental)'
        )
        ;;
    
    (generate-index-diffs)
        args+=(
       '-c[give the canonical path of the file]'
       '-p[name for the patch (defaults to current time)]'
       '-n[take no action]'
       '*:suite:(oldstable stable testing unstable experimental)'
        )
        ;;
    
    (clean-suites)
        args+=(
       '(-n --no-action)'{-n,--no-action}'[do not do anything]'
       '*:suite:(oldstable stable testing unstable experimental)'
        )
        ;;
    
    (clean-queues)
        args+=(
       '(-d --days)'{-d,--days=}':days:'
       '(-i --incoming)'{-i,--incoming=}':incoming dir:'
       '(-n --no-action)'{-n,--no-action}'[do not do anything]'
       '(-v --verbose)'{-v,--verbose}'[explain what is being done]'
        )
        ;;
    
    (clean-proposed-updates)
        args+=(
       '(-v --verbose)'{-v,--verbose}'[be more verbose about what is being done]'
       '*:changes or admin file:_files -g "*.(changes|joey)"'
        )
        ;;
    
    (check-overrides)
        args+=(
       '(-n --no-action)'{-n,--no-action}'[do not do anything]'
        )
        ;;
    
    (clean-proposed-updates)
        args+=(
       '(-q --quiet)'{-q,--quiet}'[be quieter about what is being done]'
       '(-v --verbose)'{-v,--verbose}'[be more verbose about what is being done]'
       '*:changes or deb or admin file:_files -g "*.(changes|deb|joey)"'
        )
        ;;
    
    (control-overrides)
        args+=(
      '(-c --component)'{-c,--component=}':component:(main contrib non-free)'
      '(-s --suite)'{-s,--suite=}':suite:(oldstable stable testing unstable experimental)'
      '(-t --type)'{-t,--type=}':type:(deb dsc udeb)'
      '(-a, --add)'{-a,--add}'[add overrides]'
      '(-S, --set)'{-S,--set}'[set overrides]'
      '(-l, --list)'{-l,--list}'[list overrides]'
      '(-q, --quiet)'{-q,--quiet}'[be less verbose]'
            )
        ;;
    
    (control-suite)
        args+=(
      '(-a --add)'{-a,--add=}':suite:(oldstable stable testing unstable experimental)'
      '(-l --list)'{-l,--list=}':suite:(oldstable stable testing unstable experimental)'
      '(-r --remove)'{-r,--remove=}':suite:(oldstable stable testing unstable experimental)'
      '(-s --set)'{-s,--set=}':suite:(oldstable stable testing unstable experimental)'
       '*:file:_files'
        )
        ;;
    
    (cruft-report)
        args+=(
      '(-m --mode)'{-m,--mode=}':mode:(full daily)'
      '(-s --suite)'{-s,--suite=}':suite:(oldstable stable testing unstable experimental)'
        )
        ;;
    
    (decode-dot-dak)
        args+=(
        '*:dot-dak file:_files -g "*.dak"'
        )
        ;;
    
    (import-archive)
        args+=(
        '(-a --action)'{-a,--action}'[actually perform the initialization]'
        )
        ;;
    
    (import-users-from-passwd)
        args+=(
      '(-n --no-action)'{-n,--no-action}'[do not do anything]'
      '(-q --quiet)'{-q,--quiet}'[be quiet about what is being done]'
      '(-v --verbose)'{-v,--verbose}'[explain what is being done]'
        )
        ;;
    
    (make-maintainers)
        args+=(
        '*:extra file:_files'
        )
        ;;
    
    (poolize)
        args+=(
      '(-l --limit)'{-l,--limit=}'[only migrate amount of packages]:amount in kb:'
      '(-n --no-action)'{-n,--no-action}'[do not do anything]'
      '(-v --verbose)'{-v,--verbose}'[explain what is being done]'
        )
        ;;
    
    (reject-proposed-updates)
        args+=(
      '(-m --message)'{-m,--message=}'[use this message for rejection]:message:'
      '(-s --no-mail)'{-s,--no-mail}'[do not send any mail]'
      '*:changes file:_files -g "*.changes"'
        )
        ;;
    
    (stats)
        args+=(
      ':mode:((arch-space\:displays\ space\ used\ by\ each\ architecture pkg-nums\:displays\ the\ number\ of\ packages\ by\ suite/architecture daily-install\:displays\ daily\ install\ stats\ suitable\ for\ graphing))'
        )
        ;;
    
    (symlink-dists)
        args+=(
       '(-v --verbose)'{-v,--verbose}'[explain what is being done]'
        )
        ;;
    
    esac
    
    _arguments -s "$args[@]" && ret=0
    return $ret
    PK[+<}llfunctions/_whichnuW+A#compdef which whence where type
    
    local farg aarg cargs args state line curcontext="$curcontext" ret=1
    
    cargs=( \
      '(-v -c)-w[print command type]' \
      '-p[always do a path search]' \
      '-m[treat the arguments as patterns]' \
      '-s[print symlink free path as well]' \
      '*:commands:->command' )
    farg='-f[output contents of functions]'
    aarg='-a[print all occurrences in path]'
    
    case ${service} in
      whence)
        _arguments -C -s -A "-*" -S \
          '(-c -w)-v[verbose output]' \
          '(-v -w)-c[csh-like output]' \
          "${cargs[@]}" "$farg" "$aarg" && ret=0
      ;;
      where) _arguments -C -s -A "-*" -S "${cargs[@]}" && ret=0;;
      which) _arguments -C -s -A "-*" -S "${cargs[@]}" "$aarg" && ret=0;;
      type) _arguments -C -s -A "-*" -S "${cargs[@]}" "$aarg" "$farg" && ret=0;;
    esac
    
    if [[ "$state" = command ]]; then
    
      args=( "$@" )
    
      _alternative -O args \
        'commands:external command:_path_commands' \
        'builtins:builtin command:compadd -k builtins' \
        'functions:shell function:compadd -k functions' \
        'aliases:alias:compadd -k aliases' \
        'reserved-words:reserved word:compadd -k reswords' && ret=0
    
    fi
    
    return ret
    PK[functions/promptnlnuW+A# Add `autoload promptnl' to your .zshrc, and include a call to promptnl
    # near the end of your precmd function.
    #
    # When promptnl runs, it asks the terminal to send back the current
    # position of the cursor.  If the cursor is in column 1, it does nothing;
    # otherwise it prints a newline.  Thus you get a newline exactly when one
    # is needed.
    #
    # Of course this can make it appear that `print -n' and friends have
    # failed to suppress the final newline; so promptnl outputs the value
    # of the EOLMARK parameter before the newline, with prompt sequences
    # expanded.  So you can for example use EOLMARK='%B!%b' to put a bold
    # exclamation point at the end of the actual output.
    
    # There's another way to accomplish the equivalent, without reading the
    # cursor position from the terminal.  Skip to the end of the file to see
    # that other way.
    
    emulate -L zsh
    
    # VT100 and ANSI terminals will report the cursor position when sent
    # the sequence ESC [ 6 n -- it comes back as ESC [ column ; line R
    # with of course no trailing newline.  Column and line are 1-based.
    
    local RECV='' SEND='\e[6n' REPLY=X
    
    # If you are on a very slow tty, you may need to increase WAIT here.
    integer WAIT=1
    
    # Make sure there's no typeahead, or it'll confuse things.  Remove
    # this block entirely to use this function in 3.0.x at your own risk.
    while read -t -k 1
    do
        RECV=$RECV$REPLY
    done
    if [[ -n $RECV ]]
    then
        print -z -r -- $RECV
        RECV=''
        REPLY=X
    fi
    
    # This is annoying, but zsh immediately resets it properly, so ...
    stty -echo
    
    # Output the SEND sequence and read back into RECV.  In case this is
    # not a terminal that understands SEND, do a non-blocking read and
    # retry for at most WAIT seconds before giving up.  Requires 3.1.9.
    # For 3.0.x, remove "-t" but don't call this on the wrong terminal!
    
    print -n $SEND
    
    integer N=$SECONDS
    while [[ $REPLY != R ]] && ((SECONDS - N <= WAIT))
    do
        if read -t -k 1
        then
    	((N=SECONDS))
    	RECV=$RECV$REPLY
        fi
    done
    
    # If the cursor is not in the first column, emit EOLMARK and newline.
    
    (( ${${RECV#*\;}%R} > 1 )) && print -P -- $EOLMARK
    
    return 0
    
    # OK, now here's the other way.  Works on any auto-margin terminal, which
    # includes most terminals that respond to ESC [ 6 n as far as I know.  It
    # prints a line of spaces exactly as wide as the terminal, then prints a
    # carriage return.  If there are any characters already on the line, this
    # will cause the line to wrap, otherwise it won't.
    
    : setopt nopromptcr
    : PS1="%{${(pl:COLUMNS+1:: ::\r:)}%}$PS1"
    
    # On a very slow connection, you might be able to see the spaces getting
    # drawn and then overwritten, so reading the cursor position might work
    # better in that circumstance because it transmits fewer characters.  It
    # also doesn't work if you resize the terminal.
    
    # To get the EOLMARK behavior, simply adjust the COLUMNS+1 expression to
    # account for the width of the mark, and include it.  For example:
    
    : setopt nopromptcr
    : PS1="%{%S%s${(pl:COLUMNS-4:: ::\r:)}%}$PS1"
    
    # The important bit is that the total width of the string inside %{...%}
    # has to be COLUMNS+1, where the extra character is the \r.  However, I
    # recommend using a one-character EOLMARK to avoid having the line wrap
    # in the middle of the marker string:
    
    setopt nopromptcr
    PS1="%{%S#%s${(pl:COLUMNS:: ::\r:)}%}$PS1"
    PK[4KPzz functions/history-pattern-searchnuW+A# Prompt for an search in the history for a pattern.
    # Patterns to search are standard zsh patterns, but may include
    # ^ at the start or $ at the end to anchor the pattern to the
    # start or end of the history entry respectively.
    #
    # To search backwards, create a widget history-pattern-search-backward:
    #   zle -N history-pattern-search-backward history-pattern-search
    # and to search forwards, create history-pattern-search-forward
    #   zle -N history-pattern-search-forward history-pattern-search
    
    # Use extended globbing by default.
    emulate -L zsh
    setopt extendedglob
    
    # Load required features.
    autoload -Uz read-from-minibuffer
    zmodload -i zsh/parameter
    
    local REPLY dir new
    integer i
    local -a found match mbegin mend
    
    # Decide if we are searching backwards or forwards.
    if [[ $WIDGET = *forward* ]]; then
      dir="forw"
    else
      dir="rev"
    fi
    
    # Read pattern.  Prompt could be made customisable.
    read-from-minibuffer "pat ($dir): " $_last_history_pattern_search
    
    _last_history_pattern_search=$REPLY
    
    # Abort if bad status or nothing entered
    [[ $? -ne 0 || -z $REPLY ]] && return 0
    
    # Handle start-of-line anchor.
    if [[ $REPLY = \^* ]]; then
      REPLY=$REPLY[2,-1]
    else
      REPLY="*$REPLY"
    fi
    
    # Handle end-of-line anchor.
    if [[ $REPLY = *\$ ]]; then
      REPLY=$REPLY[1,-2]
    else
      REPLY="$REPLY*"
    fi
    
    # Search history for pattern.
    # As $history is an associative array we can get all matches.
    found=(${(kon)history[(R)$REPLY]})
    
    if [[ $dir = forw ]]; then
      # Searching forward.  Look back through matches until we
      # get back to the current history number.
      for (( i = ${#found}; i >= 1; i-- )); do
        (( $found[$i] <= HISTNO )) && break
        new=$found[$i]
      done
    else
      # Searching backward.  Look forward through matches until we
      # reach the current history number.
      for (( i = 1; i <= ${#found}; i++ )); do
        (( $found[$i] >= HISTNO )) && break
        new=$found[$i]
      done
    fi
    
    if [[ -n $new ]]; then
      # Match found.  Move to line.
      HISTNO=$new
      if [[ $REPLY = *\* && $history[$new] = (#b)(${~REPLY[1,-2]})* ]]; then
        # If not anchored to the end, move to the end of the pattern
        # we were searching for.
        CURSOR=$mend[1]
      fi
      return 0
    else
      return 1
    fi
    PK[)dffunctions/_subscriptnuW+A#compdef -subscript-
    
    local expl ind osuf=']' flags sep
    
    if [[ "$1" = -q ]]; then
      compquote osuf
      osuf+=' '
      shift
    fi
    
    compset -P '\(([^\(\)]|\(*\))##\)' # remove subscript flags
    
    # Look for a dynamic name expansion.  Completion only gives us
    # the stuff inside the square brackets; we need to find out what's
    # outside.  We ought to check for quoting, really, but given we've
    # got to the subscript code " ~[" is pretty likely to be a dynamic
    # name expansion.  Also expand in anything that looks like an assignment
    # or colon list.
    integer pos=$((CURSOR+1))
    while [[ pos -gt 1 && $BUFFER[pos-1] != '[' ]]; do (( pos-- )); done
    if [[ $BUFFER[1,pos-1] = *[[:space:]:=]##\~\[ ]]; then
      _dynamic_directory_name
    elif [[ "$PREFIX" = :* ]]; then
      _wanted characters expl 'character class' \
          compadd -p: -S ':]' alnum alpha ascii blank cntrl digit graph \
                              lower print punct space upper xdigit
    elif compset -P '\('; then
      local match
      compset -S '\)*'
    
      if [[ $PREFIX = (#b)*([bns])(?|)(*) ]]; then
        local f=$match[1] d=$match[2] e=$match[2] v=$match[3]
        [[ $f = s && ${(Pt)${compstate[parameter]}} != scalar* ]] && return 1
        if [[ -z $d ]]; then
          _message -e delimiters 'delimiter'
          return
        else
          case $d in
          (\() e=\);;
          (\[) e=\];;
          (\{) e=\};;
          esac
          if [[ $v != *$e* ]]; then
    	case $f in
    	(s) _message 'separator string';;
    	(b|n) [[ $v = <-># ]] && _message 'number' || return 1;;
    	esac
    	[[ -n $v && $SUFFIX$ISUFFIX != *$e* ]] && _message 'delimiter'
    	return 0
          fi
        fi
      fi
    
      case ${(Pt)${compstate[parameter]}} in
        assoc*) flags=(
          '(R k K i I)r[any one value matched by subscript as pattern]'
          '(r k K i I)R[all values matched by subscript as pattern]'
          '(r R K i I)k[any one value where subscript matched by key as pattern]'
          '(r R k i I)K[all values where subscript matched by key as pattern]'
          '(r R k K I)i[any one key matched by subscript as pattern]'
          '(r R k K i)I[all keys matched by subscript as pattern]'
          'e[interpret * or @ as a single key]'
        );;
        (|scalar*)) flags=(
          'w[make subscripting work on words of scalar]'
          's[specify word separator]'
          'p[recognise escape sequences in subsequent s flag]'
        );&
        array*) flags=($flags
          'e[interpret * or @ as a single key and use plain string matching]'
          'n[Nth lowest/highest index with i/I/r/R flag]'
          'b[begin with specified element]'
          '(r R k K i)I[highest index of value matched by subscript]'
          '(r R k K I)i[lowest index of value matched by subscript]'
          '(r k K i I)R[value matched by subscript at highest index]'
          '(R k K i I)r[value matched by subscript at lowest index]'
        );;
      esac
    
      _values -s '' 'subscript flags' $flags
    elif [[ ${(Pt)${compstate[parameter]}} = assoc* ]]; then
      local suf MATCH MBEGIN MEND
      local -a keys
      keys=(${${(kP)compstate[parameter]}//(#m)[\$\\\[\]\(\)\[\{\}]/\\$MATCH})
      keys=(${keys//#%(#m)[*@]/(e)$MATCH})
      [[ "$RBUFFER" != (|\\)\]* ]] && suf="$osuf"
    
      _wanted association-keys expl 'association key' \
          compadd -Q -S "$suf" -a keys
    elif [[ ${(Pt)${compstate[parameter]}} = array* ]]; then
      local list i j ret=1 disp
    
      _tags indexes parameters
    
      while _tags; do
        if _requested indexes; then
          ind=( {1..${#${(P)${compstate[parameter]}}}} )
          if zstyle -T ":completion:${curcontext}:indexes" verbose; then
            list=()
            for i in "$ind[@]"; do
              if [[ "$i" = ${PREFIX}*${SUFFIX} ]]; then
                  list=( "$list[@]" 
    	             "${i}:$(print -D ${(P)${compstate[parameter]}[$i]})" )
    	  else
    	      list=( "$list[@]" '' )
    	  fi
            done
            zstyle -s ":completion:${curcontext}:indexes" list-separator sep || sep=--
            zformat -a list " $sep " "$list[@]"
    	disp=( -d list)
          else
            disp=()
          fi
    
          if [[ "$RBUFFER" = (|\\)\]* ]]; then
            _all_labels -V indexes expl 'array index' \
                compadd -S '' "$disp[@]" -a ind && ret=0
          else
            _all_labels -V indexes expl 'array index' \
                compadd -S "$osuf" "$disp[@]" -a ind && ret=0
          fi
        fi
        _requested parameters && _parameters && ret=0
    
        (( ret )) || return 0
      done
    
      return 1
    else
      _dispatch -math- -math-
    fi
    PK[h:functions/_directory_stacknuW+A#compdef popd
    
    # This just completes the numbers after +, showing the full directory list
    # with numbers. For - we do the same thing, but reverse the numbering (other
    # way round if pushdminus is set). Note that this function is also called
    # from _cd for cd and pushd.
    
    setopt localoptions nonomatch
    
    local expl list lines revlines disp sep
    
    ### we decided against this, for now...
    #! zstyle -T ":completion:${curcontext}:directory-stack" prefix-needed ||
    
    zstyle -s ":completion:${curcontext}:directory-stack" list-separator sep || sep=--
    
    [[ $PREFIX = [-+]* ]] || return 1
    
    if zstyle -T ":completion:${curcontext}:directory-stack" verbose; then
      # get the list of directories with their canonical number
      # and turn the lines into an array, removing the current directory
      lines=("${dirstack[@]}")
    
      if [[ ( $PREFIX[1] = - && ! -o pushdminus ) ||
            ( $PREFIX[1] = + && -o pushdminus ) ]]; then
        integer i
        revlines=( $lines )
        for (( i = 1; i <= $#lines; i++ )); do
          lines[$i]="$((i-1)) $sep ${revlines[-$i]##[0-9]#[	 ]#}"
        done
      else
        for (( i = 1; i <= $#lines; i++ )); do
          lines[$i]="$i $sep ${lines[$i]##[0-9]#[	 ]#}"
        done
      fi
      # get the array of numbers only
      list=( ${PREFIX[1]}${^lines%% *} )
      disp=( -ld lines )
    else
      list=( ${PREFIX[1]}{0..${#dirstack}} )
      disp=()
    fi
    
    _wanted -V directory-stack expl 'directory stack' \
        compadd "$@" "$disp[@]" -Q -a list
    PK[=functions/_fstatnuW+A#compdef fstat
    
    local pids
    pids=(${${${(f)"$(/usr/bin/procstat -ah)"}/[[:space:]]#/}/[[:space:]]*[[:space:]](ELF[[:digit:]]#[[:space:]]|-[[:space:]]#)/:})
    
    _arguments -s \
    '-f[restrict examination to files open in the same file systems as the named file arguments]' \
    '-M[extract values associated with the name list from the specified core]:core:_files' \
    '-N[extract the name list from the specified system]:system:' \
    '-m[include memory-mapped files in the listing]' \
    '-n[numerical format]' \
    '-p[report all files open by the specified process]:process id:(($pids))' \
    '-u[report all files open by the specified user]:user:_users' \
    '-v[verbose mode]' \
    '*:files:_files'
    PK[ifunctions/_joinnuW+A#compdef join
    
    # completions for GNU join version 5.97
    
    local arguments
    
    arguments=(
        '-a+[print unpairable lines coming from file FILENUM, where FILENUM is 1 or 2, corresponding to FILE1 or FILE2]:file number:(1 2)'
        '-e+[replace missing input fields with EMPTY]:replacement string:'
        '(-i --ignore-case)'{-i,--ignore-case}'[ignore differences in case when comparing fields]'
        "-j+[equivalent to '-1 FIELD -2 FIELD']:field number:"
        '-o+[obey FORMAT while constructing output line]:format string:'
        '-t+[use CHAR as input and output field separator]:separator:'
        '-v+[like -a FILENUM, but suppress joined output lines]:file number:(1 2)'
        '-1+[join on this FIELD of file 1]:field number:'
        '-2+[join on this FIELD of file 2]:field number:'
        --help'[display help and exit]'
        --version'[output version information and exit]'
        '1:file 1:_files'
        '2:file 2:_files'
        )
    
    _arguments -s $arguments
    PK[]11functions/_ipsetnuW+A#compdef ipset
    
    local offset=0
    local -a args from_to hash cmds listopts
    
    _set_types () {
    	_values -S \  "Set type" \
    		'ipmap[up to 65536 IP addresses]' \
    		'macipmap[up to 65536 IP addresses with MAC]' \
    		'portmap[up to 65536 ports]' \
    		'iphash[hash of IP addresses]' \
    		'nethash[hash of network addresses]' \
    		'ipporthash[hash of IP address and port pairs]' \
    		'ipportiphash[hash of IP address,port and IP address triples]' \
    		'ipportnethash[hash of IP address,port and network address triples]' \
    		'iptree[tree of IP addresses, optionally with timeout]' \
    		'iptreemap[tree of IP addresses or networks]' \
    		'setlist[list of sets]'
    }
    
    if [[ $words[2] = (-q|--quiet) ]]; then
    	offset=1
    fi
    
    _ipsets () {
    	local -a vals
    	vals=( ${${(M)${(f)"$(_call_program ipsets ipset -nL)"}%Name: *}#Name: } )
    	_describe -t ipsets "IP sets" vals
    }
    _sets () {
    	_ipsets
    	local -a vals
    	case $words[offset+2]; in
    	  -X|--destroy)
    		vals=('\:all\::remove all not referenced sets')
    	  ;;
    	  -F|--flush)
    		vals=('\:all\::flush all sets')
    	  ;;
    	  -L|--list|-nL|-sL|-nsL|-snL|-n|-s|-ns|-sn)
    		vals=('\:all\::list all sets')
    	  ;;
    	  -S|--save)
    		vals=('\:all\::save all sets')
    	esac
    	_describe -t special_values "special values" vals
    }
    
    from_to=('(--network)--from[from IP or network (with --netmask)]:IP'
    	'(--network)--to[to IP or network (with --netmask)]:IP'
    	'(--from --to)--network[network]:IP/mask'
    )
    hash=(	'--hashsize[the initial hash size (default 1024)]:hash size'
    	'--probes[max number of tries to resolve clashing (default 8)]:probes'
    	'--resize[ratio of increasing hash size after unsuccessful  number of double-hashing]:percent'
    )
    
    case $words[offset+2]; in
      -N|--create)
    	case $words[offset+4]; in
    	  ipmap)
    		args=(	$from_to
    			'--netmask[store network addresses instead of IP addresses]:CIDR'
    		)
    	  ;;
    	  macipmap)
    		args=(	$from_to
    			'--matchunset[always match IP addresses which could be stored in the set but are not]'
    		)
    	  ;;
    	  portmap)
    		args=(	'--from[from port]:port:_ports'
    			'--to[to port]:port:_ports'
    		)
    	  ;;
    	  iphash)
    		args=(	$hash
    			'--netmask[store network addresses instead of IP addresses]:CIDR'
    		)
    	  ;;
    	  nethash)
    		args=(	$hash )
    	  ;;
    	  ipporthash|ipportiphash|ipportnethash)
    		args=(	$from_to $hash )
    	  ;;
    	  iptree)
    	  	args=(	'--timeout[timeout value for the entries in seconds (default 0)]:timeout' )
    	  ;;
    	  iptreemap)
    	  	args=(	'--gc[garbage collection inverval (default 300 seconds)]:timeout' )
    	  ;;
    	  setlist)
    	  	args=(	'--size[size of the new setlist (default 8)]:size' )
    	  ;;
    	esac
      ;;
      -T|--test)
    	args=(	'(-b --binding)'{-b,--binding}'[test whether '$words[offset+4]' points to the specified binding]:::_ipsets' )
      ;;
      -B|--bind)
    	args=(	'(-b --binding)'{-b,--binding}'[value of the binding]:::_ipsets' )
      ;;
    esac
    
    _ips () {
    	if [[ $CURRENT -eq ((offset+4)) ]]; then
    		local ips=1 default
    		local -a vals vals1 vals2 bindings
    		vals=( ${${${(f)"$(_call_program ipsets ipset -nL $words[offset+3])"}[4,-1]}//\:/\\:} )
    		for i in $vals; do
    			if [[ $i = Default\ binding\\:* ]]; then default=${i#Default binding\\: }; continue; fi
    			if [[ $i = (Header\\:*|Members\\:) ]]; then continue; fi
    			if [[ $i = 'Bindings\:' ]]; then ips=0; continue; fi
    			if (( $ips )); then vals1+=$i; else bindings+=${i/ ->/:}; fi
    		done
    		case $words[offset+2]; in
    		  -T|--test)
    			vals2=('\:default\::test default binding of the set for --binding')
    		  ;;
    		  -B|--binding)
    			vals2=('\:default\::set default binding of the set')
    		  ;;
    		  -U|--unbind)
    			vals1=()
    			vals2=('\:all\::destroy the bindings of all elements of a set')
    			if [[ -n "$default" ]]; then
    			vals2+=("\:default\::remove default binding of the set to '$default'")
    			fi
    			_describe -t ipb "IPs from $words[offset+3] set with bindings" bindings
    		  ;;
    		esac
    		_describe -t ips "IPs from $words[offset+3] set" vals1
    		_describe -t special_values "special values" vals2
    	fi
    }
    
    cmds=(-N -X -F -E -W -S -R -A -D -T -B -U -H --create --destroy --flush --rename --swap --save --restore --add --del --test --bind --unbind --help)
    listopts=(-n --numeric -s --sorted -L --list -nL -sL -nsL -snL -ns -sn)
    
    _arguments \
    	"($cmds $listopts)"{-N,--create}'[create a set]:set name::::_set_types' \
    	"($cmds $listopts)"{-X,--destroy}'[destroy specified set (or all if none specified)]:set name:_sets' \
    	"($cmds $listopts)"{-F,--flush}'[flush specified set (or all if none specified)]:set name:_sets' \
    	"($cmds $listopts)"{-E,--rename}'[rename set]:current set name:_ipsets:new set name:' \
    	"($cmds $listopts)"{-W,--swap}'[swap two sets]:::_ipsets:::_ipsets' \
    	"($cmds -L --list -q --quiet -nL -sL -nsL -snL)"{-L,--list}'[list the entries and bindings for the specified set (or all if none specified)]:::_sets' \
    	"($cmds -L --list -q --quiet -n --numeric -snL -nsL -sL -ns -sn)"-nL'[list the entries and bindings for the specified set (or all if none specified) \- numeric output]:::_sets' \
    	"($cmds -L --list -q --quiet -s --sorted  -snL -nsL -nL -ns -sn)"-sL'[list the entries and bindings for the specified set (or all if none specified) \- sorted output]:::_sets' \
    	"($cmds $listopts -q --quiet)"{-nsL,-snL}'[list the entries and bindings for the specified set (or all if none specified) \- sorted numeric output]:::_sets' \
    	"($cmds $listopts)"{-S,--save}'[save the given set (or all if none specified)]:::_sets' \
    	"($cmds $listopts)"{-R,--restore}'[restore a saved session generated by --save from stdin]' \
    	"($cmds $listopts)"{-A,--add}'[add an IP to a set]:::_ipsets:IP' \
    	"($cmds $listopts)"{-D,--del}'[delete an IP from a set]:::_ipsets:::_ips' \
    	"($cmds $listopts)"{-T,--test}'[test wether an IP is in a set or the IP points to the specified binding]:::_ipsets:::_ips' \
    	"($cmds $listopts)"{-B,--bind}'[bind the IP in setname to to-setname]:::_ipsets:::_ips' \
    	"($cmds $listopts)"{-U,--unbind}'[delete the binding belonging to IP in set setname]:::_ipsets:::_ips' \
    	"($cmds $listopts)"{-H,--help}'[print help and settype specific help if settype specified]:::_set_types' \
    	"(-q --quiet $listopts)"{-q,--quiet}'[suppress any output to stdout and stderr]' \
    	"($cmds -s --sorted  -q --quiet -sL -nsL -snL -ns -sn)"{-s,--sorted}'[sorted output]' \
    	"($cmds -n --numeric -q --quiet -nL -nsL -snL -ns -sn)"{-n,--numeric}"[numeric output; don't resolve host names, network names and services]" \
    	"($cmds -ns -sn  -q --quiet -nL -sL -nsL -snL -n --numeric -s --sorted)"{-ns,-sn}'[sorted numeric output]' \
    	"$args[@]"
    PK[)functions/_losetupnuW+A#compdef losetup
    
    local cyphers
    cyphers=( /proc/crypto/cipher/*(N:t) )
    cyphers="${cyphers[@]%-*}"
    
    _arguments -S \
      '(- 2)'{--delete,--detach,-d}'[detach from specified loop device]' \
      '(-d --delete --detach -e --encryption)'{-e,--encryption}"+[enable encryption]:cypher:( $cyphers )" \
      '(-d --delete --detach -o --offset)'{-o,--offset}'+[specify data start is offset]:offset (bytes)' \
      '(-d --delete --detach -p --pass-fd)'{-p,--pass-fd}'+[read passphrase from specified file descriptor]:file descriptor:_file_descriptors' \
      '(-d --delete --detach -k --keybits)'{-k,--keybits}'+[set the number of bits to use in key]:key size:(64 128 160 192 256)' \
      '1:device:_files -g "loop*(-.)"' \
      '(-d --delete --detach)2:file:_files'
    PK[Bfunctions/_awknuW+A#compdef awk
    
    # completions for awk
    # This only aims to complete POSIX awk options, as described in
    # awk(P). Most awk implementations, such as gawk and mawk, will have
    # additional options that this does not complete. Also, currently
    # this completion does not allow everything that POSIX allows. For
    # example, awk(P) states that the user may specify assignments
    # without using the -v option; this does not support that.
    #
    # In addition, the "program text" completion is not perfect. For
    # instance, type "awk -" and then hit tab. You will be presented
    # both with the dashed options and with the "program text" option.
    # Fixing this is beyond my current _arguments expertise--help
    # appreciated.
    
    _arguments -S -s '-F[define input field separator to be an extended regular expression]:extended regular expression:' \
        '*-v[assign values to variables]:assignment:' \
        '(1)-f[program file]:program file:_files' \
        '1:program text:' \
        '*:input files:_files'
    PK[_Sfunctions/_expandnuW+A#autoload
    
    # This completer function is intended to be used as the first completer
    # function and allows one to say more explicitly when and how the word
    # from the line should be expanded than expand-or-complete.
    # This function will allow other completer functions to be called if
    # the expansions done produce no result or do not change the original
    # word from the line.
    
    setopt localoptions nonomatch
    
    [[ _matcher_num -gt 1 ]] && return 1
    
    local exp word sort expr expl subd suf=" " force opt asp tmp opre pre epre
    local continue=0
    
    (( $# )) &&
        while getopts gsco opt; do
          force="$force$opt"
        done
    
    if [[ "$funcstack[2]" = _prefix ]]; then
      word="$IPREFIX$PREFIX$SUFFIX"
    else
      word="$IPREFIX$PREFIX$SUFFIX$ISUFFIX"
    fi
    
    [[ "$word" = *\$(|\{[^\}]#) ||
       ( "$word" = *\$[a-zA-Z0-9_]## && $+parameters[${word##*\$}] -eq 0 ) ]] &&
        return 1
    
    ### I'm not sure about the pattern to use in the following test.
    # It once was:
    #  [[ "$word" = (\~*/|\$(|[=~#^+])[a-zA-Z0-9_\[\]]##[^a-zA-Z0-9_\[\]]|\$\{*\}?)[^\$\{\}\(\)\<\>?^*#~]# ]] &&
    
    zstyle -T ":completion:${curcontext}:" suffix &&
      [[ "$word" = (\~*/*|*\$(|[=~#^+])[a-zA-Z0-9_\[\]]##[^a-zA-Z0-9_\[\]]|*\$\{*\}?) &&
         "${(e)word}" != (#s)(*[^\\]|)[][^*?\(\)\<\>\{\}\|]* ]] &&
      return 1
    
    zstyle -s ":completion:${curcontext}:" accept-exact tmp ||
        [[ ! -o recexact ]] || tmp=1
    
    if [[ "$tmp" != (yes|true|on|1) ]]; then
      { [[ "$word" = \~(|[-+]) ||
           ( "$word" = \~[-+][1-9]## && $word[3,-1] -le $#dirstack ) ]] && return 1 }
      { [[ ( "$word" = \~* && ${#userdirs[(I)${word[2,-1]}*]}+${#nameddirs[(I)${word[2,-1]}*]} -gt 1 ) ||
           ( "$word" = *\$[a-zA-Z0-9_]## && 
             ${#parameters[(I)${word##*\$}*]} -ne 1 ) ]] && continue=1 }
      [[ continue -eq 1 && "$tmp" != continue ]] && return 1
    fi
    
    # In exp we will collect the expansions.
    
    exp=("$word")
    
    # First try substitution. That weird thing spanning multiple lines
    # changes quoted spaces, tabs, and newlines into spaces and protects
    # this function from aborting on parse errors in the expansion.
    
    if [[ "$force" = *s* ]] ||
       zstyle -T ":completion:${curcontext}:" substitute; then
    
    ###  We once used this:
    ###
    ###  [[ ! -o ignorebraces && "${#${exp}//[^\{]}" = "${#${exp}//[^\}]}" ]] &&
    ###      eval exp\=\( ${${(q)exp}:gs/\\{/\{/:gs/\\}/\}/} \) 2>/dev/null
    ###
    ###  instead of the following loop to expand braces.  But that made
    ###  parameter expressions such as ${foo} be expanded like brace
    ###  expansions, too (and with braceccl set...).
    
       if [[ ! -o ignorebraces && "${#${exp}//[^\{]}" = "${#${exp}//[^\}]}" ]]; then
         local otmp
    
         tmp=${(q)word}
         while [[ $#tmp != $#otmp ]]; do
           otmp=$tmp
           tmp=${tmp//(#b)\\\$\\\{(([^\{\}]|\\\\{|\\\\})#)([^\\])\\\}/\\$\\\\{${match[1]}${match[3]}\\\\}}
         done
         eval exp\=\( ${tmp:gs/\\{/\{/:gs/\\}/\}/} \) 2>/dev/null
       fi
    
    ###  There's a bug: spaces resulting from brace expansion are quoted in
    ###  the following expression, too.  We don't want that, but I have no
    ###  idea how to fix it.
    
      setopt aliases
      eval 'exp=( ${${(e)exp//\\[ 	
    ]/ }//(#b)([ 	
    ])/\\$match[1]} )' 2>/dev/null
      setopt NO_aliases
    else
      exp=( ${exp:s/\\\$/\$} )
    fi
    
    # If the array is empty, store the original string again.
    
    [[ -z "$exp" ]] && exp=("$word")
    
    subd=("$exp[@]")
    
    # Now try globbing.
    
    [[ "$force" = *g* ]] || zstyle -T ":completion:${curcontext}:" glob &&
        eval 'exp=( ${~exp//(#b)\\[ 	
    ]/$match[1]} ); exp=( ${(q)exp} )' 2>/dev/null
    
    ### Don't remember why we once used this instead of the (q) above.
    #    eval 'exp=( ${~exp} ); exp=( ${exp//(#b)([][()|*?^#~<>\\=])/\\${match[1]}} )' 2>/dev/null
    
    # If we don't have any expansions or only one and that is the same
    # as the original string, we let other completers run.
    
    (( $#exp )) || exp=("$subd[@]")
    
    [[ $#exp -eq 1 && "${exp[1]//\\}" = "${word//\\}"(|\(N\)) ]] && return 1
    
    # With subst-globs-only we bail out if there were no glob expansions,
    # regardless of any substitutions
    
    { [[ "$force" = *o* ]] ||
      zstyle -t ":completion:${curcontext}:" subst-globs-only } &&
      [[ "$subd" = "$exp"(|\(N\)) ]] &&  return 1
    
    zstyle -s ":completion:${curcontext}:" keep-prefix tmp || tmp=changed
    
    if [[ "$word" = (\~*/*|*\$*/*) && "$tmp" = (yes|true|on|1|changed) ]]; then
      if [[ "$word" = *\$* ]]; then
        opre="${(M)word##*\$[^/]##/}"
      else
        opre="${word%%/*}"
      fi
      eval 'epre=( ${(e)~opre} )' 2> /dev/null
    
      if [[ -n "$epre" && $#epre -eq 1 ]]; then
        pre="${(q)epre[1]}"
        [[ ( "$tmp" != changed || $#exp -gt 1 ||
           "${opre}${exp[1]#${pre}}" != "$word" ) && "${exp[1]}" = $pre* ]] &&
           exp=( ${opre}${^exp#${pre}} )
      fi
      [[ $#exp -eq 1 && "$exp[1]" = "$word" ]] && return 1
    fi
    
    # Now add as matches whatever the user requested.
    
    zstyle -s ":completion:${curcontext}:" sort sort
    
    [[ "$sort" = (yes|true|1|on) ]] && exp=( "${(@o)exp}" )
    
    if zstyle -s ":completion:${curcontext}:" add-space tmp; then
      if [[ "$tmp" != *subst* || "$word" != *\$* || "$exp[1]" = *\$* ]]; then
        [[ "$tmp" = *file* ]] && asp=file
        [[ "$tmp" = *(yes|true|1|on|subst)* ]] && asp="yes$asp"
      fi
    else
      asp=file
    fi
    
    # If there is only one expansion, add a suitable suffix
    
    if (( $#exp == 1 )); then
      if [[ -d ${exp[1]/${opre}/${pre}} && "$exp[1]" != */ ]]; then
        suf=/
      elif [[ "$asp" = yes* ||
              ( "$asp" = *file && -f "${exp[1]/${opre}/${pre}}" ) ]]; then
        suf=' '
      else
        suf=
      fi
    fi
    
    if [[ -z "$compstate[insert]" ]] ;then
      if [[ "$sort" = menu ]]; then
        _description expansions expl expansions "o:$word"
      else
        _description -V expansions expl expansions "o:$word"
      fi
    
      compadd "$expl[@]" -UQ -qS "$suf" -a exp
    else
      _tags all-expansions expansions original
    
      if [[ $#exp -gt 1 ]] && _requested expansions; then
        local i j normal space dir
    
        if [[ "$sort" = menu ]]; then
          _description expansions expl expansions "o:$word"
        else
          _description -V expansions expl expansions "o:$word"
        fi
        normal=()
        space=()
        dir=()
    
        for i in "$exp[@]"; do
          j="${i/${opre}/${pre}}"
          if [[ -d "$j" && "$i" != */ ]]; then
            dir=( "$dir[@]" "$i" )
          elif [[ "$asp" = yes* || ( "$asp" = *file && -f "$j" ) ]]; then
            space=( "$space[@]" "$i" )
          else
    	normal=( "$normal[@]" "$i" )
          fi
        done
        (( $#dir ))    && compadd "$expl[@]" -UQ -qS/ -a dir
        (( $#space ))  && compadd "$expl[@]" -UQ -qS " " -a space
        (( $#normal )) && compadd "$expl[@]" -UQ -qS "" -a normal
      fi
      if _requested all-expansions expl 'all expansions'; then
        local disp dstr
    
        if [[ "${#${exp}}" -ge COLUMNS ]]; then
          disp=( -ld dstr )
          dstr=( "${(r:COLUMNS-5:)exp} ..." )
        else
          disp=()
        fi
        [[ -o multios ]] && exp=($exp[1] $compstate[redirect]${^exp[2,-1]})
        compadd "$disp[@]" "$expl[@]" -UQ -qS "$suf" - "$exp"
      fi
    
      _requested original expl original && compadd "$expl[@]" -UQ - "$word"
    
      compstate[insert]=menu
    fi
    
    return continue
    PK[ccfunctions/_fehnuW+A#compdef feh
    ## completion for feh 1.6, based on feh(1)
    
    typeset -a arguments
    typeset -A argument_pairs argument_postfix
    typeset arg
    
    argument_pairs=(
    	'help'        'h'
    	'version'     'v'
    	'verbose'     'V'
    	'quiet'       'q'
    	'theme'       'T+'
    	'recursive'   'r'
    	'randomize'   'z'
    	'filelist'    'f+'
    	'preload'     'p'
    	'full-screen' 'F'
    	'geometry'    'g+'
    	'auto-zoom'   'Z'
    	'multiwindow' 'w'
    	'borderless'  'x'
    	'draw-filename' 'd'
    	'slideshow-delay' 'D+'
    	'reload'      'R+'
    	'keep-http'   'k'
    	'builtin'     'Q'
    	'list'        'l'
    	'customlist'  'L+'
    	'loadable'    'U'
    	'unloadable'  'u'
    	'sort'        'S+'
    	'reverse'     'n'
    	'action'      'A+'
    	'montage'     'm'
    	'collage'     'c'
    	'index'       'i'
    	'fullindex'   'I'
    	'thumbnails'  't'
    	'menu-font'   'M+'
    	'no-menus'    'N'
    	'reload-button' '0'
    	'menu-button' '3+'
    	'prev-button' '4+'
    	'next-button' '5+'
    	'rotate-button' '8+'
    	'blur-button' '9+'
    	'ignore-aspect' 'X'
    	'stretch'     's'
    	'thumb-width' 'y+'
    	'thumb-height' 'E+'
    	'limit-width' 'W+'
    	'limit-height' 'H+'
    	'bg'          'b+'
    	'alpha'       'a+'
    	'font'        'e+'
    	'scale-down'  '.'
    	'output-dir'  'j+'
    	'wget-timestamp' 'G'
    	'fontpath'    'C+'
    	'image-bg'    'B+'
    	'output'      'o'
    	'output-only' 'O'
    	'rcfile'      '_'
    	'thumb-title' '~'
    	'title'       '^'
    	'start-at'    '|'
    	'title-font'  '@'
    )
    
    argument_postfix=(
    	'help'        '[show help]'
    	'version'     '[show version information]'
    	'verbose'     '[be verbose]'
    	'quiet'       '[suppress non-fatal errors]'
    	'theme'       '[load named options from config]:theme:_feh_theme'
    	'recursive'   '[recurse into subdirectories]'
    	'randomize'   '[randomize file list before displaying]'
    	'filelist'    '[read file list from this file]:file:_files'
    	'preload'     '[eliminate unlaodable images before displaying]'
    	'full-screen' '[make the window fullscreen]'
    	'geometry'    '[limit window size]:geometry: '
    	'auto-zoom'   '[zoom picture to screen size]'
    	'multiwindow' '[multiple windows, one image per window]'
    	'borderless'  '[borderless windows]'
    	'draw-filename' '[show filename in images]'
    	'reload'      '[time delay for reloading]:time: '
    	'keep-http'   "[don't delete cached files]"
    	'builtin'     '[use builtin http client]'
    	'list'        '[list images, their size, etc.]'
    	'customlist'  '[format list output]:format: '
    	'loadable'    '[print loadable images]'
    	'unloadable'  '[print unloadable images]'
    	'sort'        '[sort images]:sort type:(name filename width height pixels size format)'
    	'reverse'     '[reverse sort order]'
    	'action'      '[action to perform on each image]:shell: '
    	'montage'     '[enable montage mode]'
    	'collage'     '[enable collage mode]'
    	'index'       '[enable index mode]'
    	'fullindex'   '[enable verbose index mode]'
    	'thumbnails'  '[enable interactive index mode]'
    	'menu-font'   '[set font in menus]:font: '
    	'no-menus'    "[don't load or show any menus]"
    	'reload-button' '[button to reload image]:button:_feh_button'
    	'pan-button'  '[button to pan image]:button:_feh_button'
    	'zoom-button' '[button to zoom image]:button:_feh_button'
    	'menu-button' '[button to activate menu]:button:_feh_button'
    	'prev-button' '[button to go to previous image]:button:_feh_button'
    	'next-button' '[button to go to next image]:button:_feh_button'
    	'rotate-button' '[Ctrl+Button to rotate image]:button:_feh_button'
    	'blur-button' '[Ctrl+Button tu blur image]:button:_feh_button'
    	'ignore-aspect' "[montage mode: Don't preserve aspect ratio]"
    	'stretch'     '[montage mode: Enlarge images to fit thumbnail size]'
    	'thumb-width' '[montage mode: Thumbnail width]:pixels: '
    	'thumb-height' '[montage mode: Thumbnail height]:pixels: '
    	'limit-width' '[montage mode: Limit montage width]:pixels: '
    	'limit-height' '[montage mode: Limit montage heihgt]:pixels: '
    	'bg'          '[montage mode: Background image]:file:_files'
    	'alpha'       '[montage mode: Thumbnail transparency level]:integer: '
    	'font'        '[index mode: Thumbnail info font]:font: '
    	'slideshow-delay' '[slide change delay]:seconds'
    	'scale-down'  '[scale down images which are too big]'
    	'output-dir'  '[save files to DIR (with -k)]:directory:_files -/'
    	'wget-timestamp' '[add no timestamp ("?123") to URLs]'
    	'fontpath'    '[add paths to font path]:font path:_files -/'
    	'image-bg'    '[set transparent image background]:background:(white black default)'
    	'output'      '[montage mode: Output file]:file:_files'
    	'output-only' "[montage mode: Output file, don't display montage]:file: files"
    	'rcfile'      '[specify config file]:file:_files'
    	'thumb-title' '[window title in thumbnail mode]:format string'
    	'title'       '[window title in slideshow mode]:format string'
    	'start-at'    '[start slideshow at]:file:_files'
    	'title-font'  '[title font for index mode]:font'
    )
    
    arguments=(
    	'--zoom[zoom images]:percent: '
    	'--caption-path[where to look for image captions]:relative directory: '
    	--action{1..9}':shell: '
    	'--bg-tile[set tiled desktop background]:file:_files'
    	'--bg-center[set centered desktop background]:file:_files'
    	'--bg-scale[set scaled desktop background]:file:_files'
    	'--bg-seamless[set desktop background with seamless borders]:file:_files'
    	'--bg-fill[set scaled desktop background, preserving aspect ratio]:file:_files'
    	'--menu-style[style descriptor for menu text]:file:_files'
    	'--menu-border[set menu background border]:integer: '
    	'--menu-ctrl-mask[use Ctrl+Button to display menu]'
    	'--no-rotate-ctrl-mask[don'\''t require Ctrl for the rotate button]'
    	'--no-blur-ctrl-mask[don'\''t require Ctrl for the blur button]'
    	'--no-xinerama[disable xinerama support]'
    	'--screen-clip[toggle window clipping]'
    	'--hide-pointer[hide mouse pointer in fullscreen mode]'
    	'*--fontpath[index mode: directory to search for fonts]:directory:_path_files -/'
    	'--index-name[show image name in index/thumbnail mode]:bool:(0 1)'
    	'--index-size[show image size in index/thumbnail mode]:bool:(0 1)'
    	'--index-dim[show image dimensions in index/thumbnail mode]:bool:(0 1)'
    	'--no-jump-on-resort[stay at current image after resorting the filelist]'
    	'--cycle-once[quit after one loop through the slideshow]'
    	'--draw-actions[draw defined actions]'
    	'--cache-thumbnails[enable thumbnail caching]'
    	'--menu-bg[background image in menus]: :_feh_background'
    	'--thumb-redraw[set thumbnail image redraw frequency]:digit'
    	'*:file:_files'
    )
    
    for arg in ${(k)argument_pairs}; {
    	arguments+='(--'${arg}')-'${argument_pairs[$arg]}${argument_postfix[$arg]}
     	arguments+='(-'${argument_pairs[$arg]}[1]')--'${arg}${argument_postfix[$arg]}
    }
    
    function _feh_theme {
    	if [[ -r ~/.fehrc ]]; then
    		typeset -a themes tmp
    		typeset theme IFS=$'\n'
    		for theme in $(grep "\w" ~/.fehrc | grep -v "^#"); do
    			tmp=(${(s: :)theme})
    			theme=${tmp[1]}
    			shift tmp
    			themes+=${theme}:${(j: :)tmp}
    		done
    		_describe 'theme' themes
    	fi
    }
    
    function _feh_button {
    	typeset expl
    	_wanted button expl button \
    	compadd {0..5}
    }
    
    function _feh_background {
    	_alternative \
    	'file:file:_files' \
    	'mode:mode:(trans)'
    }
    
    _arguments -s ${arguments}
    PK[7
    functions/_gvnuW+A#compdef gv
    
    _arguments \
      '-geometry:geometry:_x_geometry' \
      '(--nosafer)--safer' \
      '(--safer)--nosafer' \
      '(--noquiet)--quiet' \
      '(--quiet)--noquiet' \
      '(--nocenter)--center' \
      '(--center)--nocenter' \
      '(--noswap)--swap' \
      '(--swap)--noswap' \
      '(--noantialias)--antialias' \
      '(--antialias)--noantialias' \
      '(--nodsc)--dsc' \
      '(--dsc)--nodsc' \
      '(--noeof)--eof' \
      '(--eof)--noeof' \
      '(--nopixmap)--pixmap' \
      '(--pixmap)--nopixmap' \
      '(--nowatch)--watch' \
      '(--watch)--nowatch' \
      '(--noresize)--resize' \
      '(--resize)--noresize' \
      '(--grayscale --color)--monochrome' \
      '(--monochrome --color)--grayscale' \
      '(--grayscale --color)--monochrome' \
      '(--landscape --seascape --upsidedown)--portrait' \
      '(--portrait --seascape --upsidedown)--landscape' \
      '(--portrait --landscape --upsidedown)--seascape' \
      '(--portrait --landscape --seascape)--upsidedown' \
      --{help,spartan} \
      -{h,v} \
      '--arguments=:ghostscript arguments:' \
      '--page=:label of first page:' \
      '--media=:page size:(Letter Legal Statement Tabloid Ledger Folio Quarto 10x14 Executive A3 A4 A5 B4 B5)' \
      '--orientation=:orientation:' \
      '--scale=:scale entry:' \
      '--scalebase=:scale base:' \
      '--ad=:resource file:_files' \
      '--style=:resource file:_files' \
      '*:file: _pspdf -z'
    PK[*functions/_mannuW+A#compdef man apropos whatis
    
    _man() {
      local dirs expl mrd awk
    
      if (( $words[(I)-M] == (( $CURRENT - 1 )) )); then
        _directories && return 0
      fi
    
      if [[ $service == man ]] && (( $words[(I)-l] + $words[(I)--local-file] )); then
        _files || return 0
      fi
    
      if (( ! $#_manpath )); then
        local mp
        mp=( ${(s.:.)$(manpath 2>/dev/null)} )
        [[ "$mp" == *:* ]] && mp=( ${(s.:.)mp} )
        if (( $#mp )); then
          _manpath=( $mp )
        elif (( $#manpath )); then
          _manpath=( $manpath )
        fi
      fi
    
      (( $#_manpath )) ||
          _manpath=( /usr/man(-/) /(opt|usr)/(pkg|dt|share|X11R6|local)/(cat|)man(-/) )
    
      integer index=$words[(I)-M]
      if (( index )); then
        local opt
        opt=$words[index+1]
        _manpath=($_manpath $opt)
      fi
    
      # `sman' is the SGML manual directory for Solaris 7.
      # 1M is system administrator commands on SVR4
    
      mrd=(${^_manpath/\%L/${LANG:-En_US.ASCII}}/mandb(N))
    
      local sect
      if [[ $OSTYPE = solaris* ]]; then
        sect=${${words[(R)-s*]#-s}:-$words[$words[(i)-s]+1]}
      elif [[ -n ${sect:=$words[$words[(i)-S]+1]} || -n ${sect:=$MANSECT} ]]; then
        if [[ $sect != ${sect::="${sect//:/|}"} ]]; then
          sect="($sect)"
        fi
      elif (( CURRENT > 2 )); then
        sect=$words[2]
      fi
    
      if [[ $sect = (<->*|1M|l|n) || $sect = \(*\|*\) ]]; then
        dirs=( $^_manpath/(sman|man|cat)${~sect}/ )
        awk="\$2 == \"$sect\" {print \$1}"
      else
        dirs=( $^_manpath/(sman|man|cat)*/ )
        awk='{print $1}'
      fi
      if [[ $OSTYPE = solaris* && ( $words[CURRENT] = -s* || $words[CURRENT-1] == -s ) ]]; then
        [[ $words[CURRENT] = -s* ]] && compset -P '-s'
        sects=( ${(o)${dirs##*(man|cat)}%/} )
        _wanted sections expl 'section' compadd -a sects
      elif zstyle -t ":completion:${curcontext}:manuals" separate-sections; then
        typeset -U sects
        local ret=1
    
        sects=( ${(o)${dirs##*(man|cat)}%/} )
    
        (( $#sects )) || return 1
    
        _tags manuals.${^sects}
        while _tags; do
          for sect in $sects; do
            _requested manuals.$sect expl "manual page, section $sect" _man_pages &&
                ret=0
          done
          (( ret )) || return 0
        done
    
        return 1
      else
        sect=
        _wanted manuals expl 'manual page' _man_pages
      fi
    }
    
    _man_pages() {
      local matcher pages dummy sopt
    
      # What files corresponding to manual pages can end in.
      local suf='.((?|<->*)(|.gz|.bz2|.Z|.lzma))'
    
      if [[ $PREFIX$SUFFIX = */* ]]; then
        # Easy way to test for versions of man that allow file names.
        # This can't be a normal man page reference.
        # Try to complete by glob first.
        _path_files -g "*$suf" && return
        _path_files
        return
      fi
    
      zparseopts -E M+:=matcher
    
      if (( $#matcher )); then
        matcher=( ${matcher:#-M} )
        matcher="$matcher"
      else
        matcher=
      fi
    
      pages=( ${(M)dirs:#*$sect/} )
      compfiles -p pages '' '' "$matcher" '' dummy '*'
      pages=( ${^~pages}(N:t) )
    
      (($#mrd)) && pages[$#pages+1]=($(awk $awk $mrd))
    
      # Remove any compression suffix, then remove the minimum possible string
      # beginning with .<->: that handles problem cases like files called
      # `POSIX.1.5'.
    
      [[ $OSTYPE = solaris* ]] && sopt='-s '
      if ((CURRENT > 2)) ||
          ! zstyle -t ":completion:${curcontext}:manuals.$sect" insert-sections
      then
        compadd "$@" - ${pages%$~suf}
      else
        compadd "$@" -P "$sopt$sect " - ${pages%$~suf}
      fi
    }
    
    _man "$@"
    PK[8twwfunctions/zsh-mime-handlernuW+A# Handler for MIME types using associative arrays
    # zsh_mime_handlers and zsh_mime_flags set up by zsh-mime-setup.
    #
    # The only flags it handles are copiousoutput and needsterminal.
    # copiousoutput is assumed to imply needsterminal.  Apart from
    # those, it tries to be a bit cunning about quoting, which
    # can be a nightmare in MIME handling.  If it sees something like
    #   netscape %s
    # and it only has one file to handle (the usual case) then it will handle it
    # internally just by appending a file.
    #
    # Anything else is handled by passing to sh -c, which is the only think
    # with a high probability of working.  If it sees something with
    # quotes, e.g.
    #   /usr/bin/links "%s"
    # it will assume someone else has tried to fix the quoting problem and not
    # do that.  If it sees something with no quotes but other metacharacters,
    # e.g.
    #   cat %s | handler
    # then it will do any quoting and pass the result to sh -c.
    # So for example if the argument is "My File", the command executed
    # is supposedly
    #   sh -c 'cat My\ File | handler'
    #
    # This note is mostly here so you can work out what I tried to do when
    # it goes horribly wrong.
    
    local autocd
    [[ -o autocd ]] && autocd=autocd
    
    emulate -L zsh
    setopt extendedglob cbases nullglob $autocd
    
    # We need zformat from zsh/zutil for %s replacement.
    zmodload -i zsh/zutil
    
    # Look for options.  Because of the way this is usually invoked,
    # (there is always a command to be handled), only handle options
    # up to second last argument.
    local opt
    integer list
    while (( $# - $OPTIND > 0 )); do
      if getopts "l" opt; then
        case $opt in
          (l)
          list=1
          ;;
    
          (*)
          return 1
          ;;
        esac
      else
        break
      fi
    done
    shift $(( OPTIND - 1 ))
    
    # Always called with a filename argument first.
    # There might be other arguments; don't really know what to do
    # with these, but if they came from e.g. `*.ps' then we might
    # just as well pass them all down.  However, we just take the
    # suffix from the first since that's what invoked us via suffix -s.
    
    local suffix context
    local -a match mbegin mend
    
    [[ $1 = (#b)*.([^.]##) ]] || return 1
    suffix=${(L)match[1]}
    context=":mime:.${suffix}:"
    
    local handler flags no_sh no_bg arg
    integer i
    local -a exec_asis hand_nonex
    
    # Set to a list of patterns which are ignored and executed as they are,
    # despite being called for interpretation by the mime handler.
    # Defaults to executable files, which ensures that they are executed as
    # they are, even if they have a suffix.
    zstyle -a $context execute-as-is exec_asis || exec_asis=('*(*)' '*(/)')
    
    # Set to a list of patterns for which the handler will be used even
    # if the file doesn't exist on the disk.
    zstyle -a $context handle-nonexistent hand_nonex ||
      hand_nonex=('[[:alpha:]]#:/*')
    
    local pattern
    local -a files
    
    # Search some path for the file, if required.
    # We do this before any other tests that need to find the
    # actual file or its directory.
    local dir
    local -a filepath
    if zstyle -t $context find-file-in-path && [[ $1 != /* ]] &&
      [[ $1 != */* || -o pathdirs ]]; then
      zstyle -a $context file-path filepath || filepath=($path)
      for dir in $filepath; do
        if [[ -e $dir/$1 ]]; then
          1=$dir/$1
          break
        fi
      done
    fi
    
    # In case the pattern contains glob qualifiers, as it does by default,
    # we need to do real globbing, not just pattern matching.
    # The strategy is to glob the files in the directory using the
    # pattern and see if the one we've been passed is in the list.
    local dirpref=${1%/*}
    if [[ $dirpref = $1 ]]; then
      dirpref=
    else
      dirpref+=/
    fi
    
    for pattern in $exec_asis; do
      files=(${dirpref}${~pattern})
      if [[ -n ${files[(r)$1]} ]]; then
        if (( list )); then
          for (( i = 1; i <= $#; i++ )); do
    	(( i == 1 )) || print -n " "
    	arg=${argv[i]}
    	if [[ -n $arg ]]; then
    	  print -rn -- ${(q)arg}
    	else
    	  print "''"
    	fi
          done
          print
        else
          "$@"
        fi
        return
      fi
    done
    
    if [[ ! -e $1 ]]; then
      local nonex_ok
      for pattern in $hand_nonex; do
        if [[ $1 = ${~pattern} ]]; then
          nonex_ok=1
          break
        fi
      done
      if [[ -z $nonex_ok ]]; then
        if (( list )); then
          print -r -- "${(q)@}"
        else
          "$@"
        fi
        return
      fi
    fi
    
    zstyle -s $context handler handler ||
      handler="${zsh_mime_handlers[$suffix]}"
    zstyle -s $context flags flags ||
      flags="${zsh_mime_flags[$suffix]}"
    
    # Set to yes if we use eval instead of sh -c for complicated mailcap lines
    # Can possibly break some mailcap entries which expect sh compatibility,
    # but is faster, as a new process is not spawned.
    zstyle -t $context current-shell && no_sh=yes
    
    # Set to yes if the process shouldn't be backgrounded even if it doesn't need a
    # terminal and display is set.
    zstyle -t $context never-background && no_bg=yes
    
    local hasmeta stdin
    
    # See if the handler has shell metacharacters in.
    # Don't count whitespace since we can split that when it's unquoted.
    if [[ $handler = *[\\\;\*\?\|\"\'\`\$]* ]]; then
        hasmeta=1
    fi
    
    local -a execargs files
    
    if [[ $handler = *%s* ]]; then
      # We need to replace %s with the file(s).
      local command
      if [[ -n $hasmeta || $# -gt 1 ]]; then
        # The handler is complicated, either due to special
        # characters or multiple files.  We are going to pass it
        # down to sh, since it's probably written for sh syntax.
        #
        # See if it's a good idea to quote the filename(s).
        # It isn't if there are already quotes in the handler, since
        # that means somebody already tried to take account of that.
        if [[ $handler = *[\'\"]* ]]; then
          # Probably we ought not even to handle multiple
          # arguments, but at least the error message ought
          # to make it obvious what's going on.
          zformat -f command $handler s:"$argv[1]"
        else
          zformat -f command $handler s:"${(q)argv[1]}"
        fi
        if (( list )); then
          execargs=(${(Q)${(z)command}} ${argv[1,-1]})
        elif [[ $no_sh = yes ]]; then
          execargs=(eval $command)
        else
          execargs=(sh -c $command)
        fi
      else
        # Simple command, one filename.
        # Split and add the file without extra quoting,
        # since later we will just execute the array as is.
        for command in ${=handler}; do
    	zformat -f command $command s:"$1"
    	execargs+=($command)
        done
      fi
    else
      # If there's no %s, the input is supposed to come from stdin.
      stdin=1
      if [[ -n $hasmeta && $no_sh != yes && list -eq 0 ]]; then
        execargs=(sh -c "$handler")
      else
        execargs=(${=handler})
      fi
    fi
    
    if (( list )); then
      for (( i = 1; i <= ${#execargs}; i++ )); do
        (( i == 1 )) || print -n " "
        arg=${execargs[i]}
        if [[ -n $arg ]]; then
          print -rn -- ${(q)arg}
        else
          print -n "''"
        fi
      done
      print
      return 0
    fi
    
    # Now execute the command in the appropriate fashion.
    if [[ $flags = *copiousoutput* ]]; then
      # We need to page the output.
      # Careful in case PAGER is a set of commands and arguments.
      local -a pager
      zstyle -a $context pager pager || pager=(${=PAGER:-more})
      if [[ -n $stdin ]]; then
        cat $argv | $execargs | $pager
      else
        $execargs | eval ${PAGER:-more}
      fi
    elif [[ $no_bg = yes || $flags = *needsterminal* || -z $DISPLAY ]]; then
      # Needs a terminal, so run synchronously.
      # Obviously, if $DISPLAY is empty but the handler needs a
      # GUI we are in trouble anyway.  However, it's possible for
      # the handler to be smart about this, like pick-web-browser,
      # and even if it just produces an error message it's better to
      # have it run synchronously.
      if [[ -n $stdin ]]; then
        cat $argv | $execargs
      else
        $execargs
      fi
    else
      # Doesn't need a terminal and we have a $DISPLAY, so run
      # it in the background.  sh probably isn't smart enough to
      # exec the last command in the list, but it's not a big deal.
      #
      # The following Rococo construction is to try to make
      # the job output for the backgrounded command descriptive.
      # Otherwise it's equivalent to removing the eval and all the quotes,
      # including the (q) flags.
      if [[ -n $stdin ]]; then
        eval cat ${(q)argv} "|" ${(q)execargs} "&"
      else
        eval ${(q)execargs} "&"
      fi
    fi
    PK[%		functions/_acpitoolnuW+A#compdef acpitool
    
    local ret=1 selbrands disambig
    typeset -a brands args
    
    if ! zstyle -a ":completion:${curcontext}:" acpi-extensions brands || \
      (( $brands[(I)detect] )); then
      [[ -d /proc/acpi/toshiba ]] && brands+=toshiba
      [[ -d /proc/acpi/asus ]] && brands+=asus
      [[ -d /proc/acpi/ibm ]] && brands+=thinkpad
    elif (( $brands[(I)all] )); then
      brands=(toshiba asus thinkpad)
    fi
    
    args=(
      '(-a --ac_adapter)'{-a,--ac_adapter}'[show AC adapter presence]'
      '-b[show battery status for available batteries]'
      '(-B --battery)'{-B,--battery}'[show detailed battery status for all batteries found]'
      '(-c --cpu)'{-c,--cpu}'[show CPU information]'
      '(-a --ac_adapter -A -b -B --battery -c --cpu -e -f --fan -t --thermal -w)-e[show just about everything]'
      '(-f --fan)'{-f,--fan}'[show fan status]'
      '(-h --help)'{-h,--help}'[display help]'
      '(-s --suspend)'{-s,--suspend}'[suspend machine to memory (sleep state S3)]'
      '-S[suspend machine to disk (sleep state S4)]'
      '(-t --thermal)'{-t,--thermal}'[show thermal zone(s) information and trip points]'
      '-v[show more verbose output]'
      '(-V --version)'{-V,--version}'[output version information and exit]'
      '-w[show the wakeup capable devices]'
      '-W+[toggle enable/disable wakeup capable device]: :_wakeup_capable_devices'
    )
    
    if (( $brands[(I)asus] )); then
      disambig=
      (( $brands[(I)(toshiba|thinkpad)] )) && disambig='Asus '
      args+=(
        '(-A --Asus)'{-A,--Asus}'[show supported Asus ACPI extensions]'
        '-m+[set mail LED status]:mail LED status:((1\:on 0\:off))'
        '-n+[set wireless LED status]:wireless LED status:((1\:on 0\:off))'
        '-o+[set LCD panel status]:LCD panel status:((1\:on 0\:off))'
        "-z+[set ${disambig}LCD brightness level]:${disambig}LCD brightness level:(0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15)"
      )
    fi
    
    selbrands=
    if (( $brands[(I)toshiba] )); then
      selbrands=Toshiba
      args+=(
        '-F+[force fan on or switch back to auto mode]:fan status:((1\:on 0\:auto))'
        '(-T --Toshiba)'{-T,--Toshiba}'[show supported Toshiba ACPI extensions]'
      )
    fi
    
    if (( $brands[(I)thinkpad] )); then
      [[ -n $selbrands ]] && selbrands+=/
      selbrands=${selbrands}Thinkpad
      args+=('-j[eject ultrabay device]')
    fi
    
    if [[ -n $selbrands ]]; then
      disambig=
      (( $brands[(I)asus] )) && disambig="$selbrands "
      args+=(
        "-l+[set ${disambig}LCD brightness level]:${disambig}LCD brightness level:(0 1 2 3 4 5 6 7)"
      )
    fi
    
    _arguments -s $args && ret=0
    
    return ret
    PK[;(Lfunctions/_dchroot-dsanuW+A#compdef dchroot-dsa
    
    local expl context state line
    typeset -A opt_args
    
    _arguments -S \
           '(-h --help)'{-h,--help}'[help]' \
           '(-a --all)'{-a,--all}'[select all chroots]' \
           '*'{-c,--chroot=}'[use specified chroot]:chroot:->chroot' \
           '(-d --directory)'{-d,--directory=}'[directory to use]:dir:_files -W / -P /' \
           '(-l --list)'{-l,--list}'[list available chroots]' \
           '(-i --info)'{-i,--info}'[show information about selected chroots]' \
           '(-p --listpaths)'{-p,--listpaths}'[print paths to available chroots]' \
           '--config[dump configuration of selected chroots]' \
           '(-q --quiet)'{-q,--quiet}'[quiet]' \
           '(-v --verbose)'{-v,--verbose}'[verbose]' \
           '(-V --version)'{-V,--version}'[version]' \
           '(-):command name: _command_names -e' \
           '*::arguments: _normal' && return 0
    
    case "$state" in
    	(chroot)
    	_wanted tag expl 'chroot' \
            compadd ${(os:,:)${${${"$(dchroot -l )"#*: }// /}//[[\]]/,}}
    	;;
    esac
    PK[5Gfunctions/_groffnuW+A#compdef groff
    
    local _troff_options
    
    _troff_options=('-a[ascii approximation of output]'
           '-b[backtrace on error or warning]'
           '-c[disable color output]'
           '-C[enable compatibility mode]'
           '*-d[define string]:definition:'
           '-E[disable troff error messages]'
           '-f[set default font family]:font family:'
           '-F[set path for font DESC files]:path:'
           '-i[process standard input after specified input files]'
           '-m[include macro file]:name:(man mandoc mdoc me mm ms www)'
           '-M[dir path for macro files]:path:'
           '-n[number for the first page]:number:'
           '-o[output only pages in list]:list:'
           '*-r[set number register]:setting:'
           '*-w[enable warning name]:name:'
           '*-W[disable warning name]:name')
    
    _arguments \
    	'-e[preprocess with eqn]' \
            '-g[preprocess with grn]' \
            '-G[preprocess with grap]' \
    	'(-h --help)'{-h,--help}'[help]' \
    	'-I[add search dir for soelim]:directory:_files -/' \
    	'-l[send output to spooler program for printing]' \
    	'*-L[pass arg to spooler program]:spooler argument:' \
    	'-N[do not allow newlines within eqn delimeters]' \
    	'-p[preprocess with pic]' \
    	'*-P[pass option to postprocessor]:option:' \
            '-R[preprocess with refer]' \
            '-s[preprocess with soelim]' \
            '(-U)-S[safer mode]' \
            '-t[preprocess with tbl]' \
            '-T[set output device]:device:((ascii\:ASCII\ character\ set cp1047\:EBDIC\ code\ page\ IBM\ cp1047 nippon\:Japanese-EUC\ character\ set dvi\:TeX\ DVI\ format html\:HTML\ output ascii8\:8-bit\ clean latin1\:ISO\ 8859-1 lbp\:Canon\ CAPSL\ printers lj4\:HP\ LaserJet4-compatible\ printers ps\:PostScript\ output utf8\:Unicode\ \(ISO\ 10646\)\ character\ set X75\:75dpi\ X\ Window\ System\ output X75-12\:75dpi\ X\ Window\ System\ output\ \(12pt\) X100\:100dpi\ X\ Window\ System\ output X100-12\:100dpi\ X\ Window\ System\ output\ \(12pt\)))' \
            '(-S)-U[unsafe mode]' \
    	'(-v --version)'{-v,--version}'[version]' \
    	'-V[output the pipeline that would be run but do not execute]' \
    	'-X[use gxditview instead of the usual postprocessor]' \
    	'-z[suppress output generated by troff]' \
    	'-Z[do not postprocess the output of troff]' \
    	"$_troff_options[@]" \
    	':file:_files'
    PK[*>>functions/prompt_bigfade_setupnuW+A# Generic large colour fade-bar prompt theme from bashprompt
    # Created by James Manning 
    # Changed by Spidey 08/06
    # Converted to zsh prompt theme by 
    
    prompt_bigfade_help () {
      cat < [ [ []]]]
    
    where the parameters are the colors for the fade-bar, user@host text,
    date text, and current working directory respectively.  The default
    colors are blue, white, white, and yellow.  This theme works best with
    a dark background.
    
    
    Recommended fonts for this theme: either UTF-8, or nexus or vga or similar.
    If you don't have any of these, the 8-bit characters will probably look
    stupid.
    EOH
    }
    
    prompt_bigfade_setup () {
      local fadebar=${1:-'blue'}
      local userhost=${2:-'white'}
      local date=${3:-'white'}
      local cwd=${4:-'yellow'}
    
      if [[ $1 == '8bit' ]]; then
      shift
      local -A schars
      autoload -Uz prompt_special_chars
      prompt_special_chars
      fi
    
      PS1="%B%F{$fadebar}$schars[333]$schars[262]$schars[261]$schars[260]%B%F{$userhost}%K{$fadebar}%n@%m%b%k%f%F{$fadebar}%K{black}$schars[260]$schars[261]$schars[262]$schars[333]%b%f%k%F{$fadebar}%K{black}$schars[333]$schars[262]$schars[261]$schars[260]%B%F{$date}%K{black} %D{%a %b %d} %D{%I:%M:%S%P}$prompt_newline%B%F{$cwd}%K{black}$PWD>%b%f%k "
      PS2="%B%F{$fadebar}$schars[333]$schars[262]$schars[261]$schars[260]%b%F{$fadebar}%K{black}$schars[260]$schars[261]$schars[262]$schars[333]%F{$fadebar}%K{black}$schars[333]$schars[262]$schars[261]$schars[260]%B%F{$fadebar}>%b%f%k "
    
      prompt_opts=(cr subst percent)
    }
    
    prompt_bigfade_preview () {
      if (( ! $#* )); then
        prompt_preview_theme bigfade
        print
        prompt_preview_theme bigfade red white grey white
      else
        prompt_preview_theme bigfade "$@"
      fi
    }
    
    prompt_bigfade_setup "$@"
    PK[F**functions/run-help-svknuW+Asvk help ${${@:#-*}[1]} | ${=PAGER:-more}
    PK[functions/_debchangenuW+A#compdef debchange dch=debchange
    
    _arguments \
      '(-h --help)'{-h,--help}'[display help information]' \
      '--version' \
      '(--append -a --newversion -v --increment -i)'{-i,--increment}'[increment release or version number]' \
      '(--append -a --newversion -v --increment -i)'{-a,--append}'[add new changelog entry]' \
      '(--append -a --newversion -v --increment -i)'{-v,--newversion}'[specify new version number]:version:' \
      '(--preserve -p)'{-p,--preserve}'[preserve source tree directory name]' \
      ':text:'
    PK[pfunctions/zffcachenuW+A# Generate an array name for storing the cache for the current session,
    # storing it in fcache_name, then generate the cache for the current
    # directory, or with argument -d clear the cache.
    
    [[ $1 = -d ]] && local fcache_name
    
    fcache_name=$zfconfig[fcache_$ZFTP_SESSION]
    if [[ -z $fcache_name ]]; then
      local vals
      vals=(${(v)zfconfig[(I)fcache_*]##zftp_fcache_})
      integer i
      while [[ -n ${vals[(r)zftp_fcache_$i]} ]]; do
        (( i++ ))
      done
      fcache_name=zftp_fcache_$i
      zfconfig[fcache_$ZFTP_SESSION]=$fcache_name
    fi
    
    if [[ $1 = -d ]]; then
      unset $fcache_name
    elif (( ${(P)#fcache_name} == 0 )); then
      local tmpf=${TMPPREFIX}zffcache$$
      zftp ls >$tmpf
      eval "$fcache_name=(\${(f)\"\$(<\$tmpf)\"})"
      rm -f $tmpf
    fi
    PK[3:functions/backward-word-matchnuW+Aemulate -L zsh
    setopt extendedglob
    
    autoload match-words-by-style
    
    local curcontext=":zle:$WIDGET" word
    local -a matched_words
    integer count=${NUMERIC:-1}
    
    if (( count < 0 )); then
        (( NUMERIC = - count ))
        zle ${WIDGET/backward/forward}
        return
    fi
    
    while (( count-- )); do
    
        match-words-by-style
    
        word=$matched_words[2]$matched_words[3]
    
        if [[ -n $word ]]; then
    	(( CURSOR -= ${#word} ))
        else
    	return 1
        fi
    done
    
    return 0
    PK[fcQfunctions/zfdirnuW+A# function zfdir {
    # Long directory of remote server.
    # The remote directory is cached.  In fact, two caches are kept:
    # one of the standard listing of the current directory, i.e. zfdir
    # with no arguments, and another for everything else.
    # To access the appropriate cache, just use zfdir with the same
    # arguments as previously.  zfdir -r will also re-use the `everything
    # else' cache; you can always reuse the current directory cache just
    # with zfdir on its own.
    #
    # The current directory cache is emptied when the directory changes;
    # the other is kept until a new zfdir with a non-empty argument list.
    # Both are removed when the connection is closed.
    #
    # zfdir -f will force the existing cache to be ignored, e.g. if you know
    #          or suspect the directory has changed.
    # zfdir -d will remove both caches without listing anything.
    # If you need to pass -r, -f or -d to the dir itself, use zfdir -- -d etc.;
    # unrecognised options are passed through to dir, but zfdir options must
    # appear first and unmixed with the others.
    
    emulate -L zsh
    setopt extendedglob
    
    [[ $curcontext = :zf* ]] || local curcontext=:zfdir
    local file opt optlist redir i newargs force
    local curdir=$zfconfig[curdir_$ZFTP_SESSION]
    local otherdir=$zfconfig[otherdir_$ZFTP_SESSION]
    
    while [[ $1 = -* ]]; do
      if [[ $1 = - || $1 = -- ]]; then
        shift;
        break;
      elif [[ $1 != -[rfd]## ]]; then
        # pass options through to ls
        break;
      fi
      optlist=${1#-}
      for (( i = 1; i <= $#optlist; i++)); do
        opt=$optlist[$i]
        case $optlist[$i] in
          r) redir=1
    	 ;;
          f) force=1
    	 ;;
          d) [[ -n $curdir && -f $curdir ]] && rm -f $curdir
    	 [[ -n $otherdir && -f $otherdir ]] && rm -f $otherdir
    	 zffcache -d
    	 return 0
    	 ;;
        esac
      done
      shift
    done
    
    zfautocheck -d || return 1
    
    # directory hack, see zfcd
    for (( i = 1; i <= $#argv; i++ )); do
      if [[ $argv[$i] = $HOME || $argv[$i] = $HOME/* ]]; then
        argv[$i]="~${argv[$i]#$HOME}"
      fi
    done
    
    if [[ $# -eq 0 ]]; then
      # Cache it in the current directory file.  This means that repeated
      # calls to zfdir with no arguments always use a cached file.
      if [[ -z $curdir ]]; then
        curdir=${TMPPREFIX}zfcurdir_${ZFTP_SESSION}_$$
        zfconfig[curdir_$ZFTP_SESSION]=$curdir
      fi
      file=$curdir
    else
      # Last directly looked at was not the current one, or at least
      # had non-standard arguments.
      if [[ -z $otherdir ]]; then
        otherdir=${TMPPREFIX}zfotherdir_${ZFTP_SESSION}_$$
        zfconfig[otherdir_$ZFTP_SESSION]=$otherdir
      fi
      file=$otherdir
      newargs="$*"
      if [[ -f $file && $redir != 1 && $force -ne 1 ]]; then
        # Don't use the cached file if the arguments changed.
        [[ $newargs = $zfconfig[otherargs_$ZFTP_SESSION] ]] || rm -f $file
      fi
      zfconfig[otherargs_$ZFTP_SESSION]=$newargs
    fi
    
    if [[ $force -eq 1 ]]; then
      rm -f $file
      # if it looks like current directory has changed, better invalidate
      # the filename cache, too.
      (( $# == 0 )) && zffcache -d
    fi
    
    if [[ -n $file && -f $file ]]; then
      eval ${PAGER:-more} \$file
    else
      if (zftp test); then
        # Works OK in subshells
        zftp dir $* | tee $file | eval ${PAGER:-more}
      else
        # Doesn't work in subshells (IRIX 6.2 --- why?)
        zftp dir $* >$file
        eval ${PAGER:-more} $file
      fi
    fi
    # }
    PK[>>functions/_xloadimagenuW+A#compdef xli xloadimage xsetbg xview
    
    local rc ipath extension filter type args
    
    if rc=( ${(f)"$($words[1] -path)"} ); then
      # xli
      filter=( .Z )
      args=(
        '-cache[force caching of entire input]'
        "-delete[enable deleting images with 'x' key]"
        '-dispgamma[specify gamma correction]'
        '-fillscreen[use whole screen, zooming image]'
        '-focus[take keyboard focus]'
        '-path[display image path and suffixes]'
        -dumpcore
        '*-iscale[scale image]:scale factor'
        '*-c'{,olor}'dither[dither image]'
        '*-expand[expand image to 24-bit]'
        '*-xpm[specify xpm color map]:color context key:((m\:mono g4\:4\ level\ gray g\:gray c\:color))'
      )
    else
      # xloadimage
      rc=( ${(f)"$($words[1] -configuration)"} )
      filter=( ${${(Q)rc[4,-1]%% -*}# } )
      type=( ${(f)"$($words[1] -supported)"} )
      args=(
        '-configuration[display image path, suffixes and filters]'
        '-dump[dump image into file]:image type:( '${(F)${(M)type:#*Yes*}%% *}' ):filename:_files'
        -slideshow
        '*-type[force type of image]:type name:( '${(F)type[3,-1]%% *}' )'
        '*-shrink[shrink image to fit display]'
        '*-tile[tile image to fill display]'
        '*-global[following option applies to all images]'
      )
    fi
    ipath=( . ${=${(M)rc:#*path:*}#*:} )
    extension=( ${=${(M)rc:#*extensions:*}#*:} )
    # set default file extensions if there are none
    (( $#extension )) || extension=(
      .gif .jpg .jpeg .png .rle .csun .msun .sun .face
      .xbm .bm .fbm .pcx .ppm .pgm .pbm .tga .xpm
    )
    
    # all options are valid after -help so no exclusion lists below
    _x_arguments "$args[@]" \
      '-default[set root background to default]' \
      '-fit[use default visual and colormap]' \
      '-fullscreen[use whole screen, surrounding image with border]' \
      "-goto[specify image to display at end]:image name:_files -W ipath -g '*(#i)(${(j:|:)extension})(|${(j:|:)filters})(-.)'" \
      '(*)-help[display information on options]' \
      '-identity[identify supplied images instead of displaying]' \
      '-install[forcibly install image colormap on focus]' \
      '-list[list images]' \
      '-onroot[display to root window]' \
      '-path[display image path and suffixes]' \
      '-pixmap[force the use of a pixmap as backing-store]' \
      '-private[force use of a private colormap]' \
      '-quiet[quiet operation]' \
      '-supported[list supported image types]' \
      '-verbose[verbose operation]' \
      '-version[display version info]' \
      '-view[view image in window]' \
      '-visual[force use of a specific visual]:visual:_x_visual' \
      '-windowid[set background pixmap of specific window]:window id:_x_window' \
      -fork -debug \
      '*-border[specify background color]:background color:_x_color' \
      '*-brighten[brighten/darken image]:percentage multiplier' \
      '*-colors[specify maximum colors in image]:colors' \
      '*-delay[delay before advancing to next image]:seconds' \
      '*-dither[dither color image to mono]' \
      '*-gamma[specify gamma of display image was intended for]:gamma' \
      '*-gr'{a,e}'y[convert image to grayscale]' \
      '*-idelay[specify delay for this image]' \
      '*-smooth[smooth a color image]' \
      '*-xzoom[zoom X axis of image]:percentage' \
      '*-yzoon[zoom Y axis of image]:percentage' \
      '*-zoom:percentage' \
      '*-newoptions[reset options]' \
      '*-at[specify coordinates to load next image at]' \
      '*-background[specify background color for next image]:color:_x_color' \
      '*-center[center next image on base image]' \
      '*-clip:X,Y,W,H' \
      '*-foreground[specify foreground color for next image]:color:_x_color' \
      '*-halftone[force halftone dithering]' \
      '*-invert[invert a monochrome image]' \
      '*-merge[merge image onto the base image]' \
      "*-name[specify image name]:picture file:_files -W ipath -g '*(#i)(${(j:|:)extension})(|${(j:|:)filters})(-.)'" \
      '*-normalize' \
      '*-rotate[rotate image clockwise]:degrees of rotation:(90 180 270)' \
      "*:picture file:_files -W ipath -g '*(#i)(${(j:|:)extension})(|${(j:|:)filter})(-.)'"
    PK[Vfunctions/_mii-toolnuW+A#compdef mii-tool
    
    _arguments -s \
      '(-V --version)'{-V,--version}'[display version information]' \
      '(-v --verbose)'{-v,--verbose}'[verbose output]' \
      '(-R --reset)'{-R,--reset}'[reset MII to poweron state]' \
      '(-r --restart)'{-r,--restart}'[restart autonegotiation]' \
      '(-w --watch)'{-w,--watch}'[monitor for link status changes]' \
      '(-l --log)'{-l,--log}'[write events to syslog]' \
      '(-A --advertise)'{-A,--advertise=}'[advertise only specified media]:medium:_values -s , medium 100baseT4 100baseTx-FD 100baseTx-HD 10baseT-FD 10baseT-HD 100baseTx 10baseT' \
      '(-F --force)'{-F,--force=}'[force specified medium]:medium:(100baseT4 100baseTx-FD 100baseTx-HD 10baseT-FD 10baseT-HD 100baseTx 10baseT)' \
      '*:interface:_net_interfaces'
    PK[[_functions/calendar_shownuW+Ainteger start=$1 stop=$2
    shift 2
    
    [[ -o zle ]] && zle -I
    print -r "$*"
    
    local -a cmd
    zmodload -i zsh/parameter || return
    
    # Use xmessage to display the message if the start and stop time
    # are the same, indicating we have been scheduled to display it.
    # Don't do this if there's already an notification/message for the same user.
    # HERE: this should be configurable and we should be able to do
    # better if xmessage isn't available, e.g. wish.
    if [[ -n $DISPLAY &&  $start -eq $stop ]]; then
      if [[ -n ${commands[kdialog]} && -n $KDE_SESSION_UID ]]
      then
        # We're in a KDE session, most probably.
        # Simple:
        cmd=(kdialog --msgbox)
        # Alternative:
        #  calendar_knotify_show() {
        #    dcop knotify default notify calendar zsh "$*" '' '' 2 0
        #  }
        #  cmd=(calendar_knotify_show)
      elif [[ -n ${commands[xmessage]} ]]; then
        cmd=(xmessage -center)
      fi
      if [[ -n $cmd[1] ]] &&
        ! ps -u$UID | grep $cmd[1] >/dev/null 2>&1; then
        # turn off job control for this
        ($cmd "$*" &)
      fi
    fi
    
    return 0
    PK[gfunctions/_cdrecordnuW+A#compdef cdrecord wodim
    
    local curcontext="$curcontext" state line expl ret=1
    local devices btypes
    
    _arguments -C \
      '-version[print version information]' \
      '*-d[increase debug level]' \
      \*{-verbose,-v}'[increase verbosity level]' \
      \*{-Verbose,-V}'[increase scsi command transport verbosity level]' \
      '(-silent -s)'{-silent,-s}'[do not print a status report for failed scsi commands]' \
      '-setdropts[set driver specific options and exit]' \
      '-checkdrive[check if a driver for the device is present]' \
      '-prcap[print drive capabilities for MMC compliant drives]' \
      '-inq[do an inquiry for the drive and exit]' \
      '-scanbus[scan the scsi bus and exit]' \
      '-reset[reset the scsi bus with the cdrecorder]' \
      '-overburn[allow writing of more than the official size of a medium]' \
      '-ignsize[ignore the known size of a medium (may cause problems)]' \
      '-useinfo[use .inf files to overwrite audio options]' \
      '-format[format a CD-RW/DVD-RW/DVD+RW disc]' \
      '-load[load the disk and exit]' \
      '-lock[load and lock disc in tray loader]' \
      '-eject[eject the disk after doing the work]' \
      '-dummy[do everything with laser turned off]' \
      '-msinfo[retrieve multi-session info for mkisofs]' \
      '-toc[retrieve and print TOC/PMA data]' \
      '-atip[retrieve and print ATIP data]' \
      '-multi[generate a TOC that allows multi session]' \
      '-fix[fixate a corrupt or unfixated disk]' \
      '-nofix[do not fixate disk after writing tracks]' \
      '-waiti[wait until input is available before opening SCSI]' \
      '-immed[try to use scsi IMMED flag]' \
      '-force[force continuation on some errors]' \
      '-dao[set disk at once mode]' \
      '-raw[set raw writing mode]' \
      '-raw96r[write disk in raw/raw96r mode]' \
      '-raw96p[write disk in raw/raw96p mode]' \
      '-raw16[write disk in raw/raw16 mode]' \
      '-text[write CD-Text from .inf/.cue files]' \
      '*-audio[subsequent tracks are CD-DA audio tracks]' \
      '*-data[subsequent tracks are CD-ROM data mode 1 (default)]' \
      '*-mode2[subsequent tracks are CD-ROM data mode 2]' \
      '*-xa[subsequent tracks are CD-ROM XA mode 2 form 1 - 2048 bytes]' \
      '*-xa1[subsequent tracks are CD-ROM XA mode 2 form 1 - 2056 bytes]' \
      '*-xa2[subsequent tracks are CD-ROM XA mode 2 form 2 - 2324 bytes]' \
      '*-cdi[subsequent tracks are CDI tracks]' \
      '-isosize[use iso9660 file system size for next data track]' \
      '(-nopreemp)-preemp[audio tracks are mastered with 50/15 preemphasis]' \
      '(-preemp)-nopreemp[audio tracks are mastered with no preemphasis (default)]' \
      '-copy[audio tracks have unlimited copy permission]' \
      '-nocopy[audio tracks may only be copied once for personal use]' \
      '-scms[audio tracks will not not have any copy permission at all]' \
      '(-nopad)-pad[pad tracks]' \
      '(-pad)-nopad[do not pad data tracks (default)]' \
      '*-shorttrack[subsequent tracks may be non Red Book if in DAO mode]' \
      '*-noshorttrack[subsequent tracks must be >= 4 seconds]' \
      '-swab[audio data source is byte-swapped (little-endian/Intel)]' \
      '*: :->values'
    
    if [[ -n $state ]]; then
      _tags values files
      while _tags; do
        if _requested values && (( ! ${#words[2,CURRENT-1]:#(-*|*=*)} )); then
          _values -C -s ' ' 'option' \
    	'dev[specify scsi device to use]:device:->device' \
    	'gracetime[set grace time before starting to write]:time (seconds)' \
    	'timeout[set default scsi timeout]:timeout (seconds)' \
    	'debug[specify debug level]:debug level' \
    	{kdebug,kd}'[specify kernel debug level]:debug level' \
    	'driver[user supplied driver name]:drive' \
    	'driveropts[a comma separated list of driver specific options]:driver options' \
    	'speed[set speed of drive]:speed' \
    	'blank[blank a CD-RW disc]:blank type:->blank' \
    	'fs[set fifo size]:size' \
    	'tsize[length of valid data in next track]:length' \
    	'padsize[amount of padding for next track]:amount of padding' \
    	'pregap[amount of pre-gap sectors before next track]:amount' \
    	'defpregap[amount of pre-gap sectors for all but first track]:amount' \
    	'mcn[set media catalog number for this CD]:text' \
    	'isrc[set isrc number for the next track]:text' \
    	'index[set the index list for the next track]:list' \
    	'textfile[set the file with CD-Text data]:name:_files -g "*.inf(-.)"' \
    	'cuefile[set the file with CDRWIN CUE data]:name:_files -g "*.cue(-.)"' && ret=0
        fi
        _requested files expl track _files && ret=0
        (( ret )) || break
      done
      
      case $state in
        device)
          devices=( ${(f)"$(_call_program device $service -scanbus 2>/dev/null \
              |grep '^	'|cut -c2-6,23-|sed 's/ /:/')"} )
          _describe -t devices device devices && return
        ;;
        blank)
          btypes=(
            'help:display list of available blanking types'
    	${${${${(f)"$(_call_program blank-types $service blank=help 2>&1)"}[2,-1]}#?}/[[:blank:]]##/:}
          )
          _describe -t blank-types 'blanking type' btypes && return
        ;;
      esac
      
    fi
    PK[
    hZZfunctions/_getfaclnuW+A#compdef getfacl getfacl.exe
    
    if _pick_variant cygwin=cygwin unix --version; then
    # cygwin 1.5.25
    _arguments -s -S \
      '(--all -a)'{-a,--all}'[display the filename, owner, group, and ACL of the file]' \
      '(--dir -d)'{-d,--dir}'[display the filename, owner, group, and default ACL of the directory]' \
      '(--noname -n)'{-n,--noname}'[display user and group IDs instead of names]' \
      '(- *)'{-h,--help}'[display help information]' \
      '(- *)'{-v,--version}'[display version information]' \
      '*: :_files'
    else
    _arguments -s -S \
      '--access[display the file access control list only]' \
      '(-d --default)'{-d,--default}'[display the default access control list only]' \
      '--omit-header[do not display the comment header]' \
      '--all-effective[print all effective rights]' \
      '--no-effective[print no effective rights]' \
      '--skip-base[skip files that only have the base entries]' \
      '(-R --recursive)'{-R,--recursive}'[recurse into subdirectories]' \
      '(-L --logical)'{-L,--logical}'[logical walk, follow symbolic links]' \
      '(-P --physical)'{-P,--physical}'[physical walk, do not follow symbolic links]' \
      '--tabular[use tabular output format]' \
      '--numeric[print numeric user/group identifiers]' \
      '--absolute-names[don'"'"'t strip leading '"'"'/'"'"' in pathnames]' \
      '--version[print version and exit]' \
      '--help[this help text]' \
      '*: :_files'
    fi
    PK[aDfunctions/_lscfgnuW+A#compdef lscfg
    
    local state line expl curcontext="$curcontext" disp list devs sep
    
    _arguments -C -s \
      '-l[display device information for named device]:device:->device' \
      '-v[display vital product data for physical devices]' && return 0
    
    if [[ "$state" = device ]]; then
      devs=( ${${${${(f)"$(lscfg)"}[6,-1]:# *}##??}/ ##[^ ]# #/:} )
      if zstyle -T ":completion:${curcontext}:devices" verbose; then
        zstyle -s ":completion:${curcontext}:devices" list-separator sep || sep=--
        zformat -a list " $sep " "$devs[@]"
        disp=(-ld list)
      else
        disp=()
      fi
      _wanted devices expl 'device' compadd "$disp[@]" - "${devs[@]%%:*}"
      return
    fi
    
    return 1
    PK[z,rfunctions/calendar_parsenuW+A# Parse the line passed down in the first argument as a calendar entry.
    # Sets the values parsed into the associative array reply, consisting of:
    # time  The time as an integer (as per EPOCHSECONDS) of the (next) event.
    # text1 The text from the the line not including the date/time, but
    #       including any WARN or RPT text.  This is useful for rescheduling
    #       events, since the keywords need to be retained in this case.
    # warntime  Any warning time (WARN keyword) as an integer, else an empty
    #       string.  This is the time of the warning in units of EPOCHSECONDS,
    #       not the parsed version of the original number (which was a time
    #       difference).
    # warnstr  Any warning time as the original string (e.g. "5 mins"), not
    #       including the WARN keyword.
    # schedrpttime The next scheduled recurrence (which may be cancelled
    #              or rescheduled).
    # rpttime The actual occurrence time:  the event may have been rescheduled,
    #         in which case this is the time of the actual event (for use in
    #         programming warnings etc.) rather than that of the normal
    #         recurrence (which is recorded by calendar_add as RECURRENCE).
    #
    # rptstr   Any repeat/recurrence time as the original string.
    # text2    The text from the line with the date and other keywords and
    #          values removed.
    #
    # Note that here an "integer" is a string of digits, not an internally
    # formatted integer.
    #
    # Return status 1 if parsing failed.  reply is set to an empty
    # in this case.  Note the caller is responsible for
    # making reply local.
    
    emulate -L zsh
    setopt extendedglob
    
    local vdatefmt="%Y%m%dT%H%M%S"
    
    local REPLY REPLY2 timefmt occurrence skip try_to_recover before after
    local -a match mbegin mend
    integer now then replaced firstsched schedrpt
    # Any text matching "OCCURRENCE  "
    # may occur multiple times.  We set occurrences[]=disposition.
    local -A occurrences
    
    autoload -Uz calendar_scandate
    
    typeset -gA reply
    
    reply=()
    
    if (( $# != 1 )); then
      print "Usage: $0 calendar-entry" >&2
      return 2
    fi
    
    # This call sets REPLY to the date and time in seconds since the epoch,
    # REPLY2 to the line with the date and time removed.
    calendar_scandate -as $1 || return 1
    reply[time]=$(( REPLY ))
    schedrpt=${reply[time]}
    reply[text1]=${REPLY2##[[:space:]]#}
    reply[text2]=${reply[text1]}
    
    while true; do
    
      case ${reply[text2]} in
        # First check for a scheduled repeat time.  If we don't find one
        # we'll use the normal time.
        ((#b)(*[[:space:]\#])RECURRENCE[[:space:]]##([^[:space:]]##)([[:space:]]*|))
        strftime -rs then $vdatefmt ${match[2]} ||
        print "format: $vdatefmt, string ${match[2]}" >&2
        schedrpt=$then
        reply[text2]="${match[1]}${match[3]##[ 	]#}"
        ;;
    
        # Look for specific warn time.
        ((#b)(|*[[:space:],])WARN[[:space:]](*))
        if calendar_scandate -asm -R $reply[time] $match[2]; then
          reply[warntime]=$REPLY
          reply[warnstr]=${match[2]%%"$REPLY2"}
          # Remove spaces and tabs but not newlines from trailing text,
          # else the formatting looks funny.
          reply[text2]="${match[1]}${REPLY2##[ 	]#}"
        else
          # Just remove the keyword for further parsing
          reply[text2]="${match[1]}${match[2]##[ 	]#}"
        fi
        ;;
    
        ((#b)(|*[[:space:],])RPT[[:space:]](*))
        before=${match[1]}
        after=${match[2]}
        if [[ $after = CANCELLED(|[[:space:]]*) ]]; then
          reply[text2]="$before${match[2]##[ 	]#}"
          reply[rptstr]=CANCELLED
          reply[rpttime]=CANCELLED
          reply[schedrpttime]=CANCELLED
        elif calendar_scandate -a -R $schedrpt $after; then
          # It's possible to calculate a recurrence, however we don't
          # do that yet.  For now just keep the current time as
          # the recurrence.  Hence we ignore REPLY.
          reply[text2]="$before${REPLY2##[	]#}"
          reply[rptstr]=${after%%"$REPLY2"}
          # Until we find an individual occurrence, the actual time
          # of the event is the regular one.
          reply[rpttime]=$schedrpt
        else
          # Just remove the keyword for further parsing
          reply[text2]="$before${after##[[:space:]]#}"
        fi
        ;;
    
        ((#b)(|*[[:space:]\#])OCCURRENCE[[:space:]]##([^[:space:]]##)[[:space:]]##([^[:space:]]##)(*))
        occurrences[${match[2]}]="${match[3]}"
        # as above
        reply[text2]="${match[1]}${match[4]##[ 	]#}"
        ;;
    
        (*)
        break
        ;;
      esac
    done
    
    if [[ -n ${reply[rpttime]} && ${reply[rptstr]} != CANCELLED ]]; then
      # Recurring event.  We need to find out when it recurs.
      (( now = EPOCHSECONDS ))
    
      # First find the next recurrence.
      replaced=0
      reply[schedrpttime]=$schedrpt
      if (( schedrpt >= now )); then
        firstsched=$schedrpt
      fi
      while (( ${reply[schedrpttime]} < now || replaced )); do
        if ! calendar_scandate -a -R ${reply[schedrpttime]} ${reply[rptstr]}; then
          break
        fi
        if (( REPLY <= ${reply[schedrpttime]} )); then
          # going backwards --- pathological case
          break;
        fi
        reply[schedrpttime]=$REPLY
        reply[rpttime]=$REPLY
        if (( ${reply[schedrpttime]} > now && firstsched == 0 )); then
          firstsched=$REPLY
        fi
        replaced=0
        # do we have an occurrence to compare against?
        if (( ${#occurrences} )); then
          strftime -s timefmt $vdatefmt ${reply[schedrpttime]}
          occurrence=$occurrences[$timefmt]
          if [[ -n $occurrence ]]; then
    	# Yes, this replaces the scheduled one.
    	replaced=1
          fi
        fi
      done
      # Now look through occurrences (values only) and see which are (i) still
      # to happen (ii) early than the current rpttime.
      for occurrence in $occurrences; do
        if [[ $occurrence != CANCELLED ]]; then
          strftime -rs then $vdatefmt $occurrence ||
          print "format: $vdatefmt, string $occurrence" >&2
          if (( then > now && then < ${reply[rpttime]} )); then
    	reply[rpttime]=$then
          fi
        fi
      done
      # Finally, update the scheduled repeat time to the earliest
      # possible value.  This is so that if an occurrence replacement is
      # cancelled we pick up the regular one.  Can this happen?  Dunno.
      reply[schedrpttime]=$firstsched
    fi
    
    reply[text2]="${reply[text2]##[[:space:],]#}"
    
    return 0
    PK[E"functions/_cdrnuW+A#compdef cdr
    
    local expl insert_string
    integer default insert
    
    zstyle -t ':chpwd:' recent-dirs-default && default=1
    if (( default )); then
      zstyle -s ':completion:${curcontext}' recent-dirs-insert insert_string
      case $insert_string in
        (both)
        insert=4
        ;;
    
        (fallback)
        insert=3
        ;;
    
        (always)
        insert=2
        ;;
    
        ([tT]*|1|[yY]*)
        insert=1
        ;;
    
        (*)
        insert=0
      esac
    fi
    
    # See if we should fall back to cd completion.
    if [[ default -ne 0 && insert -lt 2 && \
      ( CURRENT -ne 2 || (-n $words[2] && $words[2] != <->) ) ]]; then
      $_comps[cd] "$@"
      return
    fi
    
    local -a values keys
    
    if (( insert )); then
      # insert the actual directory, not the number
      values=(${${(f)"$(cdr -l)"}##<-> ##})
      # Suppress the usual space suffix, since there's no further argument
      # and it's useful to be able to edit the directory e.g. add /more/stuff.
      if _wanted -V recent-dirs expl 'recent directory' compadd -S '' -Q -a values
      then
        (( insert == 4 )) || return 0
      fi
    
      (( insert >= 3 )) || return
      $_comps[cd] "$@"
    else
      values=(${${(f)"$(cdr -l)"}/ ##/:})
      keys=(${values%%:*})
    
      _describe -t dir-index 'recent directory index' values keys -V unsorted
    fi
    PK[2functions/_zsh-mime-handlernuW+A#compdef zsh-mime-handler
    
    # Given that the handler is likely to change the start of the command
    # line, we'll try to maintain the position from the end of the words
    # array.  Hence for example CURRENT gets decremented by one if the
    # handler drops off the start.
    integer end_offset=$(( ${#words} - CURRENT ))
    
    # zsh-mime-handler -l is supposed to print out the command line
    # with quoting to turn it into a full executable line.  So
    # we need to use shell splitting to turn it into words and
    # then unquoting on those words.
    words=(${(z)"$(zsh-mime-handler -l "${(@)words[2,-1]}")"})
    # Careful unquoting: we need to keep a '' as a separate word.
    words=("${(@Q)words}")
    
    (( CURRENT = ${#words} - end_offset ))
    
    _normal
    PK[':}	}	functions/_matchnuW+A#autoload
    
    # This is intended to be used as a completer function after the normal
    # completer as in: `zstyle ":completion:::::" completer _complete _match'.
    # It temporarily switches on pattern matching, allowing you to try 
    # completion on patterns without having to setopt glob_complete.
    #
    # Note, however, that this is only really useful if you don't use the
    # expand-or-complete function because otherwise the pattern will
    # be expanded using globbing.
    
    ### Shouldn't be needed any more: [[ _matcher_num -gt 1 ]] && return 1
    
    local tmp opm="$compstate[pattern_match]" ret=1 orig ins
    local oms="$_old_match_string"
    local ocsi="$compstate[insert]" ocspi="$compstate[pattern_insert]"
    
    # Do nothing if we don't have a pattern.
    
    tmp="${${:-$PREFIX$SUFFIX}#[~=]}"
    [[ "$tmp:q" = "$tmp" ]] && return 1
    
    _old_match_string="$PREFIX$SUFFIX$HISTNO"
    
    _tags matches original
    
    zstyle -s ":completion:${curcontext}:" match-original orig
    zstyle -s ":completion:${curcontext}:" insert-unambiguous ins
    
    # Try completion without inserting a `*'?
    
    if [[ -n "$orig" ]]; then
      compstate[pattern_match]='-'
      _complete && ret=0
      compstate[pattern_match]="$opm"
    
      # No completion with inserting `*'?
    
      [[ ret -eq 1 && "$orig" = only ]] && return 1
    fi
    
    if (( ret )); then
      compstate[pattern_match]='*'
      _complete && ret=0
      compstate[pattern_match]="$opm"
    fi
    
    if (( ! ret )); then
    
      if [[ "$ins" = pattern && $compstate[nmatches] -gt 1 ]]; then
    
        [[ "$oms" = "$PREFIX$SUFFIX$HISTNO" &&
           "$compstate[insert]" = automenu-unambiguous ]] &&
            compstate[insert]=automenu
        [[ "$compstate[insert]" != *menu ]] &&
            compstate[pattern_insert]= compstate[insert]=
    
    # We tried to be clever here, making completion insert unambiguous
    # expansions as early as possible, but this is really hard to test
    # and the code below probably does more harm than good.    
    #
    #    [[ $compstate[unambiguous_cursor] -gt $#compstate[unambiguous] ]] &&
    #        ins=yes compstate[insert]="$ocsi" compstate[pattern_insert]="$ocspi"
      fi
    
      if [[ "$ins" = (true|yes|on|1) &&
          $#compstate[unambiguous] -ge ${#:-${PREFIX}${SUFFIX}} ]]
      then 
        compstate[pattern_insert]=unambiguous
      elif _requested original &&
          { [[ compstate[nmatches] -gt 1 ]] ||
    	zstyle -t ":completion:${curcontext}:" original }; then
        local expl
    
        _description -V original expl original
    
        compadd "$expl[@]" -U -Q - "$PREFIX$SUFFIX"
      fi    
    fi
    
    return ret
    PK[functions/alloptnuW+A# This function lists options with the no's in front removed for
    # improved comprehension, i.e. `norcs off' becomes `rcs on'.
    # The format is otherwise like that with `kshoptionprint' set,
    # i.e. you can see all options whether on or off.
    # It can take a list of option names or parts thereof to search for
    # via egrep.
    #
    # Written by Sweth Chandramouli with hacks by Bart Schaefer.
    
    listalloptions () {
       local OPT_NAME OPT_VALUE
       builtin set -o | while read OPT_NAME OPT_VALUE ; do
          if [[ ${OPT_NAME#no} != ${OPT_NAME} ]] ; then
    	 OPT_VALUE=${(L)${${OPT_VALUE:s/on/OFF}:s/off/on}}
    	 OPT_NAME=${OPT_NAME#no}
          fi
          echo "${(r:21:)OPT_NAME} ${OPT_VALUE}"
       done
    }
    
    if [[ -n $@ ]]; then
        listalloptions | egrep "${(j.|.)@}"
    else
        listalloptions
    fi
    PK[
    &nfunctions/_vservernuW+A#compdef vserver
    
    _vserver () {
    
      # local variables
      local curcontext="$curcontext" state line expl ret=1
      local cmd=$words[3]
      
      # dispatch
      case "$cmd" in
        apt-cache|apt-config|apt-get)
          compset -n 3
          _dispatch $cmd:t $cmd $cmd:t -default- && ret=0
          ;;
        exec)
          _arguments -C \
    	'1: :->vsnames' \
    	'2: :->cmds' \
    	'3:command name: _command_names -e'  \
    	'*::arguments: _normal' && ret=0
          ;;
        stop|restart|condrestart|enter|running|status)
          _arguments -C \
    	'1: :->vsnames' \
    	'2: :->cmds' \
    	'*::arguments: _message "no more arguments"' && ret=0
          ;;
        *)
          _arguments -C \
    	'(-)--help[print help information]' \
    	'(- *)--version[print client version information]' \
    	'1: :->vsnames' \
    	'2: :->cmds' \
    	'*:: :->args' && ret=0
          ;;
      esac
      
      # cache initialization
      if [[ -n "$state" ]]; then
        if (( ! $+_cache_vserver_cfgdir )); then
          typeset -g _cache_vserver_cfgdir_initialized
          _vserver_cache_cfgdir
        fi
        if (( ! $+_cache_vserver_vsnames )); then
          typeset -g _cache_vserver_vsnames_initialized
          _vserver_cache_vsnames
        fi
        if (( ! $+_cache_vserver_cmds )); then
          typeset -g _cache_vserver_cmds_initialized
          _vserver_cache_cmds
        fi
      fi
    
      case "$state" in
        vsnames)
          _wanted commands expl 'vserver name' _vserver_vsnames && ret=0
          ;;
        cmds)
          _wanted commands expl 'vserver command' _vserver_commands && ret=0
          ;;
        args)
          local args
          if $+args; then
    	_arguments "$args[@]" && ret=0
          else
    	ret=0
          fi
          ;;
      esac
    
      return ret
    }
    
    (( $+functions[_vserver_commands] )) ||
    _vserver_commands() {
      compadd "$@" -k _cache_vserver_cmds || compadd "$@" ${(s.:.)_cache_vserver_cmds}
    }
    
    (( $+functions[_svk_list_patches] )) ||
    _vserver_vsnames() {
      local expl
      _wanted vserver expl 'vserver name' compadd -S '' $_cache_vserver_vsnames[@]
    }
    
    (( $+functions[_vserver_cache_cfgdir] )) ||
    _vserver_cache_cfgdir() {
      if [[ "$_cache_vserver_cfgdir_initialized" != true ]]; then
        typeset -ga _cache_vserver_cfgdir
        _cache_vserver_cfgdir=`vserver-info info SYSINFO | grep '^ *cfg-Directory' | awk '{print $2}'`
        _cache_vserver_cfgdir_initialized=true
      fi
    }
    
    (( $+functions[_vserver_cache_vsnames] )) ||
    _vserver_cache_vsnames() {
      if [[ "$_cache_vserver_vsnames_initialized" != true ]]; then
        typeset -ga _cache_vserver_vsnames
        _cache_vserver_vsnames=( $(ls -d $_cache_vserver_cfgdir/*/ | sed -e s,$_cache_vserver_cfgdir,, | tr -d '/') )
        _cache_vserver_vsnames_initialized=true
      fi
    }
    
    (( $+functions[_vserver_cache_cmds] )) ||
    _vserver_cache_cmds() {
      if [[ "$_cache_vserver_cmds_initialized" != true ]]; then
        typeset -ga _cache_vserver_cmds
          _cache_vserver_cmds=(
          start
          stop
          restart
          condrestart
          suexec
          exec
          enter
          chkconfig
          running
          status
          build
          unify
          pkg
          apt-get
          apt-config
          apt-cache
          rpm
          pkgmgmt	 
        )
        _cache_vserver_cmds_initialized=true
      fi
    }
    
    _vserver "$@"
    PK[2JLLfunctions/_xsetnuW+A#compdef xset
    
    local word=$'[^\0]#\0'
    local nul=$'\0'
    
    local guard='-_xset_guard ${match[1]%?}'
    
    _xset_guard () {
      local opt="$1" o
      (( no[$opt]-- ))
      for o in ${=eo[$opt]}; do
        no[$o]=0
      done 
      :
    }
    
    _xset_compopts () {
      local expl
      local opt tmp
    
      tmp=()
      for opt in ${(k)no[(R)*~0]}
      do
        if (( $+desc[$opt] )); then
          tmp=("$tmp[@]" "$opt:$desc[$opt]")
        else
          tmp=("$tmp[@]" "$opt")
        fi
      done
      _describe -o options tmp -- ||
      _describe -o options allopts --
    }
    
    _xset_compfpadd () {
      _files "$expl[@]" -/
    }
    
    _xset_compfpdel () {
      compadd "$expl[@]" - ${(s:,:)${"$(xset q)"##*
    Font Path:
     #}%%
    *}
    }
    
    _regex_arguments _xset_parse \
      "/$word/" \
      \( "/-d(isplay|)$nul/" "$guard" "/$word/" ':option-display:display:_x_display' \
      \| "/-c$nul/" "$guard" \
      \| "/c$nul/" "$guard" \
        \( "/(on|off)$nul/" ':option-c-bool:click:(on off)' \
        \| "/[0-9]##$nul/" ':option-c-volume:volume:' \
        \| \) \
      \| "/-b$nul/" "$guard" \
      \| "/b$nul/" "$guard" \
        \( "/(on|off)$nul/" ':option-b-bool:bell:(on off)' \
        \| "/[0-9]##$nul/" ':option-b-volume:bell volume:' \
          \( "/[0-9]##$nul/" ':option-b-pitch:bell pitch:' \
    	\( "/[0-9]##$nul/" ':option-b-duration:bell duration:' \
    	\| \) \
          \| \) \
        \| \) \
      \| "/bc$nul/" "$guard" \
      \| "/-bc$nul/" "$guard" \
      \| "/fp$nul/" "$guard" "/$word/" ':option-fp:font path:(default rehash)' \
      \| "/(fp[+=]|[+]fp)$nul/" "$guard" "/$word/" ':option-fp-add:font path:{compset -P "*,"; _xset_compfpadd}' \
      \| "/(fp-|-fp)$nul/" "$guard" "/$word/" ':option-fp-del:font path:{compset -P "*,"; _xset_compfpdel}' \
      \| "/-led$nul/" "$guard" \
        \( "/[0-9]##$nul/" ':option-led-number:led number:' \
        \| \) \
      \| "/led$nul/" "$guard" \
        \( "/(on|off)$nul/" ':option-led-bool:led:(on off)' \
        \| "/[0-9]##$nul/" ':option-led-number:led number:' \
        \| \) \
      \| "/m(ouse|)$nul/" "$guard" \
        \( "/default$nul/" ':option-mouse-default:mouse parameter:(default)' \
        \| "/[0-9]##(/[0-9]##|)$nul/" ':option-mouse-mult-div:accel_mult/accel_div:' \
          \( "/[0-9]##$nul/" ':option-mouse-threshold:threshold:' \
          \| \) \
        \| \) \
      \| "/[-+]dpms$nul/" "$guard" \
      \| "/dpms$nul/" "$guard" \
        \( "/[0-9]##$nul/" ':option-dpms-standby:standby timeout:' \
          \( "/[0-9]##$nul/" ':option-dpms-suspend:suspend timeout:' \
    	\( "/[0-9]##$nul/" ':option-dpms-off:off timeout:' \
    	\| \) \
          \| \) \
        \| "/force$nul/" ':option-dpms-force:force DPMS state:(force)' \
           "/(on|standby|suspend|off)$nul/" ':option-dpms-state:DPMS state:(on standby suspend off)' \
        \) \
      \| "/s$nul/" "$guard" \
        \( "/(blank|noblank|expose|noexpose|default|on|activate|reset)$nul/" \
           ':option-s:screen saver:(blank noblank expose noexpose default on activate reset off)' \
        \| "/off$nul/" \( "/off$nul/" ':option-s-off-period:period off:(off)' \| \) \
        \| "/[0-9]##$nul/" ':option-s-timeout:length:' \
          \( "/[0-9]##$nul/" ':option-s-period:period:' \
          \| \) \
        \| \) \
      \| "/-r$nul/" "$guard" \
        \( "/[0-9]##$nul/" ':option-r-keycode:keycode:' \
        \| \) \
      \| "/r$nul/" "$guard" \
        \( "/(on|off)$nul/" ':option-r-autorepeat:autorepeat:(on off)' \
        \| "/[0-9]##$nul/" ':option-r-keycode:keycode:' \
        \| \) \
      \| "/p$nul/" "$guard" \
        "/[0-9]##$nul/" ':option-p-pixel:pixel:' \
        "/$word/" ':option-p-color:color:_x_color' \
      \| "/(-|)k$nul/" "$guard" \
      \| "/(-|)q$nul/" "$guard" \
      \| "/[]/" ':options:options:_xset_compopts' \
      \) \#
    
    _xset () {
      local expl allopts
      typeset -A desc no eo
    
      desc=(
        b 'specify bell parameters'
        -b 'disable bell'
        bc 'enable bug compatibility'
        -bc 'disable bug compatibility'
        c 'control key click'
        -c 'disable key click'
        -dpms 'disable DPMS'
        +dpms 'enable DPMS'
        dpms 'specify DPMS parameter'
        fp\= 'set font path'
        fp 'control font path'
        -fp 'remove font path elements'
        fp- 'remove font path elements'
        +fp 'prepend font path elements'
        fp+ 'append font path elements'
        led 'control keyboard LEDs'
        -led 'turn off all LEDs'
        m 'specify mouse parameters'
        mouse 'specify mouse parameters'
        p 'specify pixel color values'
        r 'enable autorepeat'
        -r 'disable autorepeat'
        s 'specify screen saver parameters'
        q 'query current information'
        k 'enable lock'
        -k 'disable lock'
        -display 'display'
      )
    
      no=(
        -display 1 -d 0
        -c 1 c 1
        -b 1 b 1
        -bc 1 bc 1
        fp 1 fp= 1 +fp 1 fp+ 1 -fp 1 fp- 1
        -led 1 led 1
        mouse 1 m 0
        +dpms 1 -dpms 1 dpms 1
        s 1
        -r 1 r 1
        p 1
        -k 1 k 1
        -q 0 q 1
      )
    
      allopts=()
      for opt in ${(k)no}
      do
        if (( $+desc[$opt] )); then
          allopts=("$allopts[@]" "$opt:$desc[$opt]")
        else
          allopts=("$allopts[@]" "$opt")
        fi
      done
    
      eo=(
        -display	'-display -d'
        -d		'-display -d'
        -c		'-c c'
        c		'-c c'
        -b		'-b b'
        b		'-b b'
        -bc		'-bc bc'
        bc		'-bc bc'
        fp+		'fp fp='
        fp-		'fp fp='
        +fp		'fp fp='
        -fp		'fp fp='
        m		'm mouse'
        mouse	'm mouse'
        -dpms	'+dpms -dpms dpms'
        +dpms	'+dpms -dpms dpms'
        dpms	'+dpms -dpms dpms'
        -k		'-k k'
        k		'-k k'
      )
    
      _xset_parse
    }
    
    _xset "$@"
    PK[lY-functions/_servicesnuW+A#autoload
    
    local -a inits xinetds alls
    local expl ret=1
    
    if [[ $OSTYPE = freebsd* ]]; then
      if [[ -x /usr/sbin/service ]]; then
        alls=( $(service -l) ) && ret=0
    
        _wanted services expl service compadd "$@" - $alls[@] && ret=0
      fi
    elif chkconfig --list > /dev/null 2>&1; then
      alls=( ${(f)"$(LANGUAGE=C LANG=C LC_ALL=C chkconfig --list)"} )
      inits=( ${${${alls[1,(r)xinetd based*]}[1,-2]}/%[[:space:]]*/} )
      xinetds=( ${${${${alls[(r)xinetd based*,-1]}[2,-1]}/#[[:space:]]#}/%:*} )
    
      _alternative \
        'init:init service:compadd -a inits' \
        'xinetd:xinetd service:compadd -a xinetds' && ret=0
    else
      local -a scriptpath
      local dir
      # Known locations of init scripts
      # C.f. Unix/Commands/_init_d
      scriptpath=(/etc/init.d /etc/rc.d /etc/rc.d/init.d)
    
      for dir in $scriptpath; do
        if [[ -d $dir ]]; then
          break
        fi
      done
      _wanted services expl service compadd "$@" - $dir/*(-*:t) &&
      ret=0
    fi
    
    return ret
    PK[41sfunctions/_all_matchesnuW+A#autoload
    
    _all_matches() {
      local old
    
      zstyle -s ":completion:${curcontext}:" old-matches old
    
      if [[ "$old" = (only|true|yes|1|on) ]]; then
    
        if [[ -n "$compstate[old_list]" ]]; then
          compstate[insert]=all
          compstate[old_list]=keep
          return 0
        fi
    
        [[ "$old" = *only* ]] && return 1
      fi
    
      (( $comppostfuncs[(I)_all_matches_end] )) ||
          comppostfuncs=( "$comppostfuncs[@]" _all_matches_end )
    
      _all_matches_context=":completion:${curcontext}:"
    
      return 1
    }
    
    _all_matches_end() {
      local not
    
      zstyle -s "$_all_matches_context" avoid-completer not ||
          not=( _expand _old_list _correct _approximate )
    
      if [[ "$compstate[nmatches]" -gt 1 && $not[(I)(|_)$_completer] -eq 0 ]]; then
        local expl
    
        if zstyle -t "$_all_matches_context" insert; then
          compstate[insert]=all
        else
          _description all-matches expl 'all matches'
          compadd "$expl[@]" -C
        fi
      fi
    
      unset _all_matches_context
    }
    
    _all_matches "$@"
    PK[ttfunctions/_powerdnuW+A#compdef powerd
    
    local powerd_mode
    powerd_mode=(minimum maximum adaptative)
    _arguments -s \
        "-a[mode to use while on AC power]:mode:($powerd_mode)" \
        "-b[mode to use while on battery power]:mode:($powerd_mode)" \
        '-i[CPU idle percent level when begin to degrade performance]:percent:' \
        "-n[mode to use normally when the AC line state is unknown]:mode:($powerd_mode)" \
        '-p[polling interval (in milliseconds) for AC line state and system idle levels]:interval:' \
        '-P[alternative pidfile]:pidfile:_files' \
        '-r[CPU idle percent level where to increase performance]:percent:' \
        '-v[verbose mode]'
    PK[T}functions/tcp_fd_handlernuW+Alocal line fd=$1 sess=${tcp_by_fd[$1]}
    local TCP_HANDLER_ACTIVE=1
    if [[ -n $sess ]]
    then
      local TCP_INVALIDATE_ZLE
      if (( $# > 2 )); then
        zle -I
        ## debugging only
        # print "Flags on the play:" ${argv[3,-1]}
      else
        TCP_INVALIDATE_ZLE=1
      fi
      if ! tcp_read -d -u $fd; then
        if (( ${+functions[tcp_on_awol]} )); then
          tcp_on_awol $sess $fd
          (( $? == 100 )) || return $?
        fi
        [[ -n $TCP_INVALIDATE_ZLE ]] && zle -I
        print "[TCP fd $fd (session $sess) gone awol; removing from poll list]" >& 2
        zle -F $fd
        return 1
      fi
      return 0
    else
      zle -I
      # Handle fds not in the TCP set similarly.
      # This does the drain thing, to try and get as much data out as possible.
      if ! read -u $fd line; then
        print "[Reading on $fd failed; removing from poll list]" >& 2
        zle -F $fd
        return 1
      fi
      line="fd$fd:$line"
      local newline
      while read -u $fd -t newline; do
        line="${line}
    fd$fd:$newline"
      done
    fi
    print -r - $line
    PK[:_ofunctions/_phpnuW+A#compdef php
    
    # PHP 5.0.4  (cli)
    # PHP 4.3.11 (cli)
    
    local curcontext="$curcontext" line state expl
    typeset -A opt_args
    
    local -a args
    local exclusions php_files=':PHP file:_files -g "*.php(-.)"'
    
    if _pick_variant php5=PHP\ 5 php4 --version; then
      exclusions="-B --process-begin -R --process-code -F --process-file -E --process-end"
      args=(
        '(-B --process-begin -f --file -r --run 1)'{-B,--process-begin}'[run specified PHP code before processing input lines]:PHP code:'
        '(-R --process-code -F --process-file -f --file -r --run 1)'{-R,--process-code}'[run specified PHP code for every input line]:PHP code:'
        '(-F --process-file -R --process-code -f --file -r --run 1)'{-F,--process-file}'[parse and execute specified file for every input line]'$php_files
        '(-E --process-end -f --file -r --run 1)'{-E,--process-end}'[run specified PHP code after processing all input lines]:PHP code:'
        '(-H --hide-args)'{-H,--hide-args}'[hide any passed arguments from external tools]'
      )
    fi
    
    args+=(
      '(-a --interactive)'{-a,--interactive}'[run interactively]'
      '(-c --php-ini -n --no-php-ini)'{-c,--php-ini}'[look for php.ini file in the specified directory]:INI file or directory:_files -g "*.ini(-.)"'
      '(-c --php-ini -n --no-php-ini)'{-n,--no-php-ini}'[no php.ini file will be used]'
      '(-d --define)'{-d,--define}'[define INI entry]:configuration directive:->directive'
      '(-e --profile-info)'{-e,--profile-info}'[generate extended information for debugger/profiler]'
      "(-f --file -r --run $exclusions 1)"{-f,--file}'[parse specified file]'$php_files
      '(- 1 *)'{-h,--help}'[display help information]'
      '(- 1 *)'{-i,--info}'[PHP information]'
      '(-   *)'{-l,--syntax-check}'[syntax check only (lint)]'
      '(- 1 *)'{-m,--modules}'[show compiled in modules]'
      "(-r --run -f --file $exclusions -l --syntax-check -s --syntax-highlight -w --strip 1)"{-r,--run}'[run the specified PHP code without using script tags ]:PHP code:'\
      '(- 1 *)'{-s,--syntax-highlight}'[display colour syntax highlighted source]'
      '(- 1 *)'{-v,--version}'[display version information]'
      '(-   *)'{-w,--strip}'[display source with stripped comments and whitespace]'
      '(-z --zend-extension)'{-z,--zend-extension}'[load specified Zend extension]:extension file:->extension'
      '(-)1'$php_files
      '(-)*::script argument: _normal'
    )
    
    _arguments -C -s -S -A "-*" "$args[@]" && return 0
    
    case $state in
      directive)
        local -a directives suf
        local code='foreach (ini_get_all() as $k => $v) { echo "$k\n"; }'
        directives=( $(_call_program directives $words[1] -r ${(q)code} 2>/dev/null) )
        if compset -P '*='; then
          _default && return 0
        else
          compset -S '=*' || suf=( -qS '=' )
          _wanted directives expl 'configuration directive' compadd "$suf[@]" -a directives && return 0
        fi
      ;;
      extension)
        local -a paths
        if [[ -r /etc/ld.so.conf ]]; then
          paths=( ${(f)"$(devordir'
          '(nofsck)fsck[fsck should check this filesystem by default]'
          '(fsck)nofsck[fsck should not check this filesystem by default]'
          '(noquota)quota[turn on quotas]'
          '(quota)noquota[turn off quotas]'
          'lbsize[no of bytes transferred in each operation]:bytes'
        )
        
        _fs_iso9660=(
          'setx[set execute permissions on every file]'
          'notranslate[don'\''t translate filenames]'
          'cache[no of 2048 blocks for directory cache]:cache size'
          'noext[ignore rock ridge extensions]'
          '(nosusp)susp[enable system use sharing protocol]'
          '(susp)nosusp[disable system use sharing protocol]'
          '(norrip)rrip[enable rock ridge extensions]'
          '(rrip)norrip[disable rock ridge extensions]'
          'nmconv[specify filename translation]:filename translation:((c\:no\ translation l\:to\ lowercase m\:suppress\ version\ no))'
        )
          
        _fs_nfs=(
          '(fg)bg[mount in background]'
          '(bg)fg[mount in foreground]'
          'retry[number of retries]:no. of retries'
          'rsize[read buffer size]:read buffer size'
          'wsize[write buffer size]:write buffer size'
          'timeo[time-out period]:time-out period'
          'retrans[NFS transmissions]:no. of NFS transmissions'
          'port[IP port no]:IP port no'
          '(hard)soft[error on no server response]'
          '(soft)hard[retry pending server response]'
          'intr[allow keyboard interrupts on hard mount]'
          'noac[no attribute caching]'
          'private[use local locking and do not flush on last close]'
          'symttl[time-to-live of cached symbolic links]:seconds'
          "$_nfs_access[@]"
        )
        
        _fs_cachefs=(
          'backfstype[type of the back file system]:back file system type:(efs nfs iso9660 dos hfs cachefs)'
          'backpath[specify back file system location]:back file system location:_files -/'
          'cachedir[name of the cache directory]:name of cache directory:_files -/'
          'cacheid[cache ID]:cache ID'
          '(write-around)non-shared[cache not shared]'
          '(non-shared)write-around[cache shared]'
          'noconst[disable consistency checking]'
          'local-access[check permissions locally]'
          'purge[purge any cached information]'
          "$_nfs_access[@]"
        ) 
        
        ;;  
      solaris*)
        _fs_s5fs=(
          'remount[remount file system]'
          '(suid)nosuid[ignore suid and sgid bits]'
          '(nosuid)suid[use suid and sgid bits]'
        )
        _fs_ufs=(
          "(atime)noatime[don't update access time]"
          'f[fake an /etc/mnttab entry]'
          "m[don't make an /etc/mnttab entry]"
          '(noforcedirection)forcedirection[do I/O synchronously]'
          '(forcedirection)noforcedirection[do all I/O asynchronously]'
          '(nointr)intr[allow operations to be interrupted]'
          '(intr)nointr[prevent operations from being interrupted]'
          "(nolargefiles)largefiles[don't restrict file size]"
          '(largefiles)nolargefiles[restrict file size]'
          '(nologging)logging[log transactions]'
          '(logging)nologging[log transactions]'
          'onerror[action to recover from error]:action:(panic lock umount)'
          'quota[turn on quotas]'
          '(ro rw)rq[mount file system read-write with quotas]'
          "$_fs_s5fs[@]"
        )
        _fs_tmpfs=(
          'size[set file system size]:size'
        )
        _fs_pcfs=(
          '(nofoldcase)foldcase[force filenames to lowercase]'
          "(foldcase)nofoldcase[don't force filenames to lowercase]"
        )
        _fs_hsfs=(
          'nrr[no rock ridge]'
          'notraildot[no trail dot when no extension]'
          "nomaplcase[don't force lowercase]"
          'nosuid[ignore suid and sgid bits]'
        )
        _fs_nfs=(
          '(fg)bg[retry in the background]'
          '(bg)fg[retry in the foreground]'
          '(nogrpid)grpid[new file gets group ID of directory]'
          '(grpid)nogrpid[new file gets fsgid of current process]'
          '(nointr)intr[allow operations to be interrupted]'
          '(intr)nointr[prevent operations from being interrupted]'
          '(sec secure)kerberos[use kerberos authentication]'
          'noac[no attribute caching]'
          'port[server IP port number]:port'
          'posix[posix semantics]'
          'proto[specify protocol]:protocol:'\("$(grep -v '^#' /etc/netconfig 2> /dev/null | cut -d ' ' -f 1)"\)
          'public[force public file handle]'
          '(noquota)quota[enable quotas]'
          '(quota)noquota[disable quotas]'
          'timeo[specify initial timeout for UDP]:initial timeout for UDP'
          'retrans[set number of NFS retransmissions]:number of NFS retransmissions:(5)'
          'retry[specify number of mount failure retries]:mount failure retries:(10000)'
          'rsize[specify read buffer size]:read buffer size:(8192)'
          'wsize[specify write buffer size]:write buffer size:(8192)'
          '(kerberos secure)sec[set the security mode]:security mode:(sys dh krb4 none)'
          '(kerberos sec)secure[use Diffie-Hellman public key system]'
          'vers[set NFS version number]:NFS version number:(2 3)'
          "$_nfs_access[@]"
          "$_fs_s5fs[@]"
        ) 
        _fs_cachefs=(
          'backfstype[type of the back file system]:back file system type:(nfs hsfs)'
          'backpath[specify back file system location]:back file system location:_files -/'
          'cacheid[specify a cache ID]:cache ID'
          'local-access[check permissions locally]'
          'noconst[disable cache consistency checking]'
          'purge[purge any cached information]'
          '(suid)nosuid[ignore setuid and setgid bits]'
          '(nosuid)suid[use setuid and setgid bits]'
          '(write-around)non-shared[purge cache on writes]'
          '(non-shared)write-around[keep file in cache on writes]'
          "$_nfs_access[@]"
        )
        ;;
      osf*)
        _fs_advfs=(
          '(ro rw)rq[mount file system read-write]'
          'dual[allow mount even if same domain ID as already mounted domain]'
          'sync[do I/O synchronously]'
        )
        _fs_cdfs=(
          '(nodefperm)defperm[ignore permission bits]'
          '(defperm)defperm[use permission bits]'
          'noversion[strip off version extension]'
          'rrip[use RRIP extensions]'
        )
        _fs_nfs=(
          "$_nfs_ufs[@]"
          "$_fs_nfs[@]"
        )
        ;;
      linux*)
        _fs_any=(
          '(sync)async[do all I/O asynchronously]'
          '(noatime)atime[update access time]'
          '(norelatime)relatime[update atime relative to mtime/ctime]' 
          '(rw suid dev exec async)defaults[use default options]'
          '(nodev)dev[interpret devices]'
          '(noexec)exec[permit execution of binaries]'
          '(nomand)mand[allow mandatory locks]'
          "(atime)noatime[don't update access time]"
          "(relatime)norelatime[update access time without regard to mtime/ctime]"
          "(dev)nodev[don't interpret devices]"
          "(exec)noexec[don't allow execution of binaries]"
          "(mand)nomand[don'tallow mandatory locks]"
          '(suid)nosuid[ignore suid and sgid bits]'
          'remount[mount already mounted file system]'
          '(rw)ro[mount file system read-only]'
          '(ro)rw[mount file system read-write]'
          '(nosuid)suid[use suid and sgid bits]'
          '(async)sync[do I/O synchronously]'
          'dirsync[perform directory updates synchronously]'
          'loop[use loopback device]::loopback device:_files'
          'encryption[enable encryption]:cypher'
          'keybits[set number of bits in encryption key]:key size:(64 128 160 192 256)'
          'offset[specify data start for loopback mount]:offset (bytes)'
        )
        _fs_adfs=(
          'uid[set owner of root]:user ID'
          'gid[set group of root]:group ID'
          'ownmask[permission mask for ADFS "owner" permissions]:mask (octal)'
          'othmask[permission mask for ADFS "other" permissions]:mask (octal)'
        )
        _fs_affs=(
          'uid[set owner of root]:user ID'
          'gid[set group of root]:group ID'
          'setuid[set owner of all files]:user ID'
          'setgid[set group of all files]:group ID'
          'mode[set file permissions]:file permission bits'
          "protect[don't allow changes to permissions]"
          'usemp[set owner of root to owner of mount point]'
          'verbose[print message per mount]'
          'prefix[prefix before volume name when following link]:prefix string'
          "volume[prefix before '/' when following link]:prefix string"
          'reserved[set number of unused blocks at start of device]:number of unused blocks'
          'root[specify location of the root block]:root block location'
          'bs[specify block size]:block size:(512 1024 2048 4192)'
        )
        _fs_devpts=(
          "uid[set owner of newly created pty's]:user ID"
          "gid[set group of newly created pty's]:group ID"
          "mode[set mode of newly created pty's]:file permission bits"
        )
        _fs_ext2=(
          '(noacl)acl[support POSIX access control lists]'
          '(acl)noacl[do not support POSIX access control lists]'
          '(minixdf)bsddf[select bsddf behavior]'
          '(bsddf)minixdf[select bsddf behavior]'
          '(nocheck)check[set checking level]::checking level:((normal\:check\ inode\ and\ block\ bitmaps\ on\ mount strict\:check\ on block\ deallocation none\:no\ checking))'
          'debug[print debugging info upon each (re)mount]'
          'errors[specify behavior on error]:error behavior:((continue\:ignore\ errors remount-ro\:remount\ file\ system\ read-only panic\:panic\ and\ halt\ system))'
          '(nogrpid bsdgroups sysvgroups)grpid[new file gets group ID of directory]'
          '(grpid nogrpid sysvgroups)bsdgroups[new file gets group ID of directory]'
          '(grpid bsdgroups sysvgroups)nogrpid[new file gets fsgid of current process]'
          '(grpid bsdgroups nogrpid)sysvgroups[new file gets fsgid of current process]'
          'nobh[do not attach buffer_heads to file pagecache]'
          'nouid32[disable 32-bit UIDs and GIDs]'
          '(orlov)oldalloc[use old allocator for new inodes]'
          '(oldalloc)orlov[use orlov allocator for new inodes]'
          'resgid[specify access to reserved space (group ID)]:group ID'
          'resuid[specify access to reserved space (user ID)]:user ID'
          'sb[specify super block number]:super block number'
          '(nouser_xattr)user_xattr[support user extended attributes]'
          '(user_xattr)nouser_xattr[do not support user extended attributes]'
        )
        _fs_fat=(
          'blocksize[specify block size]:block size:(512 1024 2048)'
          'uid[specify user ID of all files]:user ID'
          'gid[specify group ID of all files]:group ID'
          'umask[specify umask]:umask value (octal)'
          'dmask[specify umask for directories only]:umask value (octal)'
          'fmask[specify umask for files only]:umask value (octal)'
          'check[specify checking level]:checking level:((relaxed\:accept\ upper\ and\ lower\ case,\ truncate\ long\ name normal\:like\ '"'\`'"'relaxed'"\\'"',\ but\ reject\ special\ characters strict\:like\ '"'\`'"'normal'"\\'"',\ but\ no\ long\ parts))'
          'codepage[specify codepage for converting filenames to short form]:codepage'
          'conf[specify CR/NL conversion]:CR/NL conversion mode:((binary\:no\ translation text\:conversion\ on\ all\ files auto\:perform\ translation\ on\ file\ without\ binary\ extension))'
          'conv[convert form of text files]:mode:(binary text auto)'
          'cvf_format[use specified compressed volume format module]:module'
          'cvf_option[pass option to CVF module]:option'
          'debug[debug mode]'
          'fat[specify fat type]:fat type (bit):(12 16 32)'
          'iocharset[character set to use for converting from 8 bit to unicode]:character set'
          'quiet[quiet mode]'
        )
        _fs_ext3=(
          "$_fs_ext2[@]"
          'journal[update fs journal]:update or inode number:(update)'
          'noload[do not load journal]'
          'data[specify mode for data]:journalling mode:(journal ordered writeback)'
          'commit[specify commit sync interval for data and metadata]:seconds'
        )
        _fs_msdos=( "$_fs_fat[@]" )
        _fs_umsdos=( "$_fs_fat[@]" )
        _fs_vfat=( "$_fs_fat[@]"
          '(utf8)uni_xlate[translate unicode to escaped sequences]'
          'posix[allow file names only differing in case]'
          'nonumtail[try short name before number extension]'
          '(uni_xlate)utf8[mount the filesystem in UTF8 mode]'
          'shortname[specify handling of 8.3 filenames]:mode:(lower win95 winnt mixed)'
        )
        _fs_hfs=(
          'creator[specify creator value]:creator'
          'type[specify type value]:type'
          'umask[specify umask]:umask value (octal)'
          'dir_umask[specify umask for directories only]:umask value (octal)'
          'file_umask[specify umask for files only]:umask value (octal)'
          'session[specify CDROM session to mount]:session'
          'part[specify partition number from device to use]:part'
          'quiet[do not complain about invalid mount options]'
        )
        _fs_hpfs=(
          'uid[specify user ID of all files]:user ID'
          'gid[specify group ID of all files]:group ID'
          'umask[specify umask]:umask value (octal)'
          'case[specify file name conversion]:file name conversion:((lower\:convert\ to\ lower\ case asis\:no\ conversion))'
          'conv[specify CR elimination]:CR elimination:((binary\:no\ elimination test\:delete\ CRs\ \(e.g.\ before\ NL\) auto\:sometimes\ yes,\ sometimes\ not))'
          "nocheck[don't abort mount on consistency check failure]"
        )
        _fs_iso9660=(
          'norock[disable Rock Ridge extensions]'
          'nojoliet[disable Microsoft Joliet extensions]'
          'check[specify file name conversion]:file name conversion:((relaxed\:convert\ to\ lower\ case\ before\ lookup strict\:no\ conversion))'
          'uid[specify user ID of all files]:user ID'
          'gid[specify group ID of all files]:group ID'
          'map[specify non-Rock Ridge name conversion]:file name conversion:((normal\:map\ upper\ to\ lower,\ ignore\ \;1,\ map\ \;\ to\ . off\:no\ conversion))'
          'mode[specify permissions]:file access permissions'
          'unhide[show hidden and associated files]'
          'block[specify block size]:block size:(512 1024 2048)'
          'cruft[ignore high bits of file length]'
          'session[select session number on multisession CD]:session'
          'sbsector[specify starting sector]:sector'
          'iocharset[character set when converting from 8 bit to unicode (Joliet)]:character set'
          'utf8[mount the filesystem in UTF8 mode (Joliet)]'
        )
        _fs_jfs=(
          'iocharset[character set when converting from unicode to ascii]:character set'
          'resize[resize volume to specified number of blocks]:blocks'
          '(integrity)nointegrity[do not write to the journal]'
          '(nointegrity)integrity[commit metadata changes to the journal]'
          'errors[specify behavior on error]:error behavior:((continue\:ignore\ errors remount-ro\:remount\ file\ system\ read-only panic\:panic\ and\ halt\ system))'
        )
        _fs_ntfs=(
          'iocharset[character set to use when returning file names]:character set'
          '(uni_xlate)utf8[use UTF-8 for converting file names]'
          '(utf8)uni_xlate[translate unicode to escaped sequences]:type:(0 1 2)'
          'posix[distinguish upper and lower case]:state:((0\:off 1\:on))'
          'uid[specify user ID of all files]:user ID'
          'gid[specify group ID of all files]:group ID'
          'umask[specify umask]:umask value (octal)'
        )
        _fs_reiserfs=(
          'conv[mount 3.5 fs using 3.6 format for new objects]'
          'hash[choose hash type]:hash function:(rupasov tea r5 detect)'
          '(no_unhashed_relocation)hashed_relocation[tune the block allocator]'
          'noborder[disable border allocator algorithm]'
          'nolog[disable journalling]'
          'notail[disable packing of files into the tree]'
          '(hashed_relocation)no_unhashed_relocation[tune the block allocator]'
          'replayonly[replay but do not mount]'
          'resize[assume the device has this many blocks]:number of blocks'
        )
        _fs_smbfs=( "$_fs_nfs[@]" )
        _fs_tmpfs=(
          'size[set file system size]:size (bytes)'
          'mode[set root directory permissions]:mode'
          'nr_blocks[set number of blocks]:blocks'
          'nr_inodes[set number of inodes]:inodes'
        )
        _fs_udf=(
          'uid[specify user ID of all files]:user ID'
          'gid[specify group ID of all files]:group ID'
          'umask[specify umask]:umask value (octal)'
          'unhide[show hidden and associated files]'
          'undelete[show deleted files]'
          'nostrict[unset strict conformance]'
          'bs[set the block size]:block size:2048'
          'novrs[skip volume sequence recognition]'
          'session[set the CDROM session]:session'
          'anchor[override standard anchor location]:anchor location:256'
          'lastblock[set the last block of the file system]:last block'
        )
        _fs_ufs=(
          'ufstype[set ufs type]:ufs type:(old 44bsd sun sunx86 nextstep nextstep-cd openstep)'
          'onerror[set behaviour on error]:behaviour on error:(panic lock umount repair)'
        )
        _fs_usbfs=(
          'devuid[set owner of device files]:user ID'
          'devgid[set group of device files]:group ID'
          'devmode[set mode of device files]:file permission bits'
          'busuid[set owner of bus directories]:user ID'
          'busgid[set group of bus directories]:group ID'
          'busmode[set mode of bus directories]:file permission bits'
          'listuid[set owner of file devices]:user ID'
          'listgid[set group of file devices]:group ID'
          'listmode[set mode of file devices]:file permission bits'
        )
        _fs_xfs=(
          'biosize[specify preferred buffered I/O size]:base 2 logarithm:((13:8K 14:16K 15:32K 16:64K))'
          '(xdsm)dmapi[enable DMAPI event callouts]'
          '(dmapi)xdsm[enable DMAPI event callouts]'
          'logbufs[set number of in-memory log buffers]:(2 3 4 5 6 7 8)'
          'logbsize[set size of each in-memory log buffer]:(16384 32768)'
          'logdev[use external log device]:_files'
          'rtdev[use external realtime device]:_files'
          'noalign[do not align data allocations at stripe unit boundaries]'
          'noatime[do not update atime on reads]'
          'norecovery[do not run log recovery]'
          'nouuid[ignore the filesystem uuid]'
          'osyncisdsync[make O_SYNC behave as O_DSYNC]'
          '(usrquota uqnoenforce)quota[enable user quotas]'
          '(quota uqnoenforce)usrquota[enable user quotas]'
          '(quota usrquota)uqnoenforce[enable user quotas without enforcement]'
          '(gqnoenforce)grpquota[enable group quotas]'
          '(grpquota)gqnoenforce[enable group quotas without enforcement]'
          'sunit[specify stripe unit]:size'
          'swidth[specify stripe width]:size'
        )
        ;;
      freebsd*|dragonfly*)
        _fs_any=(
          '(sync)async[do all I/O asynchronously]'
          'current[use current options on already mounted file system]'
          'force[force R/W mount of unclean filesystem]'
          'fstab[use options listed in /etc/fstab]'
          'noasync[do I/O synchronously]'
          "noatime[don't update access time]"
          'noauto[can only be mounted explicitly]'
          'noclusterr[disable read clustering]'
          'noclusterw[disable write clustering]'
          "nodev[don't interpret devices]"
          "noexec[don't allow execution of binaries]"
          'nosuid[ignore suid and sgid bits]'
          "nosymfollow[don't follow symlinks]"
          'rdonly[mount file system read-only]'
          '(async)sync[do all I/O synchronously]'
          'suiddir[allow suid bits on directories]'
          'update[change status of already mounted filesystem]'
          'union[cause the namespace at the mount point to appear as the union of the mounted filesystem and the existing directory]'
        )
        _fs_cd9660=(
          'extatt[enable the use of extended attributes]'
          'gens[do not strip version numbers on files]'
          'nojoliet[do not use any Joliet extensions]'
          'norrip[do not use any Rockridge extensions]'
          'nostrictjoliet[relax checking for Supplementary Volume Descriptor Flags field]'
        )
        _fs_std=(
          "nodev[don't interpret devices]"
          "noexec[don't allow execution of binaries]"
          'nosuid[ignore suid and sgid bits]'
          'rdonly[mount file system read-only]'
          'union[cause the namespace at the mount point to appear as the union of the mounted filesystem and the existing directory]'
        )
        _fs_devfs=( "$_fs_std[@]" )
        _fs_fdesc=( "$_fs_std[@]" )
        _fs_kernfs=( "$_fs_std[@]" )
        _fs_linprocfs=( "$_fs_std[@]" )
        _fs_procfs=( "$_fs_std[@]" )
        _fs_msdos=(
          'shortnames[]'
          'longnames[]'
          'nowin95[]'
          'shortnames[force only the old MS-DOS 8.3 style filenames to be visible]'
          'longnames[force Windows 95 long filenames to be visible]'
          'nowin95[completely ignore Windows 95 extended file information]'
        )
        if [[ "${OSTYPE}" =~ freebsd.* ]]; then
    	    _fs_msdosfs=( "$_fs_msdos[@]" )
        fi
        ;;
      esac
    fi
    
    if [[ "$service" = mount ]]; then
    
      # Here are the tests and tables for the arguments and options for
      # the `mount' program. This should set the `deffs' parameter if
      # the default file system type is not `iso9660' (it should be set
      # to the name of the default file system type), and set 'typeops'
      # to the mount  option for file system type selection when it is
      # not '-t'.
    
      case "$OSTYPE" in
      aix*)
        args=( -s
          '(:)-a[mount all filesystems in /etc/fstab]'
          '-f[forced mount]'
          '-n[remote node]:remote node:_hosts'
          '-p[mount as removable file system]'
          '-r[mount read-only]'
          '-t[specify file system type]:file system type:_file_systems'
          '-o[specify file system options]:file system option:->fsopt'
          '-v[filesystem defined by /etc/vfs]:VfsName'
          ':dev or dir:->devordir'
          ':mount point:_files -/'
        )
        deffs=jfs
        ;;
      irix*)
        args=( -s
          '-a[mount all filesystems in /etc/fstab]'
          '-b[mount all filesystems in /etc/fstab except those listed]:mount point:_dir_list -s,'
          '-c[check any dirty filesystems before mounting]'
          "-f[fake a new /etc/mtab entry, but don't mount any filesystems]"
          '-h[mount all filesystems associated with host]:host:_hosts'
          '-n[mount filesystem without making entry in /etc/mtab]'
          '-o[specify file system options]:file system option:->fsopt'
          '-p[print list of mounted filesystems in format suitable for /etc/fstab]'
          '-r[mount read-only]'
          '-t[specify file system type]:file system type:_file_systems'
          '-v[verbose]'
          '-M[use alternate mtab]:alternate mtab:_files'
          '-P[with -p, prepend prefix to paths]:prefix'
        )
        deffs=efs
        ;;
      linux*)
        args=( -s
          '(- :)-h[show help]'
          '(- :)-V[show version]'
          '(-V -h)-v[verbose mode]'
          '(-V -h)-p[specify file descriptor from which to read passphrase]:file descriptor:_file_descriptors'
          '(-V -h -o :)-a[mount all filesystems in fstab]'
          '(-V -h)-F[fork off one child per device]'
          '(-V -h)-f[fake mount]'
          "(-V -h)-i[don't call /sbin/mount. helper]"
          '(-V -h)-l[output ext2, ext3 and XFS labels]'
          "(-V -h)-n[don't write /etc/mtab]"
          '(-V -h)-s[tolerate sloppy mount options]'
          '(-V -h -w)-r[mount read-only]'
          '(-V -h -r)-w[mount read/write]'
          '(-V -h)-L[mount partition with specified label]:label'
          '(-V -h)-U[mount partition with specified uuid]:uuid'
          '(-V -h)-t[specify file system type]:file system type:->fslist'
          '(-V -h)-O[with -a, restrict filesystems by options]:file system option:->fsopt'
          '(-V -h -a -O)-o[specify file system options]:file system option:->fsopt'
          '(: -)--bind[remount part of filesystem elsewhere]:old directory:_directories:new directory:_directories'
          '(: -)--rbind[remount part of filesystem including submounts elsewhere]:old directory:_directories:new directory:_directories'
          '(: -)--move[move part of filesystem elsewhere]:old directory:_directories:new directory:_directories'
          ':dev or dir:->devordir'
          ':mount point:_files -/'
        )
        ;;
      osf*)
        args=( -s
          '(-o :)-a[mount all filesystems in fstab]'
          '-d[mount even if not unmounted]'
          '-e[list all mount points]'
          '-f[fake mount]'
          '-l[display values of all file system options]'
          '-t[specify file system type]:file system type:_file_systems'
          '-o[specify file system options]:file system option:->fsopt'
          '-u[remount file system]'
          '-r[mount read-only]'
          '-w[mount read/write]'
          '-v[verbose]'
          ':dev or dir:->devordir'
          ':mount point:_files -/'
        )
        deffs=cdfs
        ;;
      solaris*)
        args=( -s
          '(-p -v)-a[mount all filesystems in fstab]'
          '(-p -v)-F[specify file system type]:file system type:_file_systems'
          '(-a -v)-p[print mounted file systems]'
          '(-p -a)-v[print mounted file systems verbosely]'
          '(-p -v)-V[echo command-line but do not execute]'
          "(-p -v)-m[don't write /etc/mnttab]"
          '(-p -v)-g[mount globally]'
          '(-p -v)-o[specify file system options]:file system option:->fsopt'
          '(-p -v)-O[overlay mount]'
          '(-p -v)-r[mount read-only]'
          ':dev or dir:->devordir'
          ':mount point:_files -/'
        )
        deffs=hsfs
        typeops=-F
        ;;
      freebsd*|dragonfly*)
        args=( -s
          '(:)-a[mount all filesystems in fstab]'
          '-d[cause everything to be done except for the actual system call]'      
          '-f[forced mount]'
          '-o[specify file system options]:file system option:->fsopt'
          '-p[print mounted file systems]'
          '-r[mount readonly]'
          '-t[specify file system type]:file system type:->fslist'
          '-u[change status of already mounted filesystem]'
          '-v[verbose mode]'
          '-w[mount read/write]'
          ':dev or dir:->devordir'
          ':mount point:_files -/'
        )
        deffs=ufs
        ;;
      *)
        # Default for all other systems. Dunno.
    
        args=( -s
          '(-o :)-a[mount all filesystems in fstab]'
          '-t[specify file system type]:file system type:_file_systems'
          '-o[specify file system options]:file system option:->fsopt'
          '-f[fake mount]'
          ':dev or dir:->devordir'
          ':mount point:_files -/'
        )
        deffs=ufs
        ;;
      esac
    
      _arguments -C "$args[@]" && ret=0
    
    else
    
      # Completion for umount.
    
      case "$OSTYPE" in
        aix*)
          args=(
    	'(*)-a[unmount all mounted file systems]'
    	'-f[force unmount]'
    	'-n[remote node]:remote node:_hosts'
    	'-t[specify file system type]:file system type:_file_systems'
    	'*:dev or dir:->udevordir'
          )
        ;;
        irix*)
          args=(
    	'-a[unmount all mounted file systems]'
    	'-b[unmount all filesystems in /etc/fstab except those listed]:mount point:_dir_list -s,'
    	'-h[unmount all filesystems associated with host]:host:_hosts'
    	'-k[kill all processes with files open on filesystems before unmounting]'
    	'-t[unmount all filesystems of specified type]:file system type:_file_systems'
    	'-v[verbose]'
          )
        ;;  
        linux*)
          args=(
    	'(- *)-h[show help]'
    	'(- *)-V[show version]'
    	'(-V -h)-v[verbose mode]'
    	"(-V -h)-n[don't write /etc/mtab]"
    	'(-V -h)-r[remount read-only on failure]'
    	'(-V -h)-d[for loopback mount, free loop device]'
            "(-V -h)-i[don't call /sbin/umount. helper]"
    	'(-V -h *)-a[unmount all file systems from /etc/mtab]'
    	'(-V -h)-t[specify file system type]:file system type:_file_systems'
    	'(-V -h *)-O[with -a, restrict filesystems by options]:file system option:->fsopt'
    	'(-V -h)-f[force unmount]'
    	'(-V -h)-l[lazy unmount]'
    	'*:dev or dir:->udevordir'
          )
        ;;
        freebsd*|dragonfly*)
          args=(
    	'(*)-a[unmount all mounted file systems]'
    	'-A[unmount all mounted file systems except the root]'
    	'-f[force unmount]'
    	'-h[unmount all filesystems associated with host]:host:_hosts'
    	'-t[unmount all filesystems of specified type]:file system type:->fslist'
    	'-v[verbose mode]'
    	'*:dev or dir:->udevordir'
          )
        ;;
        solaris*)
          args=(
            '-a[unmount all mounted file systems]'
    	'-f[force unmount]'
            '-V[echo command-line but do not execute]'
            '-o[specify file system options]:file system option:->fsopt'
    	'*:dev or dir:->udevordir'
          )
        ;;
        *)
          args=(
    	'-v[verbose mode]'
    	'(*)-a[unmount all file systems from /etc/mtab]'
    	'-t[specify file system type]:file system type:_file_systems'
    	'*:dev or dir:->udevordir'
          )
        ;;
      esac
    
      _arguments -C -s "$args[@]" && ret=0
    
    fi
    
    case "$state" in
    fslist)
      compset -P '*,'
      compset -S ',*' || suf=','
      _file_systems -qS "$suf"
    ;;
    fsopt)
      _tags options || return 1
    
      eval 'tmp=(' '"$_fs_'${(s:,:)^${opt_args[$typeops]:-${deffs}}}'[@]"' ')'
      tmp=( "$_fs_any[@]" "${(@)tmp:#}" )
      _values -s , 'file system option' "$tmp[@]" && ret=0
      ;;
    devordir)
      local dev_tmp mp_tmp mline
    
      if compset -P '*:'; then
        _wanted exports expl 'exported path' compadd \
    	${${(f)"$(path+=( {/usr,}/sbin(N) ) _call_program exports \
    	showmount -e ${IPREFIX%:} 2>/dev/null)"}[2,-1]%% *} && ret=0
        return ret
      fi
      if compset -S ':*'; then
        _hosts -S '' && ret=0
        return ret
      fi
    
      case "$OSTYPE" in
      dragonfly*)
        while read mline; do 
          case $mline[(w)1] in
    	\#* )
    	  ;;
    	proc)
    	  ;;
    	*)
    	  [[ $mline[(w)3] == swap ]] || \
    	    dev_tmp+=( $mline[(w)1] ) \
    	    mp_tmp+=( $mline[(w)2] )
    	  ;;
          esac
        done < /etc/fstab
    
        _alternative \
          'hosts:host:_hosts -S :' \
          'devices:device:compadd -a dev_tmp' \
          'directories:mount point:compadd -a mp_tmp' && ret=0
          ;;
      freebsd*)
        local _glabel
        while read mline; do 
          case $mline[(w)1] in
    	\#* )
    	  ;;
    	proc)
    	  ;;
    	*)
    	  [[ $mline[(w)3] == swap ]] || \
    	    dev_tmp+=( $mline[(w)1] ) \
    	    mp_tmp+=( $mline[(w)2] )
    	  ;;
          esac
        done < /etc/fstab
        # 
        /sbin/ggatel list | while read mline; do
          dev_tmp+=(/dev/$mline)
        done
    
        # add glabel devices
        _glabel=(${(M)${(f)"$(/sbin/glabel list)"}:#*Name:[[:space:]]*/*})
        for mline ($_glabel);do
    	    dev_tmp+=( mline[(w)3] )
        done
    
        _alternative \
          'hosts:host:_hosts -S :' \
          'devices:device:compadd -a dev_tmp' \
          'directories:mount point:compadd -a mp_tmp' && ret=0
        ;;
      *)
        if (( ${${(s.,.)opt_args[-o]}[(I)loop(|=*)]} )) ; then
          _wanted device-files expl 'loop device file' _files && ret=0
        else
          _alternative \
            'hosts:host:_hosts -S :' \
            'files:device or mount point:_files -g "*(-%b,-/)"' && ret=0
        fi
        ;;
      esac
      ;;
    udevordir)
      local dev_tmp dpath_tmp mp_tmp mline
    
      case "$OSTYPE" in
      linux*|irix*)
        tmp=( "${(@f)$(< /etc/mtab)}" )
        dev_tmp=( "${(@)${(@)tmp%% *}:#none}" )
        mp_tmp=( "${(@)${(@)tmp#* }%% *}" )
        ;;
      freebsd*|dragonfly*)
        /sbin/mount | while read mline; do
          dev_tmp+=( $mline[(w)1] )
          mp_tmp+=( $mline[(w)3] )
        done
      ;;
      *)
        /sbin/mount | while read mline; do
          mp_tmp+=( $mline[(w)1] )
          dev_tmp+=( $mline[(w)3] )
        done
        ;;
      esac
    
      local MATCH MBEGIN MEND
      # "Mummy, why is mount point matching full of squiggles?"
      #
      # "Well, dear, the clever people who wrote Linux decided that some
      # funny characters that might confuse programmes looking at the names
      # would be encoded as octal escapes, like for example \040 for space.
      # The clever people who wrote zsh decided that nothing would
      # ever be quite as simple as it should be, so to substitute octal
      # escapes everywhere in a string, even though the shell understands
      # them natively in print escapes, needs some hackery where you match
      # the octal number using the numeric closure syntax introduced after
      # 4.3.4, then reinput the number in a standard math mode format as 8#OOO,
      # and turn that into a character using the (#) parameter flag."
      #
      # "Mummy, why is nothing ever quite as simple as it should be?"
      #
      # "Well, dear, if it was then the clever people who write programmes would
      # have been replaced by intelligent monkeys and then they'd be out
      # of working roaming the streets, and we wouldn't want that, would we?"
      mp_tmp=("${(@q)mp_tmp//(#m)\\[0-7](#c3)/${(#)$(( 8#${MATCH[2,-1]} ))}}")
      dpath_tmp=( "${(@Mq)dev_tmp:#/*}" )
      dev_tmp=( "${(@q)dev_tmp:#/*}" )
    
      _alternative \
        'device-labels:device label:compadd -a dev_tmp' \
        'device-paths: device path:_canonical_paths -A dpath_tmp -N device-paths device\ path' \
        'directories:mount point:_canonical_paths -A mp_tmp -N directories mount\ point' && ret=0
      ;;
    esac
    
    return ret
    PK[ !4t\	\	
    functions/_cpnuW+A#compdef cp
    
    _arguments -s \
      '(-a --archive)'{-a,--archive}'[same as -dpR]' \
      '(-b --backup)-b[backup]' \
      '(-b --backup)--backup=[backup]:method:(none off numbered t existing nil simple never)' \
      '--copy-contents[copy contents of special files when recursive]' \
      '-d[same as --no-dereference --preserve=links]' \
      '(-f --force)'{-f,--force}'[remove and retry for destinations that cannot be opened]' \
      '(-i --interactive)'{-i,--interactive}'[prompt before overwrite]' \
      '-H[follow command-line symbolic links]' \
      '(-l --link)'{-l,--link}'[link files instead of copying]' \
      '(-L --dereference)'{-L,--dereference}'[always follow symbolic links]' \
      '(-n --no-clobber)'{-n,--no-clobber}'[do not overwrite an existing file]' \
      '(-P --no-dereference)'{-P,--no-dereference}'[never follow symbolic links]' \
      '-p[same as --preserve=mode,ownership,timestamps]' \
      '--preserve=[preserve specified attributes]:attributes to preserve:_values -s , mode timestamps ownership links context xattr all' \
      '--no-preserve=[don'\''t preserve specified attributes]:attributes not to preserve:_values -s , mode timestamps ownership links context xattr all' \
      '--parents[append source path to target directory]' \
      '(-R -r --recursive)'{-R,-r,--recursive}'[copy directories recursively]' \
      '--reflink=[control clone/CoW copies]:when to perform a lightweight copy:(always auto)' \
      '--remove-destination[remove each existing destination file before attempting to open it]' \
      '--sparse=[control creation of sparse files]:when to create sparse files:(auto always never)' \
      '--strip-trailing-slashes[remove any trailing slashes from each source argument]' \
      '(-s --symbolic-link)'{-s,--symbolic-link}'[make symbolic links instead of copies of non-directories]' \
      '(-S --suffix)'{-S,--suffix=}'[override the usual backup suffix]:backup suffix:' \
      '(-t --target-directory)'{-t,--target-directory=}'[copy all source arguments into target directory]:target directory:_files -/' \
      '(-T --no-target-directory)'{-T,--no-target-directory}'[treat DEST as a normal file]' \
      '(-u --update)'{-u,--update}'[copy only when source is newer than destination or destination is missing]' \
      '(-v --verbose)'{-v,--verbose}'[explain what is being done]' \
      '(-x --one-file-system)'{-x,--one-file-system}'[stay on this file system]' \
      '--help' \
      '--version' \
      '*:file or directory:_files'
    PK[R€btbt
    functions/_hgnuW+A#compdef hg
    
    # Zsh completion script for mercurial.  Rename this file to _hg and copy
    # it into your zsh function path (/usr/share/zsh/site-functions for
    # instance)
    #
    # If you do not want to install it globally, you can copy it somewhere
    # else and add that directory to $fpath. This must be done before
    # compinit is called. If the file is copied to ~/.zsh.d, your ~/.zshrc
    # file could look like this:
    #
    # fpath=("$HOME/.zsh.d" $fpath)
    # autoload -U compinit
    # compinit
    #
    # Copyright (C) 2005, 2006 Steve Borho 
    # Copyright (C) 2006-9 Brendan Cully 
    #
    # Permission is hereby granted, without written agreement and without
    # licence or royalty fees, to use, copy, modify, and distribute this
    # software and to distribute modified versions of this software for any
    # purpose, provided that the above copyright notice and the following
    # two paragraphs appear in all copies of this software.
    #
    # In no event shall the authors be liable to any party for direct,
    # indirect, special, incidental, or consequential damages arising out of
    # the use of this software and its documentation, even if the authors
    # have been advised of the possibility of such damage.
    #
    # The authors specifically disclaim any warranties, including, but not
    # limited to, the implied warranties of merchantability and fitness for
    # a particular purpose.  The software provided hereunder is on an "as
    # is" basis, and the authors have no obligation to provide maintenance,
    # support, updates, enhancements, or modifications.
    
    emulate -LR zsh
    setopt extendedglob
    
    local curcontext="$curcontext" state line
    typeset -A _hg_cmd_globals
    
    _hg() {
      local cmd _hg_root
      integer i=2
      _hg_cmd_globals=()
    
      while (( i < $#words ))
      do
        case "$words[$i]" in
          -R|--repository)
            eval _hg_root="$words[$i+1]"
            _hg_cmd_globals+=("$words[$i]" "$_hg_root")
            (( i += 2 ))
            continue
          ;;
          -R*)
            _hg_cmd_globals+="$words[$i]"
            eval _hg_root="${words[$i]#-R}"
           (( i++ ))
           continue
          ;;
          --cwd|--config)
            # pass along arguments to hg completer
            _hg_cmd_globals+=("$words[$i]" "$words[$i+1]")
            (( i += 2 ))
            continue
          ;;
          -*)
            # skip option
            (( i++ ))
            continue
          ;;
        esac
        if [[ -z "$cmd" ]]
        then
          cmd="$words[$i]"
          words[$i]=()
          (( CURRENT-- ))
        fi
        (( i++ ))
      done
    
      if [[ -z "$cmd" ]]
      then
        _arguments -s -w : $_hg_global_opts \
        ':mercurial command:_hg_commands'
        return
      fi
    
      # resolve abbreviations and aliases
      if ! (( $+functions[_hg_cmd_${cmd}] ))
      then
        local cmdexp
        (( $#_hg_cmd_list )) || _hg_get_commands
    
        cmdexp=$_hg_cmd_list[(r)${cmd}*]
        if [[ $cmdexp == $_hg_cmd_list[(R)${cmd}*] ]]
        then
          # might be nice to rewrite the command line with the expansion
          cmd="$cmdexp"
        fi
        if [[ -n $_hg_alias_list[$cmd] ]]
        then
          cmd=$_hg_alias_list[$cmd]
        fi
      fi
    
      curcontext="${curcontext%:*:*}:hg-${cmd}:"
    
      zstyle -s ":completion:$curcontext:" cache-policy update_policy
    
      if [[ -z "$update_policy" ]]
      then
        zstyle ":completion:$curcontext:" cache-policy _hg_cache_policy
      fi
    
      if (( $+functions[_hg_cmd_${cmd}] ))
      then
        _hg_cmd_${cmd}
      else
        # complete unknown commands normally
        _arguments -s -w : $_hg_global_opts \
          '*:files:_hg_files'
      fi
    }
    
    _hg_cache_policy() {
      typeset -a old
    
      # cache for a minute
      old=( "$1"(mm+10) )
      (( $#old )) && return 0
    
      return 1
    }
    
    _hg_get_commands() {
      typeset -ga _hg_cmd_list
      typeset -gA _hg_alias_list
      local hline cmd cmdalias
    
      _call_program hg hg debugcomplete -v | while read -A hline
      do
        cmd=$hline[1]
        _hg_cmd_list+=($cmd)
    
        for cmdalias in $hline[2,-1]
        do
          _hg_cmd_list+=($cmdalias)
          _hg_alias_list+=($cmdalias $cmd)
        done
      done
    }
    
    _hg_commands() {
      (( $#_hg_cmd_list )) || _hg_get_commands
      _describe -t commands 'mercurial command' _hg_cmd_list
    }
    
    _hg_revrange() {
      compset -P 1 '*:'
      _hg_tags "$@"
    }
    
    _hg_tags() {
      typeset -a tags
      local tag rev
    
      _hg_cmd tags 2> /dev/null | while read tag
      do
        tags+=(${tag/ #    [0-9]#:*})
      done
      (( $#tags )) && _describe -t tags 'tags' tags
    }
    
    # likely merge candidates
    _hg_mergerevs() {
      typeset -a heads
      local myrev
    
      heads=(${(f)"$(_hg_cmd heads --template '{rev}\\n')"})
      # exclude own revision
      myrev=$(_hg_cmd log -r . --template '{rev}\\n')
      heads=(${heads:#$myrev})
    
      (( $#heads )) && _describe -t heads 'heads' heads
    }
    
    _hg_files() {
      if [[ -n "$_hg_root" ]]
      then
        [[ -d "$_hg_root/.hg" ]] || return
        case "$_hg_root" in
          /*)
            _files -W $_hg_root
          ;;
          *)
            _files -W $PWD/$_hg_root
          ;;
        esac
      else
        _files
      fi
    }
    
    _hg_status() {
      [[ -d $PREFIX ]] || PREFIX=$PREFIX:h
      status_files=(${(ps:\0:)"$(_hg_cmd status -0n$1 ./$PREFIX 2>/dev/null)"})
    }
    
    _hg_unknown() {
      typeset -a status_files
      _hg_status u
      _wanted files expl 'unknown files' _multi_parts / status_files
    }
    
    _hg_missing() {
      typeset -a status_files
      _hg_status d
      _wanted files expl 'missing files' _multi_parts / status_files
    }
    
    _hg_modified() {
      typeset -a status_files
      _hg_status m
      _wanted files expl 'modified files' _multi_parts / status_files
    }
    
    _hg_resolve() {
      local rstate rpath
    
      [[ -d $PREFIX ]] || PREFIX=$PREFIX:h
    
      _hg_cmd resolve -l ./$PREFIX 2> /dev/null | while read rstate rpath
      do
        [[ $rstate == 'R' ]] && resolved_files+=($rpath)
        [[ $rstate == 'U' ]] && unresolved_files+=($rpath)
      done
    }
    
    _hg_resolved() {
      typeset -a resolved_files unresolved_files
      _hg_resolve
      _wanted files expl 'resolved files' _multi_parts / resolved_files
    }
    
    _hg_unresolved() {
      typeset -a resolved_files unresolved_files
      _hg_resolve
      _wanted files expl 'unresolved files' _multi_parts / unresolved_files
    }
    
    _hg_config() {
        typeset -a items
        items=(${${(%f)"$(_call_program hg hg showconfig)"}%%\=*})
        (( $#items )) && _describe -t config 'config item' items
    }
    
    _hg_addremove() {
      _alternative 'files:unknown files:_hg_unknown' \
        'files:missing files:_hg_missing'
    }
    
    _hg_ssh_urls() {
      if [[ -prefix */ ]]
      then
        if zstyle -T ":completion:${curcontext}:files" remote-access
        then
          local host=${PREFIX%%/*}
          typeset -a remdirs
          compset -p $(( $#host + 1 ))
          local rempath=${(M)PREFIX##*/}
          local cacheid="hg:${host}-${rempath//\//_}"
          cacheid=${cacheid%[-_]}
          compset -P '*/'
          if _cache_invalid "$cacheid" || ! _retrieve_cache "$cacheid"
          then
            remdirs=(${${(M)${(f)"$(_call_program files ssh -a -x $host ls -1FL "${(q)rempath}" 2> /dev/null)"}##*/}%/})
            _store_cache "$cacheid" remdirs
          fi
          _describe -t directories 'remote directory' remdirs -S/
        else
          _message 'remote directory'
        fi
      else
        if compset -P '*@'
        then
          _hosts -S/
        else
          _alternative 'hosts:remote host name:_hosts -S/' \
            'users:user:_users -S@'
        fi
      fi
    }
    
    _hg_urls() {
      if compset -P bundle://
      then
        _files
      elif compset -P ssh://
      then
        _hg_ssh_urls
      elif [[ -prefix *: ]]
      then
        _urls
      else
        local expl
        compset -S '[^:]*'
        _wanted url-schemas expl 'URL schema' compadd -S '' - \
          http:// https:// ssh:// bundle://
      fi
    }
    
    _hg_paths() {
      typeset -a paths pnames
      _hg_cmd paths 2> /dev/null | while read -A pnames
      do
        paths+=($pnames[1])
      done
      (( $#paths )) && _describe -t path-aliases 'repository alias' paths
    }
    
    _hg_remote() {
      _alternative 'path-aliases:repository alias:_hg_paths' \
        'directories:directory:_files -/' \
        'urls:URL:_hg_urls'
    }
    
    _hg_clone_dest() {
      _alternative 'directories:directory:_files -/' \
        'urls:URL:_hg_urls'
    }
    
    # Common options
    _hg_global_opts=(
        '(--repository -R)'{-R+,--repository}'[repository root directory]:repository:_files -/'
        '--cwd[change working directory]:new working directory:_files -/'
        '(--noninteractive -y)'{-y,--noninteractive}'[do not prompt, assume yes for any required answers]'
        '(--verbose -v)'{-v,--verbose}'[enable additional output]'
        '*--config[set/override config option]:defined config items:_hg_config'
        '(--quiet -q)'{-q,--quiet}'[suppress output]'
        '(--help -h)'{-h,--help}'[display help and exit]'
        '--debug[debug mode]'
        '--debugger[start debugger]'
        '--encoding[set the charset encoding (default: UTF8)]'
        '--encodingmode[set the charset encoding mode (default: strict)]'
        '--lsprof[print improved command execution profile]'
        '--traceback[print traceback on exception]'
        '--time[time how long the command takes]'
        '--profile[profile]'
        '--version[output version information and exit]'
    )
    
    _hg_pat_opts=(
      '*'{-I+,--include}'[include names matching the given patterns]:dir:_files -W $(_hg_cmd root) -/'
      '*'{-X+,--exclude}'[exclude names matching the given patterns]:dir:_files -W $(_hg_cmd root) -/')
    
    _hg_diff_opts=(
      '(--text -a)'{-a,--text}'[treat all files as text]'
      '(--git -g)'{-g,--git}'[use git extended diff format]'
      "--nodates[don't include dates in diff headers]")
    
    _hg_dryrun_opts=(
      '(--dry-run -n)'{-n,--dry-run}'[do not perform actions, just print output]')
    
    _hg_style_opts=(
      '--style[display using template map file]:'
      '--template[display with template]:')
    
    _hg_commit_opts=(
      '(-m --message -l --logfile --edit -e)'{-e,--edit}'[edit commit message]'
      '(-e --edit -l --logfile --message -m)'{-m+,--message}'[use  as commit message]:message:'
      '(-e --edit -m --message --logfile -l)'{-l+,--logfile}'[read the commit message from ]:log file:_files')
    
    _hg_remote_opts=(
      '(--ssh -e)'{-e+,--ssh}'[specify ssh command to use]:'
      '--remotecmd[specify hg command to run on the remote side]:')
    
    _hg_cmd() {
      _call_program hg hg --config ui.verbose=0 --config defaults."$1"= \
        "$_hg_cmd_globals[@]" "$@" 2> /dev/null
    }
    
    _hg_cmd_add() {
      _arguments -s -w : $_hg_global_opts $_hg_pat_opts $_hg_dryrun_opts \
      '*:unknown files:_hg_unknown'
    }
    
    _hg_cmd_addremove() {
      _arguments -s -w : $_hg_global_opts $_hg_pat_opts $_hg_dryrun_opts \
      '(--similarity -s)'{-s+,--similarity}'[guess renamed files by similarity (0<=s<=100)]:' \
      '*:unknown or missing files:_hg_addremove'
    }
    
    _hg_cmd_annotate() {
      _arguments -s -w : $_hg_global_opts $_hg_pat_opts \
      '(--rev -r)'{-r+,--rev}'[annotate the specified revision]:revision:_hg_tags' \
      '(--follow -f)'{-f,--follow}'[follow file copies and renames]' \
      '(--text -a)'{-a,--text}'[treat all files as text]' \
      '(--user -u)'{-u,--user}'[list the author]' \
      '(--date -d)'{-d,--date}'[list the date]' \
      '(--number -n)'{-n,--number}'[list the revision number (default)]' \
      '(--changeset -c)'{-c,--changeset}'[list the changeset]' \
      '*:files:_hg_files'
    }
    
    _hg_cmd_archive() {
      _arguments -s -w : $_hg_global_opts $_hg_pat_opts \
      '--no-decode[do not pass files through decoders]' \
      '(--prefix -p)'{-p+,--prefix}'[directory prefix for files in archive]:' \
      '(--rev -r)'{-r+,--rev}'[revision to distribute]:revision:_hg_tags' \
      '(--type -t)'{-t+,--type}'[type of distribution to create]:archive type:(files tar tbz2 tgz uzip zip)' \
      '*:destination:_files'
    }
    
    _hg_cmd_backout() {
      _arguments -s -w : $_hg_global_opts $_hg_pat_opts \
        '--merge[merge with old dirstate parent after backout]' \
        '(--date -d)'{-d+,--date}'[record datecode as commit date]:date code:' \
        '--parent[parent to choose when backing out merge]' \
        '(--user -u)'{-u+,--user}'[record user as commiter]:user:' \
        '(--rev -r)'{-r+,--rev}'[revision]:revision:_hg_tags' \
        '(--message -m)'{-m+,--message}'[use  as commit message]:text:' \
        '(--logfile -l)'{-l+,--logfile}'[read commit message from ]:log file:_files -g \*.txt'
    }
    
    _hg_cmd_bisect() {
      _arguments -s -w : $_hg_global_opts \
      '(-)'{-r,--reset}'[reset bisect state]' \
      '(--good -g --bad -b --skip -s --reset -r)'{-g,--good}'[mark changeset good]'::revision:_hg_tags \
      '(--good -g --bad -b --skip -s --reset -r)'{-b,--bad}'[mark changeset bad]'::revision:_hg_tags \
      '(--good -g --bad -b --skip -s --reset -r)'{-s,--skip}'[skip testing changeset]' \
      '(--command -c --noupdate -U)'{-c+,--command}'[use command to check changeset state]':commands:_command_names \
      '(--command -c --noupdate -U)'{-U,--noupdate}'[do not update to target]'
    }
    
    _hg_cmd_branch() {
      _arguments -s -w : $_hg_global_opts \
      '(--force -f)'{-f,--force}'[set branch name even if it shadows an existing branch]' \
      '(--clean -C)'{-C,--clean}'[reset branch name to parent branch name]'
    }
    
    _hg_cmd_branches() {
      _arguments -s -w : $_hg_global_opts \
      '(--active -a)'{-a,--active}'[show only branches that have unmerge heads]'
    }
    
    _hg_cmd_bundle() {
      _arguments -s -w : $_hg_global_opts $_hg_remote_opts \
      '(--force -f)'{-f,--force}'[run even when remote repository is unrelated]' \
      '(2)*--base[a base changeset to specify instead of a destination]:revision:_hg_tags' \
      ':output file:_files' \
      ':destination repository:_files -/'
    }
    
    _hg_cmd_cat() {
      _arguments -s -w : $_hg_global_opts $_hg_pat_opts \
      '(--output -o)'{-o+,--output}'[print output to file with formatted name]:filespec:' \
      '(--rev -r)'{-r+,--rev}'[revision]:revision:_hg_tags' \
      '*:file:_hg_files'
    }
    
    _hg_cmd_clone() {
      _arguments -s -w : $_hg_global_opts $_hg_remote_opts \
      '(--noupdate -U)'{-U,--noupdate}'[do not update the new working directory]' \
      '(--rev -r)'{-r+,--rev}'[a changeset you would like to have after cloning]:' \
      '--uncompressed[use uncompressed transfer (fast over LAN)]' \
      ':source repository:_hg_remote' \
      ':destination:_hg_clone_dest'
    }
    
    _hg_cmd_commit() {
      _arguments -s -w : $_hg_global_opts $_hg_pat_opts \
      '(--addremove -A)'{-A,--addremove}'[mark new/missing files as added/removed before committing]' \
      '(--message -m)'{-m+,--message}'[use  as commit message]:text:' \
      '(--logfile -l)'{-l+,--logfile}'[read commit message from ]:log file:_files -g \*.txt' \
      '(--date -d)'{-d+,--date}'[record datecode as commit date]:date code:' \
      '(--user -u)'{-u+,--user}'[record user as commiter]:user:' \
      '*:file:_hg_files'
    }
    
    _hg_cmd_copy() {
      _arguments -s -w : $_hg_global_opts $_hg_pat_opts $_hg_dryrun_opts \
      '(--after -A)'{-A,--after}'[record a copy that has already occurred]' \
      '(--force -f)'{-f,--force}'[forcibly copy over an existing managed file]' \
      '*:file:_hg_files'
    }
    
    _hg_cmd_diff() {
      typeset -A opt_args
      _arguments -s -w : $_hg_global_opts $_hg_pat_opts $_hg_diff_opts \
      '*'{-r,--rev}'+[revision]:revision:_hg_revrange' \
      '(--show-function -p)'{-p,--show-function}'[show which function each change is in]' \
      '(--ignore-all-space -w)'{-w,--ignore-all-space}'[ignore white space when comparing lines]' \
      '(--ignore-space-change -b)'{-b,--ignore-space-change}'[ignore changes in the amount of white space]' \
      '(--ignore-blank-lines -B)'{-B,--ignore-blank-lines}'[ignore changes whose lines are all blank]' \
      '*:file:->diff_files'
    
      if [[ $state == 'diff_files' ]]
      then
        if [[ -n $opt_args[-r] ]]
        then
          _hg_files
        else
          _hg_modified
        fi
      fi
    }
    
    _hg_cmd_export() {
      _arguments -s -w : $_hg_global_opts $_hg_diff_opts \
      '(--outout -o)'{-o+,--output}'[print output to file with formatted name]:filespec:' \
      '--switch-parent[diff against the second parent]' \
      '*:revision:_hg_tags'
    }
    
    _hg_cmd_grep() {
      _arguments -s -w : $_hg_global_opts $_hg_pat_opts \
      '(--print0 -0)'{-0,--print0}'[end filenames with NUL]' \
      '--all[print all revisions with matches]' \
      '(--follow -f)'{-f,--follow}'[follow changeset or file history]' \
      '(--ignore-case -i)'{-i,--ignore-case}'[ignore case when matching]' \
      '(--files-with-matches -l)'{-l,--files-with-matches}'[print only filenames and revs that match]' \
      '(--line-number -n)'{-n,--line-number}'[print matching line numbers]' \
      '*'{-r+,--rev}'[search in given revision range]:revision:_hg_revrange' \
      '(--user -u)'{-u,--user}'[print user who committed change]' \
      '1:search pattern:' \
      '*:files:_hg_files'
    }
    
    _hg_cmd_heads() {
      _arguments -s -w : $_hg_global_opts $_hg_style_opts \
      '(--rev -r)'{-r+,--rev}'[show only heads which are descendants of rev]:revision:_hg_tags'
    }
    
    _hg_cmd_help() {
      _arguments -s -w : $_hg_global_opts \
      '*:mercurial command:_hg_commands'
    }
    
    _hg_cmd_identify() {
      _arguments -s -w : $_hg_global_opts \
      '(--rev -r)'{-r+,--rev}'[identify the specified rev]:revision:_hg_tags' \
      '(--num -n)'{-n+,--num}'[show local revision number]' \
      '(--id -i)'{-i+,--id}'[show global revision id]' \
      '(--branch -b)'{-b+,--branch}'[show branch]' \
      '(--tags -t)'{-t+,--tags}'[show tags]'
    }
    
    _hg_cmd_import() {
      _arguments -s -w : $_hg_global_opts \
      '(--strip -p)'{-p+,--strip}'[directory strip option for patch (default: 1)]:count:' \
      '(--message -m)'{-m+,--message}'[use  as commit message]:text:' \
      '(--force -f)'{-f,--force}'[skip check for outstanding uncommitted changes]' \
      '*:patch:_files'
    }
    
    _hg_cmd_incoming() {
      _arguments -s -w : $_hg_global_opts $_hg_remote_opts $_hg_style_opts \
      '(--no-merges -M)'{-M,--no-merges}'[do not show merge revisions]' \
      '(--force -f)'{-f,--force}'[run even when the remote repository is unrelated]' \
      '(--patch -p)'{-p,--patch}'[show patch]' \
      '(--rev -r)'{-r+,--rev}'[a specific revision up to which you would like to pull]:revision:_hg_tags' \
      '(--newest-first -n)'{-n,--newest-first}'[show newest record first]' \
      '--bundle[file to store the bundles into]:bundle file:_files' \
      ':source:_hg_remote'
    }
    
    _hg_cmd_init() {
      _arguments -s -w : $_hg_global_opts $_hg_remote_opts \
      ':dir:_files -/'
    }
    
    _hg_cmd_locate() {
      _arguments -s -w : $_hg_global_opts $_hg_pat_opts \
      '(--rev -r)'{-r+,--rev}'[search repository as it stood at revision]:revision:_hg_tags' \
      '(--print0 -0)'{-0,--print0}'[end filenames with NUL, for use with xargs]' \
      '(--fullpath -f)'{-f,--fullpath}'[print complete paths]' \
      '*:search pattern:_hg_files'
    }
    
    _hg_cmd_log() {
      _arguments -s -w : $_hg_global_opts $_hg_pat_opts $_hg_style_opts \
      '(--follow --follow-first -f)'{-f,--follow}'[follow changeset or history]' \
      '(-f --follow)--follow-first[only follow the first parent of merge changesets]' \
      '(--copies -C)'{-C,--copies}'[show copied files]' \
      '(--keyword -k)'{-k+,--keyword}'[search for a keyword]:' \
      '(--limit -l)'{-l+,--limit}'[limit number of changes displayed]:' \
      '*'{-r,--rev}'[show the specified revision or range]:revision:_hg_revrange' \
      '(--no-merges -M)'{-M,--no-merges}'[do not show merges]' \
      '(--only-merges -m)'{-m,--only-merges}'[show only merges]' \
      '(--patch -p)'{-p,--patch}'[show patch]' \
      '(--prune -P)'{-P+,--prune}'[do not display revision or any of its ancestors]:revision:_hg_tags' \
      '*:files:_hg_files'
    }
    
    _hg_cmd_manifest() {
      _arguments -s -w : $_hg_global_opts \
      ':revision:_hg_tags'
    }
    
    _hg_cmd_merge() {
      _arguments -s -w : $_hg_global_opts \
      '(--force -f)'{-f,--force}'[force a merge with outstanding changes]' \
      '(--rev -r 1)'{-r,--rev}'[revision to merge]:revision:_hg_mergerevs' \
      '(--preview -P)'{-P,--preview}'[review revisions to merge (no merge is performed)]' \
      ':revision:_hg_mergerevs'
    }
    
    _hg_cmd_outgoing() {
      _arguments -s -w : $_hg_global_opts $_hg_remote_opts $_hg_style_opts \
      '(--no-merges -M)'{-M,--no-merges}'[do not show merge revisions]' \
      '(--force -f)'{-f,--force}'[run even when the remote repository is unrelated]' \
      '(--patch -p)'{-p,--patch}'[show patch]' \
      '(--rev -r)'{-r+,--rev}'[a specific revision you would like to push]' \
      '(--newest-first -n)'{-n,--newest-first}'[show newest record first]' \
      ':destination:_hg_remote'
    }
    
    _hg_cmd_parents() {
      _arguments -s -w : $_hg_global_opts $_hg_style_opts \
      '(--rev -r)'{-r+,--rev}'[show parents of the specified rev]:revision:_hg_tags' \
      ':last modified file:_hg_files'
    }
    
    _hg_cmd_paths() {
      _arguments -s -w : $_hg_global_opts \
      ':path:_hg_paths'
    }
    
    _hg_cmd_pull() {
      _arguments -s -w : $_hg_global_opts $_hg_remote_opts \
      '(--force -f)'{-f,--force}'[run even when the remote repository is unrelated]' \
      '(--update -u)'{-u,--update}'[update to new tip if changesets were pulled]' \
      '(--rev -r)'{-r+,--rev}'[a specific revision up to which you would like to pull]:revision:' \
      ':source:_hg_remote'
    }
    
    _hg_cmd_push() {
      _arguments -s -w : $_hg_global_opts $_hg_remote_opts \
      '(--force -f)'{-f,--force}'[force push]' \
      '(--rev -r)'{-r+,--rev}'[a specific revision you would like to push]:revision:_hg_tags' \
      ':destination:_hg_remote'
    }
    
    _hg_cmd_remove() {
      _arguments -s -w : $_hg_global_opts $_hg_pat_opts \
      '(--after -A)'{-A,--after}'[record remove that has already occurred]' \
      '(--force -f)'{-f,--force}'[remove file even if modified]' \
      '*:file:_hg_files'
    }
    
    _hg_cmd_rename() {
      _arguments -s -w : $_hg_global_opts $_hg_pat_opts $_hg_dryrun_opts \
      '(--after -A)'{-A,--after}'[record a rename that has already occurred]' \
      '(--force -f)'{-f,--force}'[forcibly copy over an existing managed file]' \
      '*:file:_hg_files'
    }
    
    _hg_cmd_resolve() {
      local context state line
      typeset -A opt_args
    
      _arguments -s -w : $_hg_global_opts \
      '(--list -l --mark -m --unmark -u)'{-l,--list}'[list state of files needing merge]:*:merged files:->resolve_files' \
      '(--mark -m --list -l --unmark -u)'{-m,--mark}'[mark files as resolved]:*:unresolved files:_hg_unresolved' \
      '(--unmark -u --list -l --mark -m)'{-u,--unmark}'[unmark files as resolved]:*:resolved files:_hg_resolved' \
      '*:file:_hg_unresolved'
    
      if [[ $state == 'resolve_files' ]]
      then
        _alternative 'files:resolved files:_hg_resolved' \
          'files:unresolved files:_hg_unresolved'
      fi
    }
    
    _hg_cmd_revert() {
      local context state line
      typeset -A opt_args
    
      _arguments -s -w : $_hg_global_opts $_hg_pat_opts $_hg_dryrun_opts \
      '(--all -a :)'{-a,--all}'[revert all changes when no arguments given]' \
      '(--rev -r)'{-r+,--rev}'[revision to revert to]:revision:_hg_tags' \
      '--no-backup[do not save backup copies of files]' \
      '*:file:->diff_files'
    
      if [[ $state == 'diff_files' ]]
      then
        if [[ -n $opt_args[-r] ]]
        then
          _hg_files
        else
          typeset -a status_files
          _hg_status mard
          _wanted files expl 'modified, added, removed or deleted file' _multi_parts / status_files
        fi
      fi
    }
    
    _hg_cmd_serve() {
      _arguments -s -w : $_hg_global_opts \
      '(--accesslog -A)'{-A+,--accesslog}'[name of access log file]:log file:_files' \
      '(--errorlog -E)'{-E+,--errorlog}'[name of error log file]:log file:_files' \
      '(--daemon -d)'{-d,--daemon}'[run server in background]' \
      '(--port -p)'{-p+,--port}'[listen port]:listen port:' \
      '(--address -a)'{-a+,--address}'[interface address]:interface address:' \
      '(--name -n)'{-n+,--name}'[name to show in web pages]:repository name:' \
      '(--templates -t)'{-t,--templates}'[web template directory]:template dir:_files -/' \
      '--style[web template style]:style' \
      '--stdio[for remote clients]' \
      '(--ipv6 -6)'{-6,--ipv6}'[use IPv6 in addition to IPv4]'
    }
    
    _hg_cmd_showconfig() {
      _arguments -s -w : $_hg_global_opts \
      '(--untrusted -u)'{-u+,--untrusted}'[show untrusted configuration options]' \
      ':config item:_hg_config'
    }
    
    _hg_cmd_status() {
      _arguments -s -w : $_hg_global_opts $_hg_pat_opts \
      '(--all -A)'{-A,--all}'[show status of all files]' \
      '(--modified -m)'{-m,--modified}'[show only modified files]' \
      '(--added -a)'{-a,--added}'[show only added files]' \
      '(--removed -r)'{-r,--removed}'[show only removed files]' \
      '(--deleted -d)'{-d,--deleted}'[show only deleted (but tracked) files]' \
      '(--clean -c)'{-c,--clean}'[show only files without changes]' \
      '(--unknown -u)'{-u,--unknown}'[show only unknown files]' \
      '(--ignored -i)'{-i,--ignored}'[show ignored files]' \
      '(--no-status -n)'{-n,--no-status}'[hide status prefix]' \
      '(--copies -C)'{-C,--copies}'[show source of copied files]' \
      '(--print0 -0)'{-0,--print0}'[end filenames with NUL, for use with xargs]' \
      '--rev[show difference from revision]:revision:_hg_tags' \
      '*:files:_files'
    }
    
    _hg_cmd_tag() {
      _arguments -s -w : $_hg_global_opts \
      '(--local -l)'{-l,--local}'[make the tag local]' \
      '(--message -m)'{-m+,--message}'[message for tag commit log entry]:message:' \
      '(--date -d)'{-d+,--date}'[record datecode as commit date]:date code:' \
      '(--user -u)'{-u+,--user}'[record user as commiter]:user:' \
      '(--rev -r)'{-r+,--rev}'[revision to tag]:revision:_hg_tags' \
      ':tag name:'
    }
    
    _hg_cmd_tip() {
      _arguments -s -w : $_hg_global_opts $_hg_style_opts \
      '(--patch -p)'{-p,--patch}'[show patch]'
    }
    
    _hg_cmd_unbundle() {
      _arguments -s -w : $_hg_global_opts \
      '(--update -u)'{-u,--update}'[update to new tip if changesets were unbundled]' \
      ':files:_files'
    }
    
    _hg_cmd_update() {
      _arguments -s -w : $_hg_global_opts \
      '(--clean -C)'{-C,--clean}'[overwrite locally modified files]' \
      '(--rev -r)'{-r+,--rev}'[revision]:revision:_hg_tags' \
      ':revision:_hg_tags'
    }
    
    # HGK
    _hg_cmd_view() {
      _arguments -s -w : $_hg_global_opts \
      '(--limit -l)'{-l+,--limit}'[limit number of changes displayed]:' \
      ':revision range:_hg_tags'
    }
    
    # MQ
    _hg_qseries() {
      typeset -a patches
      patches=(${(f)"$(_hg_cmd qseries 2> /dev/null)"})
      (( $#patches )) && _describe -t hg-patches 'patches' patches
    }
    
    _hg_qapplied() {
      typeset -a patches
      patches=(${(f)"$(_hg_cmd qapplied 2> /dev/null)"})
      if (( $#patches ))
      then
        patches+=(qbase qtip)
        _describe -t hg-applied-patches 'applied patches' patches
      fi
    }
    
    _hg_qunapplied() {
      typeset -a patches
      patches=(${(f)"$(_hg_cmd qunapplied 2> /dev/null)"})
      (( $#patches )) && _describe -t hg-unapplied-patches 'unapplied patches' patches
    }
    
    # unapplied, including guarded patches
    _hg_qdeletable() {
      typeset -a unapplied
      unapplied=(${(f)"$(_hg_cmd qseries 2> /dev/null)"})
      for p in $(_hg_cmd qapplied)
      do
        unapplied=(${unapplied:#$p})
      done
    
      (( $#unapplied )) && _describe -t hg-allunapplied-patches 'all unapplied patches' unapplied
    }
    
    _hg_qguards() {
      typeset -a guards
      local guard
      compset -P "+|-"
      _hg_cmd qselect -s 2> /dev/null | while read guard
      do
        guards+=(${guard#(+|-)})
      done
      (( $#guards )) && _describe -t hg-guards 'guards' guards
    }
    
    _hg_qseries_opts=(
      '(--summary -s)'{-s,--summary}'[print first line of patch header]')
    
    _hg_cmd_qapplied() {
      _arguments -s -w : $_hg_global_opts $_hg_qseries_opts
    }
    
    _hg_cmd_qdelete() {
      _arguments -s -w : $_hg_global_opts \
      '(--keep -k)'{-k,--keep}'[keep patch file]' \
      '*'{-r+,--rev}'[stop managing a revision]:applied patch:_hg_revrange' \
      '*:unapplied patch:_hg_qdeletable'
    }
    
    _hg_cmd_qdiff() {
      _arguments -s -w : $_hg_global_opts $_hg_pat_opts \
      '*:pattern:_hg_files'
    }
    
    _hg_cmd_qfold() {
      _arguments -s -w : $_hg_global_opts $_h_commit_opts \
      '(--keep,-k)'{-k,--keep}'[keep folded patch files]' \
      '*:unapplied patch:_hg_qunapplied'
    }
    
    _hg_cmd_qgoto() {
      _arguments -s -w : $_hg_global_opts \
      '(--force -f)'{-f,--force}'[overwrite any local changes]' \
      ':patch:_hg_qseries'
    }
    
    _hg_cmd_qguard() {
      _arguments -s -w : $_hg_global_opts \
      '(--list -l)'{-l,--list}'[list all patches and guards]' \
      '(--none -n)'{-n,--none}'[drop all guards]' \
      ':patch:_hg_qseries' \
      '*:guards:_hg_qguards'
    }
    
    _hg_cmd_qheader() {
      _arguments -s -w : $_hg_global_opts \
      ':patch:_hg_qseries'
    }
    
    _hg_cmd_qimport() {
      _arguments -s -w : $_hg_global_opts \
      '(--existing -e)'{-e,--existing}'[import file in patch dir]' \
      '(--name -n 2)'{-n+,--name}'[patch file name]:name:' \
      '(--force -f)'{-f,--force}'[overwrite existing files]' \
      '*'{-r+,--rev}'[place existing revisions under mq control]:revision:_hg_revrange' \
      '*:patch:_files'
    }
    
    _hg_cmd_qnew() {
      _arguments -s -w : $_hg_global_opts $_hg_commit_opts \
      '(--force -f)'{-f,--force}'[import uncommitted changes into patch]' \
      ':patch:'
    }
    
    _hg_cmd_qnext() {
      _arguments -s -w : $_hg_global_opts $_hg_qseries_opts
    }
    
    _hg_cmd_qpop() {
      _arguments -s -w : $_hg_global_opts \
      '(--all -a :)'{-a,--all}'[pop all patches]' \
      '(--name -n)'{-n+,--name}'[queue name to pop]:' \
      '(--force -f)'{-f,--force}'[forget any local changes]' \
      ':patch:_hg_qapplied'
    }
    
    _hg_cmd_qprev() {
      _arguments -s -w : $_hg_global_opts $_hg_qseries_opts
    }
    
    _hg_cmd_qpush() {
      _arguments -s -w : $_hg_global_opts \
      '(--all -a :)'{-a,--all}'[apply all patches]' \
      '(--list -l)'{-l,--list}'[list patch name in commit text]' \
      '(--merge -m)'{-m+,--merge}'[merge from another queue]:' \
      '(--name -n)'{-n+,--name}'[merge queue name]:' \
      '(--force -f)'{-f,--force}'[apply if the patch has rejects]' \
      ':patch:_hg_qunapplied'
    }
    
    _hg_cmd_qrefresh() {
      _arguments -s -w : $_hg_global_opts $_hg_pat_opts $_hg_commit_opts \
      '(--git -g)'{-g,--git}'[use git extended diff format]' \
      '(--short -s)'{-s,--short}'[short refresh]' \
      '*:files:_hg_files'
    }
    
    _hg_cmd_qrename() {
      _arguments -s -w : $_hg_global_opts \
      ':patch:_hg_qseries' \
      ':destination:'
    }
    
    _hg_cmd_qselect() {
      _arguments -s -w : $_hg_global_opts \
      '(--none -n :)'{-n,--none}'[disable all guards]' \
      '(--series -s :)'{-s,--series}'[list all guards in series file]' \
      '--pop[pop to before first guarded applied patch]' \
      '--reapply[pop and reapply patches]' \
      '*:guards:_hg_qguards'
    }
    
    _hg_cmd_qseries() {
      _arguments -s -w : $_hg_global_opts $_hg_qseries_opts \
      '(--missing -m)'{-m,--missing}'[print patches not in series]'
    }
    
    _hg_cmd_qunapplied() {
      _arguments -s -w : $_hg_global_opts $_hg_qseries_opts
    }
    
    _hg_cmd_qtop() {
      _arguments -s -w : $_hg_global_opts $_hg_qseries_opts
    }
    
    _hg_cmd_strip() {
      _arguments -s -w : $_hg_global_opts \
      '(--force -f)'{-f,--force}'[force multi-head removal]' \
      '(--backup -b)'{-b,--backup}'[bundle unrelated changesets]' \
      '(--nobackup -n)'{-n,--nobackup}'[no backups]' \
      ':revision:_hg_tags'
    }
    
    _hg "$@"
    PK[GLfunctions/_diff_optionsnuW+A#autoload
    
    local of ofwuc ouc oss ofwy ofwg ofwl cmd
    local -a args
    
    cmd="$1"
    shift
    
    if _pick_variant -c $cmd gnu=GNU unix -v; then
      # output formats
      of="-y --side-by-side -n --rcs -e -f --ed -q --brief -c -C --context -u -U \
      --unified --old-group-format --new-group-format --changed-group-format \
      --unchanged-group-format --line-format --old-line-format --new-line-format \
      --unchanged-line-format --normal -D --ifdef"
    
      # output formats w/o unified and context
      ofwuc="-y --side-by-side -n --rcs -e -f --ed -q --brief --old-group-format \
      --new-group-format --changed-group-format --unchanged-group-format --normal \
      --line-format --old-line-format --new-line-format --unchanged-line-format \
      -D --ifdef"
    
      # option specific to unified or context diff
      ouc='-L --label -p --show-c-function -F --show-function-line'
    
      # option specific to side by side
      oss='-W --width --left-column --suppress-common-lines'
    
      # output formats w/o side by side
      ofwy="-n --rcs -e -f --ed -q --brief -c -C --context -u -U --unified \
      --old-group-format --new-group-format --changed-group-format \
      --unchanged-group-format --line-format --old-line-format \
      --new-line-format --unchanged-line-format --normal -D --ifdef"
    
      # output formats w/o group format
      ofwg="-n --rcs -e -f --ed -q --brief -c -C --context -u -U --unified --normal \
      --line-format --old-line-format --new-line-format --unchanged-line-format
      -D --ifdef"
    
      # output formats w/o line format
      ofwl="-n --rcs -e -f --ed -q --brief -c -C --context -u -U --unified \
      --old-group-format --new-group-format --changed-group-format --normal \
      --unchanged-group-format"
    
      _arguments -s \
        '(-i --ignore-case)'{-i,--ignore-case}'[case insensitive]' \
        '(--no-ignore-file-name-case)--ignore-file-name-case[ignore case when comparing file names]' \
        '(--ignore-file-name-case)--no-ignore-file-name-case[consider case when comparing file names]' \
        '(-E --ignore-tab-expansion)'{-E,--ignore-tab-expansion}'[ignore changes due to tab expansion]' \
        '(-b --ignore-space-change)'{-b,--ignore-space-change}'[ignore changes in the amount of white space]' \
        '(--ignore-all-space -w)'{--ignore-all-space,-w}'[ignore all white space]' \
        '(-B --ignore-blank-lines)'{-B,--ignore-blank-lines}'[ignore lines that are all blank]' \
        '(-I --ignore-matching-lines)'{-I+,--ignore-matching-lines=}'[ignore lines that match regex]:line exclusion regex:' \
        '--strip-trailing-cr[strip trailing carriage return on input]' \
        '(-a --text)'{-a,--text}'[treat all files as text]' \
        "($of $oss)"{-C+,--context=-}'[output a context diff]:number of lines of copied context' \
        "($of $oss)-c[output a context diff]" \
        "($of $oss)"{-U+,--unified=-}'[output a unified diff]:number of lines of unified context' \
        "($of $oss)-u[output a unified diff]" \
        "($ofwuc $oss)*"{-L+,--label=}'[set label to use instead of file name]:label' \
        "($ofwuc $oss -p --show-c-function)"{-p,--show-c-function}'[show C function of each change]' \
        "($ofwuc $oss -F --show-function-line)"{-F+,--show-function-line=}'[show the most recent line matching regex]:regex' \
        "($of $ouc $oss)--brief[output only whether files differ]" \
        "($of $ouc $oss)-q[output only whether files differ]" \
        "($of $ouc $oss -e --ed)"{--ed,-e}'[output an ed script]' \
        "($of $ouc $oss)--normal[output a normal diff]" \
        "($of $ouc $oss)--forward-ed[output a reversed ed script]" \
        "($of $ouc $oss)-f[output a reversed ed script]" \
        "($of $ouc $oss)--rcs[RCS format diff]" \
        "($of $ouc $oss)-n[RCS format diff]" \
        "($of $ouc)--side-by-side[output in two columns]" \
        "($of $ouc)-y[output in two columns]" \
        "($ofwy $ouc --width -W)"{--width=,-W+}'[set size of line]:number of characters per line' \
        "($ofwy $ouc)--left-column[output only left column of common lines]" \
        "($ofwy $ouc)--suppress-common-lines[do not output common lines]" \
        "($of $oss)"{-D,--ifdef=}'[output merged file with preprocessor directives]:preprocessor symbol' \
        "($ofwg $ouc $oss)--old-group-format=[set old group format]:old group format" \
        "($ofwg $ouc $oss)--new-group-format=[set new group format]:new group format" \
        "($ofwg $ouc $oss)--changed-group-format=[set changed group format]:changed group format" \
        "($ofwg $ouc $oss)--unchanged-group-format=[set unchanged group format]:unchanged group format" \
        "($ofwl $ouc $oss)--line-format=[set line format]:line format" \
        "($ofwl $ouc $oss)--old-line-format=[set old line format]:old line format" \
        "($ofwl $ouc $oss)--new-line-format=[set new line format]:new line format" \
        "($ofwl $ouc $oss)--unchanged-line-format=[set unchanged line format]:unchanged line format" \
        '(-l --paginate)'{-l,--paginate}'[output through pr]' \
        '(-t --expand-tabs)'{-t,--expand-tabs}'[expand tabs to spaces]' \
        '(-T --initial-tab)'{-T,--initial-tab}'[prepend a tab]' \
        '--tabsize=[specify width of tab]:width' \
        '(-r --recursive)'{-r,--recursive}'[recursively compare subdirectories]' \
        '(-N --new-file)'{-N,--new-file}'[treat absent files as empty]' \
        '(-P --unidirectional-new-file)'{-P,--unidirectional-new-file}'[treat absent first files as empty]' \
        '(-s --report-identical-files)'{-s,--report-identical-files}'[report when two files are the same]' \
        \*{-x+,--exclude=}'[exclude files matching pattern]:exclusion pattern' \
        '(-X --exclude-from)'{-X+,--exclude-from=}'[exclude files matching pattern in file]:exclude file:_files' \
        '(-S --starting-file)'{-S+,--starting-file=}'[set first file in comparison]:start with file:_files' \
        '(--to-file)--from-file=[compare specified file to all operands]:from file:_files' \
        '(--from-file)--to-file=[compare all operands to specified file]:to file:_files' \
        '--horizon-lines=[set number of lines to keep in prefix and suffix]:number of horizon lines' \
        '(-d --minimal)'{-d,--minimal}'[try to find a smaller set of changes]' \
        '(-H --speed-large-files)'{-H,--speed-large-files}'[assume large files and many small changes]' \
        '(-v --version)'{-v,--version}'[display version info]' \
        '--help[display help info]' \
        "$@"
    else
      case $OSTYPE in
        solaris2.<9->)
          args=( '(-c -e -f -C)-u[output a unified diff]' )
        ;&
        solaris*)
          args+=(
    	'-i[case insensitive]'
            '-t[expand tabs to spaces]'
    	'-w[ignore all white space]'
            '(-c -e -f -n -u -h -D)-C+[output a context diff]:number of lines of copied context'
    	'(-c -e -f -n -u -C -D)-h[do a fast, half-hearted job]'
    	'(-c -e -f -u -h -C -D)-n[reversed ed script]'
    	'(-c -e -f -n -u -h -C)-D[output merged file with preprocessor directives]:preprocessor symbol'
            '-l[output through pr]'
    	'-s[report on identical files]'
            '-S+[set first file in comparison]:start with file:_files'
          )
        ;;
      esac
      
      _arguments "$args[@]" \
        "(-e -f -u -n)-c[output a context diff]" \
        "(-c -f -u -n)-e[output an ed script]" \
        "(-c -e -u -n)-f[output a reversed ed script]" \
        '-b[skip trailing white spaces]' \
        '-r[recursively compare subdirectories]' \
        "$@"
    fi
    PK[u-functions/_patchnuW+A#compdef patch
    
    if (( ! $+_patch_args )); then
      local help="$(LC_ALL=C patch --help 2>&1)"
      local -A optionmap
      local arg
      local comp_p='compadd "$expl[@]" -S0 -r "1-9" - ""'
    
      [[ "$help" = *--[^h]* || "$help" = *\[-c\|-e\|-n\]* ]] && arg=+
    
      optionmap=(
        '*\[-p\[strip-count\]\]*' '(--strip)-p-[number of path prefix components to strip]:number of path prefix components to strip:'"{$comp_p}"
        '*( -p NUM[, ]|\[-p num\])*' '(--strip)-p+[number of path prefix components to strip]:number of path prefix components to strip:'"{$comp_p}"
        '*\[--strip\[=strip-count\]\]*' '(-p)--strip=-[number of path prefix components to strip]:number of path prefix components to strip:'"{$comp_p}"
        '* --strip=NUM[, ]*' '(-p)--strip=[number of path prefix components to strip]:number of path prefix components to strip:'"{$comp_p}"
    
        '*\[-Fmax-fuzz\]*' '(--fuzz)-F-[specify the maximum fuzz factor]:maximum fuzz factor:'
        '*(\[-F max-fuzz\]| -F LINES[, ])*' '(--fuzz)-F+[specify the maximum fuzz factor]:maximum fuzz factor:'
        '*(\[--fuzz=max-fuzz\]| --fuzz( |=)LINES[, ])*' '(-F)--fuzz=[specify the maximum fuzz factor]:maximum fuzz factor:'
    
        '*(\[-[a-zA-Z]#l[a-zA-Z]#\]| -l[, ])*' '(--ignore-whitespace)-l[ignore white space changes]'
        '*(\[--ignore-whitespace\]| --ignore-whitespace[, ])*' '(-l)--ignore-whitespace[ignore white space changes]'
    
        '*(\[-[a-zA-Z]#c[a-zA-Z]#\]| -c[, ]|\[-c\|)*' '(   -e -n -u --context --ed --normal --unified)-c[interpret context diff]'
        '*(\[-[a-zA-Z]#e[a-zA-Z]#\]| -e[, ]|\|-e\|)*' '(-c    -n -u --context --ed --normal --unified)-e[interpret ed script]'
        '*(\[-[a-zA-Z]#n[a-zA-Z]#\]| -n[, ]|\|-n\])*' '(-c -e    -u --context --ed --normal --unified)-n[interpret normal diff]'
        '*(\[-[a-zA-Z]#u[a-zA-Z]#\]| -u[, ])*'        '(-c -e -n    --context --ed --normal --unified)-u[interpret unified diff]'
        '*(\[--context\]| --context[, ])*'            '(-c -e -n -u           --ed --normal --unified)--context[interpret context diff]'
        '*(\[--ed\]| --ed[, ])*'                      '(-c -e -n -u --context      --normal --unified)--ed[interpret ed script]'
        '*(\[--normal\]| --normal[, ])*'              '(-c -e -n -u --context --ed          --unified)--normal[interpret normal diff]'
        '*(\[--unified\]| --unified[, ])*'            '(-c -e -n -u --context --ed --normal          )--unified[interpret unified diff]'
    
        '*(\[-[a-zA-Z]#N[a-zA-Z]#\]| -N[, ])*' '(--forward)-N[ignore reverse patches]'
        '*(\[--forward\]| --forward[, ])*' '(-N)--forward[ignore reverse patches]'
        '*(\[-[a-zA-Z]#R[a-zA-Z]#\]| -R[, ])*' '(--reverse)-R[reverse mode]'
        '*(\[--reverse\]| --reverse[, ])*' '(-R)--reverse[reverse mode]'
    
        '*(\[-i patchfile\]| -i PATCHFILE[, ])*' '(--input)-i+[patch file]:patch file:_files'
        '* --input=PATCHFILE[, ]*' '(-i)--input=[patch file]:patch file:_files'
    
        '*(\[-o out-file\]| -o FILE[, ]|\[-o outfile\])*' "(--output)-o${arg}[output file]:output file:_files"
        '*(\[--output=out-file\]| --output=FILE[, ])*' '(-o)--output=[output file]:output file:_files'
        '*(\[-r rej-name\]| -r FILE[, ]|\[-r rejectfile\])*' "(--reject-file)-r${arg}[reject file]:reject file:_files"
        '*(\[--reject-file=rej-name\]| --reject-file=FILE[, ])*' '(-r)--reject-file=[reject file]:reject file:_files'
    
        '*(\[-D symbol\]| -D NAME[, ]|\[-D define\])*' '(--ifdef)-D+[cpp symbol]:symbol:'
        '*(\[--ifdef=symbol\]| --ifdef=NAME[, ])*' '(-D)--ifdef=[cpp symbol]:symbol:'
    
        '*(\[-[a-zA-Z]#E[a-zA-Z]#\]| -E[, ])*' '(--remove-empty-files)-E[remove empty files]'
        '*(\[--remove-empty-files\]| --remove-empty-files[, ])*' '(-E)--remove-empty-files[remove empty files]'
    
        '* -Z[, ]*'         '(   -T --set-utc --set-time)-Z[assume timestamp as UTC]'
        '* -T[, ]*'         '(-Z    --set-utc --set-time)-T[assume timestamp as local time]'
        '* --set-utc[, ]*'  '(-Z -T           --set-time)--set-utc[assume timestamp as UTC]'
        '* --set-time[, ]*' '(-Z -T --set-utc           )--set-time[assume timestamp as local time]'
    
        '* --quoting-style=WORD[, ]*' '--quoting-style=[quoting style]:quoting style:(literal shell shell-always c escape)'
    
        '*(\[-[a-zA-Z]#b[a-zA-Z]#\]| -b[, ])*' '(--backup)-b[backup original]'
        '* --backup[, ]*' '(-b)--backup[backup original]'
        '* --backup-if-mismatch[, ]*' '(--no-backup-if-mismatch)--backup-if-mismatch[back up if not match exactly]'
        '* --no-backup-if-mismatch[, ]*' '(--backup-if-mismatch)--no-backup-if-mismatch[back up only if otherwise requested]'
    
        '*(\[-V {numbered,existing,simple}\]| -V STYLE[, ])*' "(--version-control)-V${arg}[backup method]:backup method:(numbered existing simple)"
        '*(\[--version-control={numbered,existing,simple}\]| --version-control=STYLE[, ])*' '(-V)--version-control=[backup method]:backup method:(numbered existing simple)'
    
        '*(\[-B backup-prefix\]| -B PREFIX[, ])*' "(--prefix)-B${arg}[specify backup prefix]:backup prefix:"
        '*(\[--prefix=backup-prefix\]| --prefix=PREFIX[, ])*' '(-B)--prefix=[specify backup prefix]:backup prefix:'
        '* -Y PREFIX[, ]*' '(--basename-prefix)-Y+[specify backup basename prefix]:backup basename prefix:'
        '* --basename-prefix=PREFIX[, ]*' '(-Y)--basename-prefix=[specify backup basename prefix]:backup basename prefix:'
        '*\[-b backup-ext\]*'                              "(   -z --suffix)-b${arg}[specify backup suffix]:backup suffix:(.bak)"
        '* -z SUFFIX[, ]*'                                 '(-b    --suffix)-z+[specify backup suffix]:backup suffix:(.bak)'
        '*(\[--suffix=backup-ext\]| --suffix=SUFFIX[, ])*' '(-b -z         )--suffix=[specify backup suffix]:backup suffix:(.bak)'
    
        '* -g NUM[, ]*' '(--get)-g+[get from RCS etc.]:number:((1\:get -1\:ask))'
        '* --get=NUM[, ]*' '(-g)--get=[get from RCS etc.]:number:((1\:get -1\:ask))'
    
        '* -g  --get *' '(-G --get --no-get)-g[get from RCS or SCCS]
    (-g -G --no-get)--get[get from RCS or SCCS]'
        '* -G  --no-get *' '(-g --get --no-get)-G[don'\''t get from RCS or SCCS]
    (-g -G --get)--no-get[don'\''t get from RCS or SCCS]'
    
        '*(\[-[a-zA-Z]#f[a-zA-Z]#\]| -f[, ])*' '(   -t --force --batch)-f[force mode]'
        '*(\[-[a-zA-Z]#t[a-zA-Z]#\]| -t[, ])*' '(-f    --force --batch)-t[batch mode]'
        '*(\[--force\]| --force[, ])*'         '(-f -t         --batch)--force[force mode]'
        '*(\[--batch\]| --batch[, ])*'         '(-f -t --force        )--batch[batch mode]'
    
        '*(\[-[a-zA-Z]#s[a-zA-Z]#\]| -s[, ])*' '(   --quiet --silent)-s[silent mode]'
        '*(\[--quiet\]| --quiet[, ])*'         '(-s         --silent)--quiet[silent mode]'
        '*(\[--silent\]|--silent[, ])*'        '(-s --quiet         )--silent[silent mode]'
    
        '* --verbose[, ]*' '--verbose[verbose mode]'
        '* --dry-run[, ]*' '--dry-run[don'\''t actually change files]'
        '* --posix[, ]*' '--posix[POSIX mode]'
    
        '*(\[-d directory\]| -d DIR[, ]|\[-d dir\])*' '(--directory)-d+[change the working directory]:chdir to:_files -/'
        '*(\[--directory=directory\]| --directory=DIR[, ])*' '(-d)--directory=[change the working directory]:chdir to:_files -/'
    
        '* --binary[, ]*' '--binary[binary mode]'
    
        '*(\[-[a-zA-Z]#v[a-zA-Z]#\]| -v[, ])*' '(--version)-v[print version]'
        '*(\[--version\]| --version[, ])*' '(-v)--version[print version]'
        '* --help[, ]*' '--help[print help message]'
    
        '*\[-[a-zA-Z]#S[a-zA-Z]#\]*' '*-S[ignore this patch]'
        '*\[--skip\]*' '*--skip[ignore this patch]'
    
        '*(\[-[a-zA-Z]#C[a-zA-Z]#\])*' '(--check)-C[check only]'
        '*\[--check\]*' '(-C)--check[check only]'
    
        '*\[--index-first\]*' '--index-first[take Index: line precedence]'
    
        '* --use-index-line *' '--use-index-line[deal with Index: line]'
        '* --patch-root=DIR *' '--patch-root=[restrict paths]:patch root:_files -/'
    
        '* -U *' '(--unified-reject-files)-U[create unified reject files]'
        '* --unified-reject-files *' '(-U)--unified-reject-files[create unified reject files]'
        '* --global-reject-file=file *' '--global-reject-file=[put all rejects into one file]:file:_files'
      )
      _patch_args=(
        ${arg:+"-s"}
        ${(fF)optionmap[(K)"$help"]}
      )
    fi
    
    _arguments "${(@)_patch_args}" ':original file:_files' ':patch file:_files'
    PK[k-11functions/_neditnuW+A#compdef nedit nedit-nc=nc ncl=nc
    
    local state line expl nedit_common curcontext="$curcontext" ret=1
    typeset -A opt_args
    
    nedit_common=(
      '-read[open file read only]'
      "-create[create file if it doesn't already exist]"
      '-line[go to specified line number]:line number'
      '-do[execute macro or action commands]:macro command'
      '-lm[specify language mode]:language mode:->lang'
      '-svrname[name the server]:nedit server name'
      '(-noiconic -icon -iconic)'{-icon,-iconic}'[set initial window state to iconic]'
      '*-tabbed[open all subsequent files in new tabs]'
      '*-untabbed[open all subsequent files in new windows]'
      '*-group[open all subsequent files as tabs in a new window]'
      '(- *)'{-V,-version}'[display version information]'
      '*-xrm:resource:_x_resource'
      '*:file:_files'
    )
    
    if [[ $service = nc ]]; then
      _x_arguments -C -S \
        '(-noask)-ask[prompt if no server found]' \
        '(-ask)-noask[start a new server without asking if none found]' \
        "-wait[don't return to the shell until all files given are closed]" \
        '-timeout[timeout period when talking to server]:timeout (seconds)' \
        '-svrcmd[command to run server]:server command:_command_names -e' \
        "$nedit_common[@]" && ret=0
    else
      _x_arguments -C -S \
        '-server[designate this session as an nedit server]' \
        '-tags[load ctags file]:tags file:_files' \
        '-tabs[specify tab width in characters]:tab width' \
        '(-nowrap -autowrap -noautowrap)-wrap[use continuous wrap mode]' \
        '(-wrap -autowrap -noautowrap)-nowrap[turn off continuous wrap mode]' \
        '(-wrap -nowrap -noautowrap)-autowrap[use auto-newline wrap mode]' \
        '(-wrap -nowrap -autowrap)-noautowrap[turn off auto-newline wrap mode]' \
        '(-noautoindent)-autoindent[maintain a running indent]' \
        '(-autoindent)-noautoindent[turn off autoindent]' \
        '(-noautosave)-autosave[maintain a backup copy of file being edited]' \
        "(-autosave)-noautosave[don't maintain a backup copy of file being edited]" \
        "(-iconic)-noiconic[don't set initial window state to iconic]" \
        '-rows[specify default height in characters for an editing window]:height' \
        '-columns[specify default width in characters for an editing window]:width' \
        '-font[specify font for text window]:font:_x_font' \
        '(-bg)-background:background color:_x_color' \
        '(-background)-bg[specify background color]:background color:_x_color' \
        '(-fg)-foreground:foreground color:_x_color' \
        '(-foreground)-fg[specify foreground color]:foreground color:_x_color' \
        '*-import[load additional preferences file]:nedit preferences file:_files' \
        "$nedit_common[@]" && ret=0
    fi
    
    [[ $state = lang && -f ~/.nedit ]] &&
        _wanted neditlanguages expl 'language mode' \
            compadd -  ${(f)"$(sed -n \
                '/^nedit.languageMode/,/^nedit/ s/.*	\([^:]*\).*/\1/p' < ~/.nedit)"} && ret=0
    
    return ret
    PK[^yGGfunctions/_irssinuW+A#compdef irssi
    
    local expl
    
    _irssi_servers() {
      local a
      a=( $(grep "\(^[{ 	]*address\)\|\([{ 	]address\)[ 	]*=" ~/.irssi/config | sed -e "s,^.*address *= *\"\([^\"]\+\).*,\1 ,g") )
      _wanted irc-servers expl 'irc server' compadd "$@" -a - a
    }
    
    _irssi_ports() {
      local a
      a=( $(grep "\(^[{ 	]*port\)\|\([{ 	]port\)[ 	]*=" ~/.irssi/config | sed -e "s,^.*port *= *\"\([^\"]\+\).*,\1,g") )
      _wanted ports expl 'port' compadd "$@" -a - a
    }
    
    _irssi_nick() {
      local a
      a=( $(grep "\(^[{ 	]*nick\)\|\([{ 	]nick\)\|\([{ 	]alternate_nick\)\|\(^[{ 	]*alternate_nick\)[ 	]*=" ~/.irssi/config | sed -e "s,^.*nick *= *\"\([^\"]\+\).*,\1,g") )
      _wanted nicknames expl 'nick' compadd "$@" -a - a
    }
    
    _arguments -s \
      '--config=[config file]:config:_files' \
      '--home=[home dir location]:home:_dir_list' \
      '(-c --connect)'{-c,--connect=}'[connect to servers]:irc server:_irssi_servers' \
      '(-w --password)'{-w,--password=}'[password]:password' \
      '(-p --port)'{-p,--port=}'[specify a port]:port:_irssi_ports' \
      '-![disable autoconnect]' \
      '--noconnect[disable autoconnect]' \
      '(-n --nick)'{-n,--nick=}'[set nick name]:nick:_irssi_nick' \
      '(-h --hostname)'{-h,--hostname=}'[specify hostname]:hostname:_hosts' \
      '(-)'{-v,--version}'[display version information]' \
      '(-)'{-\?,--help}'[display help information]' \
      '(-)--usage[display usage]'
    
    PK[z	%%functions/_gcorenuW+A#compdef gcore
    
    _gcore() {
    	local -a content
    
    	content=(
    		"anon[anonymous private mappings]"
    		"ctf[CTF type information]"
    		"data[writable private file mappings]"
    		"dism[DISM mappings]"
    		"heap[process heap]"
    		"ism[ISM mappings]"
    		"rodata[read-only private file mappings]"
    		"shanon[anonymous shared mappings]"
    		"shfile[file-backed shared mappings]"
    		"shm[System V shared memory]"
    		"stack[process stack]"
    		"symtab[symbol table sections for loaded files]"
    		"text[readable and executable private file mappings]"
    	)
    
    	_arguments -s \
    		'-p[use per-process core file repository]' \
    		'-g[use global core file repository]' \
    		'-F[force grabbing the target process]' \
    		'-c[set core file content]:_values -s + "content" $content' \
    		'-o[set core file base name]:' \
    		'*:pids:_pids'
    }
    
    _gcore "$@"
    PK[T<functions/_elmnuW+A#compdef elm
    
    _arguments -s \
      '::recipient:_email_addresses' \
      '-a[use the arrow pointer regardless]' \
      '-A+[attach file]:file attachment:_files' \
      '-c[check the given aliases only]:*:alias' \
      '-d+[set debug level]:debug level' \
      '-f+[specify mailbox to load]:mailbox: _mailboxes' \
      '-h[display help]' \
      '-i+[specify file to include in message]:include file:_files' \
      '-m[turn off menu, using more of the screen]' \
      '-s+[specify a subject]:subject:' \
      "-t[don't use termcap/terminfo ti/te entries]" \
      '-V[enable sendmail voyeur mode]' \
      '-v[display elm version]' \
      '-w[write .elm/elmrc]' \
      '-z[start only if new messages]'
    PK[,̱
    functions/_sunuW+A#compdef su
    
    local -A opt_args
    local -a args state context
    local shell=${words[(i)(-s|--shell=*)]} first='1:user name:_users'
    local usr=root line
    
    if _pick_variant gnu="Free Software Foundation" unix --version; then
      args=(
        '(--command)-c[pass command to shell]:command string:->command'
        '(-c)--command=-[pass command to shell]:command string:->command'
        '-f[pass -f to shell (csh)]'
        '(--login)-l[use a login shell]'
        '(-l)--login[use a login shell]'
        '(-p --preserve-environment)-m[do not reset environment]'
        '(-m --preserve-environment)-p[do not reset environment]'
        '(-m -p)--preserve-environment[do not reset environment]'
        '(--shell)-s[run the specified shell]:shell:->shell'
        '(-s)--shell=-[run the specified shell]:shell:->shell'
      )
    else
      args=(
        '-c[pass command to shell]:command string:->command'
        '-l[use a login shell]'
        '-s[run the specified shell]:shell:->shell'
      )
    fi
    
    if [[ $#words -ge 2 && $words[2] != -* && CURRENT -ne 2 ]]; then
        usr=$words[2]
        first=
    fi
    
    [[ $words[shell] == -s ]] && ((shell++))
    
    if [[ CURRENT -ne shell && -n ${words[shell]} ]]; then
        shell=${words[shell]#*=}
    else
        shell="${${(M@)${(@f)$(rest" && return
    
    case $state in
        (command)
            compset -q
            _normal
            return
            ;;
        (shell)
            compadd ${(f)^"$( 1 ))
      then
        setopt localoptions noshwordsplit noksharrays
        # When editing a multiline buffer, it's unlikely prediction is wanted;
        # or if the last widget was e.g. a motion, then probably the intent is
        # to actually edit the line, not change the search prefix.
        if [[ $LBUFFER = *$'\012'* ||
    	  $LASTWIDGET != (self-insert|magic-space|backward-delete-char) ]]
        then
          zstyle -t ":predict" toggle && predict-off
          LBUFFER="$LBUFFER[1,-2]"
        else
          ((--CURSOR))
          zle .history-beginning-search-forward || RBUFFER=""
          return 0
        fi
      else
        zle .kill-whole-line
      fi
    }
    delete-no-predict() {
      [[ $WIDGET != delete-char-or-list || -n $RBUFFER ]] && predict-off
      zle .$WIDGET "$@"
    }
    
    # This is a helper function for autocompletion to prevent long lists
    # of matches from forcing a "do you wish to see all ...?" prompt.
    
    predict-limit-list() {
      if (( compstate[list_lines]+BUFFERLINES > LINES ||
    	( compstate[list_max] != 0 &&
    	    compstate[nmatches] > compstate[list_max] ) ))
      then
        compstate[list]=''
      elif zstyle -t ":predict" list always
      then
        compstate[list]='force list'
      fi
    }
    
    # Handle zsh autoloading conventions
    
    [[ -o kshautoload ]] || predict-on "$@"
    PK[.""functions/_quiltnuW+A#compdef quilt
    
    _arguments \
      '--trace' \
      '--quiltrc:config file:_files' \
      '--version' \
      ':quilt command:(add files import previous setup annotate fold mail push
        snapshot applied fork new refresh top delete graph next remove unapplied
        diff grep patches rename upgrade edit header pop series)' \
      '*::subcmd:->subcmd' && return 0
    
    case "$state" in
        (subcmd)
    
      case "$words[1]" in
          (applied|delete|files|graph|header|next|previous|refresh|unapplied)
          	_wanted -V 'patches' expl 'patch' compadd ${(f)"$(quilt series)"}
    	;;
          (push)
        	_wanted -V 'unapplied patches' expl 'patch' compadd ${(f)"$(quilt unapplied)"}
        	;;
          (pop)
        	_wanted -V 'applied patches' expl 'patch' compadd ${(f)"$(quilt applied)"}
        	;;
          (*)
        	_files
        	;;
      esac
      ;;
    esac
    PK[uDfunctions/tcp_outputnuW+Aemulate -L zsh
    setopt extendedglob
    
    local opt tprompt sess read_fd tpat quiet cursess
    
    while getopts "F:P:qS:" opt; do
      case $opt in
        (F) read_fd=$OPTARG
    	;;
        (P) tprompt=$OPTARG
    	;;
        (q) quiet=1
    	;;
        (S) sess=$OPTARG
    	;;
        (*) [[ $opt != \? ]] && print -r "Can't handle option $opt" >&2
    	return 1
    	;;
      esac
    done
    (( OPTIND > 1 )) && shift $(( OPTIND - 1 ))
    
    # Per-session logs don't have the session discriminator in front.
    if [[ -n $TCP_LOG_SESS ]]; then
      print -r -- "$*" >>${TCP_LOG_SESS}.$sess
    fi
    # Always add the TCP prompt.  We used only to do this with
    # multiple sessions, but it seems always to be useful to know
    # where data is coming from; also, it allows more predictable
    # behaviour in tcp_expect.
    if [[ -n $tprompt ]]; then
      if [[ $sess = $TCP_SESS ]]; then
          cursess="c:1"
      else
          cursess="c:0"
      fi
      zformat -f REPLY $tprompt "s:$sess" "f:$read_fd" $cursess
      # We will pass this back up.
      REPLY="$REPLY$*"
    else
      REPLY="$*"
    fi
    if [[ -n $TCP_LOG ]]; then
      print -r -- $REPLY >>${TCP_LOG}
    fi
    
    if [[ -z $quiet ]]; then
      local skip=
      if [[ ${#tcp_filter} -ne 0 ]]; then
        # Allow tcp_filter to be an associative array, though
        # it doesn't *need* to be.
        for tpat in ${(v)tcp_filter}; do
          [[ $REPLY = ${~tpat} ]] && skip=1 && break
        done
      fi
      if [[ -z $skip ]]; then
        # Check flag passed down probably from tcp_fd_handler:
        # if we have output, we are in zle and need to fix the display first.
        # (The shell is supposed to be smart enough that you can replace
        # all the following with
        #   [[ -o zle ]] && zle -I
        # but I haven't dared try it yet.)
        if [[ -n $TCP_INVALIDATE_ZLE ]]; then
          zle -I
          # Only do this the first time.
          unset TCP_INVALIDATE_ZLE
        fi
        print -r -- $REPLY
      fi
    fi
    PK[L^''functions/_pkgrmnuW+A#compdef pkgrm
    
    _pkgrm() {
    	_arguments -s \
    	'-Y[select packages by category]:category: ' \
    	- set1 \
    	'-n[non-interactive mode]' \
    	'-v[trace all scripts]' \
    	'-a[admin file]:admin file:_files' \
    	"-A[force removal of all files]" \
    	"-M[don't use vfstab file]" \
    	'-R[root path]:root path:_files -/' \
    	'-V[alternate vfstab file]:vfstab file:_files' \
    	'*:package instance:_pkg_instance --_opts installed:set1--R' \
    	- set2 \
    	'-s[spool package]:spool directory:_files -/' \
    	'*:package instance:_pkg_instance --_opts spooled:set2--s'
    }
    
    _pkgrm "$@"
    PK[pfunctions/VCS_INFO_get_data_svknuW+A## vim:ft=zsh
    ## svk support by: Frank Terbeck 
    ## Distributed under the same BSD-ish license as zsh itself.
    
    setopt localoptions NO_shwordsplit
    local svkbranch svkbase
    local -xA hook_com
    
    svkbase=${vcs_comm[basedir]}
    rrn=${svkbase:t}
    zstyle -s ":vcs_info:${vcs}:${usercontext}:${rrn}" branchformat svkbranch || svkbranch="%b:%r"
    hook_com=( branch "${vcs_comm[branch]}" revision "${vcs_comm[revision]}" )
    if VCS_INFO_hook 'set-branch-format' "${svkbranch}"; then
        zformat -f svkbranch "${svkbranch}" "b:${hook_com[branch]}" "r:${hook_com[revision]}"
    else
        svkbranch=${hook_com[branch-replace]}
    fi
    hook_com=()
    VCS_INFO_formats '' "${svkbranch}" "${svkbase}" '' '' "${vcs_comm[revision]}" ''
    return 0
    PK[:۵functions/insert-unicode-charnuW+A# Make hex integers appear as 0x...
    setopt localoptions cbases
    
    integer -g _insert_unicode_ready
    
    if [[ $LASTWIDGET = insert-unicode-char && $_insert_unicode_ready -eq 1 ]]
    then
      # Second call; we should have a usable prefix.
      # If we don't, give up.
      (( ${+NUMERIC} )) || return 1
      # Convert it back to hex, padded with zeroes to 8 digits plus the 0x...
      local -i 16 -Z 10 arg=$NUMERIC
      # ...and use print to turn this into a Unicode character.
      LBUFFER+="$(print -n "\U${arg##0x}")"
      _insert_unicode_ready=0
    else
      # Set the base to 16...
      zle argument-base 16
      # ...wait for user to type hex keys then call this widget again.
      zle universal-argument
      _insert_unicode_ready=1
    fi
    PK[PPdi``functions/_tpconfignuW+A#compdef tpconfig
    
    _arguments \
      '--help' \
      '(-D --debug)'{-D,--debug=}':debug level:(1 2 3)' \
      '(-d --device)'{-d,--device=}':mouse device:_files' \
      '--version' \
      '(-i --info)'{-i,--info}'[display current touchpad config]' \
      '(-x --reset)'{-x,--reset}'[perform a software reset on the touchpad]' \
      '(-q --quiet --silent)'{-q,--quiet,--silent}'[suppress verbose output]' \
      '-a::packet mode:(0 1)' \
      '--absolute[set packet mode to absolute]' \
      '--relative[set packet mode to relative]' \
      '-r::reporting rate:(0 1)' \
      '-t::tapping mode:(0 1 2 3)' \
      '-s::sleep mode:(0 1)' \
      '(-2 --two-button)'{-2,--two-button}'[set two-button mode]' \
      '(-3 --three-button)'{-3,--three-button}'[set three-button mode]' \
      '(-c --corner)'{-c,--corner=}'::corner-tap mode:(0 1)' \
      '(-e --edgemode)'{-e,--edgemode=}'::edge motion:(0 1 3)' \
      '-m[display which mouse button is simulated by corner taps]' \
      '--middle-button[make corner taps simulate the middle mouse button]' \
      '--right-button[make corner taps simulate the right mouse button]' \
      '(-z --zthreshold)'{-z,--zthreshold=}'::tap sensitivity:'
    PK[Vfunctions/match-word-contextnuW+A# See if we can extend the word context to something more specific.
    # curcontext must be set to the base context by this point; it
    # will be appended to directly.
    
    emulate -L zsh
    setopt extendedglob
    
    local -a worcon bufwords
    local pat tag lastword word backword forword
    integer iword
    
    zstyle -a $curcontext word-context worcon || return 0
    
    if (( ${#worcon} % 2 )); then
      zle -M "Bad word-context style in context $curcontext"
      return
    fi
    
    bufwords=(${(z)LBUFFER})
    iword=${#bufwords}
    lastword=${bufwords[-1]}
    bufwords=(${(z)BUFFER})
    
    if [[ $lastword = ${bufwords[iword]} ]]; then
      # If the word immediately left of the cursor is complete,
      # we're not on it for forward operations.
      forword=${bufwords[iword+1]}
    else
      # We're on a word.
      forword=${bufwords[iword]}
    fi
    backword=${bufwords[iword]}
    
    if [[ $curcontext = *back* ]]; then
      word=$backword
    else
      word=$forword
    fi
    
    for pat tag in "${worcon[@]}"; do
      if [[ $word = ${~pat} ]]; then
        curcontext+=":$tag"
        return
      fi
    done
    PK[mfunctions/_svccfgnuW+A#compdef svccfg
    
    _svccfg_properties() {
    	local -a props fmris
    	local fmri="$argv[$#]"
    
    	# If There's more than one possible FMRI, bail
    	fmris=( ${(f)"$(svcs -H -o fmri $fmri)"} )
    	if [[ $#fmris -gt 1 ]]; then
    		_message "'$fmri' is ambiguous"
    		return 1
    	fi
    
    	# Get all the property names for the FMRI
    	props=( ${${${(f)"$(svccfg -s $fmri describe)"}:# *}%% *} )
    
    	_multi_parts "$expl[@]" - / props
    }
    
    _svccfg() {
    	local context state line subcmds
    	typeset -A opt_args
    
    	subcmds=( apply describe extract import validate export inventory delete addpropvalue delpropvalue )
    
    	if [[ $service == "svccfg" ]]; then
    		_arguments -s \
    			'-?[help]' \
    			'-v[verbose]' \
    			'-s[FMRI on which to operate]:fmri:_svcs_fmri -c' \
    			- set1 \
    			'-f[read commands from file]:command file:_files' \
    			- set2 \
    			'*::command:->subcmd' && return 0
    
    		if (( CURRENT == 1 )); then
    			_wanted commands expl 'svccfg subcommand' compadd -a subcmds
    			return
    		fi
    		service="$words[1]"
    		curcontext="${curcontext%:*}=$service:"
    	fi
    
    	case $service in
    	(import)
    		_arguments \
    			'-V[verify property updates]' \
    			':file:_files'
    		;;
    
    	(apply|inventory)
    		_files
    		;;
    
    	(validate)
    		_alternative 'files:file:_files' 'fmris:fmri:_svc_fmri -c'
    		;;
    
    	(export)
    		_svcs_fmri -c
    		;;
    
    	(delete)
    		_arguments \
    			'-f[force deletion if online or degraded]' \
    			'*:FMRI:_svcs_fmri -c'
    		;;
    
    	(describe)
    		local fmri=$opt_args[-s]
    		_arguments -A "-*" \
    			'-v[give all information]' \
    			'-t[show only template data]' \
    			":property group or property:_svccfg_properties $fmri"
    		;;
    
    	(extract)
    		;;
    
    	(*)
    		_message "unknown svccfg subcommand: $service"
    		;;
    	esac
    }
    
    _svccfg "$@"
    
    # vi:tw=0
    PK[Dfunctions/_builtinnuW+A#compdef builtin
    
    if (( $CURRENT > 2 )); then
      shift words
      (( CURRENT -- ))
      _normal
    else
      local expl
    
      _wanted commands expl 'builtin command' compadd "$@" -k builtins
    fi
    PK[Wܢfunctions/VCS_INFO_detect_hgnuW+A## vim:ft=zsh
    ## mercurial support by: Frank Terbeck 
    ## Distributed under the same BSD-ish license as zsh itself.
    
    setopt localoptions NO_shwordsplit
    
    [[ $1 == '--flavours' ]] && { print -l hg-git hg-hgsubversion hg-hgsvn; return 0 }
    
    VCS_INFO_check_com ${vcs_comm[cmd]} || return 1
    vcs_comm[detect_need_file]=store
    VCS_INFO_bydir_detect '.hg' || return 1
    
    if [[ -d ${vcs_comm[basedir]}/.hg/svn ]] ; then
        vcs_comm[overwrite_name]='hg-hgsubversion'
    elif [[ -d ${vcs_comm[basedir]}/.hgsvn ]] ; then
        vcs_comm[overwrite_name]='hg-hgsvn'
    elif [[ -e ${vcs_comm[basedir]}/.hg/git-mapfile ]] ; then
        vcs_comm[overwrite_name]='hg-git'
    fi
    return 0
    PK[iWfunctions/_mime_typesnuW+A#autoload
    
    local expl maintype
    local -a default_type_files type_files match mbegin mend
    integer ind
    
    default_type_files=(~/.mime.types /etc/mime.types)
    
    # This is the same style as used by zsh-mime-setup, with a different
    # context.
    if zstyle -a ":completion:${curcontext}:" mime-types type_files; then
      while (( (ind = ${type_files[(I)+]}) > 0 )); do
        type_files[$ind]=($default_type_files)
      done
    else
      type_files=($default_type_files)
    fi
    
    #
    # Handle two different mime type formats; the simple
    # format:
    #   application/x-pws-frobnicate psf pwsf
    # and the extended format
    #   type=application/x-pws-frobnicate \
    #   desc="PWS frobnicated widget" \
    #   exts="pwsf,psf"
    # which Netscape seems to like.
    #
    
    if [[ $PREFIX = (#b)([^/]##)/* ]]; then
      # Search for subtype.
      maintype=$match[1]
      compset -p $(( ${#maintype} + 1 ))
      _wanted mime-subtypes expl 'MIME subtype' \
          compadd -- $(sed -ne "s%^\(type=\|\)${maintype}/\([^ 	]*\).*$%\2%p" \
          $type_files)
    else
      # Search for main type.
      _wanted mime-types expl 'MIME type' \
        compadd -S/ -- $(sed -ne "s/^type=//" \
          -e "s%^\(${PREFIX:-[a-z]}[^=\"]*\)/.*$%\1%p" $type_files)
    fi
    PK[
    oRRfunctions/zfrtimenuW+A# function zfrtime {
    # Set the modification time of file LOCAL to that of REMOTE.
    # If the optional TIME is passed, it should be in the FTP format
    # CCYYMMDDhhmmSS, i.e. no dot before the seconds, and in GMT.
    # This is what both `zftp remote' and `zftp local' return.
    #
    # Unfortunately, since the time returned from FTP is GMT and
    # your file needs to be set in local time, we need to do some
    # hacking around with time.
    
    emulate -L zsh
    zmodload zsh/datetime
    
    local time gmtime loctime year mon mday hr min sec y tmpdate
    local -i days_since_epoch
    
    if [[ -n $3 ]]; then
      time=$3
    else
      time=($(zftp remote $2 2>/dev/null))
      [[ -n $time ]] && time=$time[2]
    fi
    [[ -z $time ]] && return 1
    
    year=$time[1,4]
    mon=$time[5,6]
    mday=$time[7,8]
    hr=$time[9,10]
    min=$time[11,12]
    sec=$time[13,14]
    
    #count the number of days since epoch without the current day
    for y  in {1970..$(( $year - 1))}; do
      strftime -s tmpdate -r "%Y/%m/%d" ${y}/12/31
      days_since_epoch+=$(strftime "%j" $tmpdate)
    done
    strftime -s tmpdate -r "%Y/%m/%d" $year/$mon/$(( $mday - 1 ))
    days_since_epoch+=$(strftime "%j" $tmpdate)
    # convert the time in number of seconds (this should be equivalent to timegm)
    time=$(( $sec + 60 * ( $min + 60 * ($hr + 24 * $days_since_epoch))  ))
    #Convert it back to CCYYMMDDhhmmSS
    strftime -s time "%Y%m%d%H%M%S" ${EPOCHSECONDS}
    touch -t ${time[1,12]}.${time[13,14]} $1
    PK[f1Q Q functions/calendar_addnuW+A#!/bin/zsh
    # All arguments are joined with spaces and inserted into the calendar
    # file at the appropriate point.
    #
    # While the function compares the date of the new entry with dates in the
    # existing calendar file, it does not do any sorting; it inserts the new
    # entry before the first existing entry with a later date and time.
    
    emulate -L zsh
    setopt extendedglob # xtrace
    
    local context=":datetime:calendar_add:"
    local vdatefmt="%Y%m%dT%H%M%S"
    local d='[[:digit:]]'
    
    local calendar newfile REPLY lastline opt text occur
    local -a calendar_entries lockfiles reply occurrences
    integer my_date done rstat nolock nobackup new_recurring
    integer keep_my_uid
    local -A reply parse_new parse_old
    local -a match mbegin mend
    local my_uid their_uid
    
    autoload -Uz calendar_{parse,read,lockfiles}
    
    while getopts "BL" opt; do
      case $opt in
        (B)
        nobackup=1
        ;;
    
        (L)
        nolock=1
        ;;
    
        (*)
        return 1
        ;;
      esac
    done
    shift $(( OPTIND - 1 ))
    
    # Read the calendar file from the calendar-file style
    zstyle -s $context calendar-file calendar ||
      calendar=~/calendar
    newfile=$calendar.new.$HOST.$$
    
    local addline="$*"
    if ! calendar_parse $addline; then
      print "$0: failed to parse date/time" >&2
      return 1
    fi
    parse_new=("${(@kv)reply}")
    (( my_date = $parse_new[time] ))
    if zstyle -t $context reformat-date; then
      local datefmt
      zstyle -s $context date-format datefmt ||
        datefmt="%a %b %d %H:%M:%S %Z %Y"
      strftime -s REPLY $datefmt $parse_new[time]
      addline="$REPLY $parse_new[text1]"
    fi
    if [[ -n $parse_new[rptstr] ]]; then
      (( new_recurring = 1 ))
      if [[ $parse_new[rptstr] = CANCELLED ]]; then
        (( done = 1 ))
      elif [[ $addline = (#b)(*[[:space:]\#]RECURRENCE[[:space:]]##)([^[:space:]]##)([[:space:]]*|) ]]; then
        # Use the updated recurrence time
        strftime -s REPLY $vdatefmt ${parse_new[schedrpttime]}
        addline="${match[1]}$REPLY${match[3]}"
      else
        # Add a recurrence time
        [[ $addline = *$'\n' ]] || addline+=$'\n'
        strftime -s REPLY $vdatefmt ${parse_new[schedrpttime]}
        addline+="  # RECURRENCE $REPLY"
      fi
    fi
    
    # $calendar doesn't necessarily exist yet.
    
    # Match a UID, a unique identifier for the entry inherited from
    # text/calendar format.
    local uidpat='(|*[[:space:]])UID[[:space:]]##(#b)([[:xdigit:]]##)(|[[:space:]]*)'
    if [[ $addline = ${~uidpat} ]]; then
      my_uid=${(U)match[1]}
    fi
    
    # start of subshell for OS file locking
    (
    # start of block for following always to clear up lockfiles.
    # Not needed but harmless if OS file locking is used.
    {
      if (( ! nolock )); then
        if zmodload -F zsh/system b:zsystem && zsystem supports flock &&
          zsystem flock $calendar 2>/dev/null; then
          # locked OK
          :
        else
          calendar_lockfiles $calendar || exit 1
        fi
      fi
    
      if [[ -f $calendar ]]; then
        calendar_read $calendar
    
        if [[ -n $my_uid ]]; then
          # Pre-scan to events with the same UID
          for line in $calendar_entries; do
    	calendar_parse $line  ||  continue
    	parse_old=("${(@kv)reply}")
    	# Recurring with a UID?
    	if [[ $line = ${~uidpat} ]]; then
    	  their_uid=${(U)match[1]}
    	  if [[ $their_uid = $my_uid ]]; then
    	    # Deal with recurrences and also some add some
    	    # extra magic for cancellation.
    
    	    # See if we have found a recurrent version
    	    if [[ -z $parse_old[rpttime] ]]; then
    	      # No, so assume this is a straightforward replacement
    	      # of a non-recurring event.
    
    	      # Is this a cancellation of a non-recurring event?
    	      # Look for an OCCURRENCE in the form
    	      #   OCCURRENCE 20100513T110000 CANCELLED
    	      # although we don't bother looking at the date/time---
    	      # it's one-off, so this should already be unique.
    	      if [[ $new_recurring -eq 0 && \
    		$parse_new[text1] = (|*[[:space:]\#])"OCCURRENCE"[[:space:]]##([^[:space:]]##[[:space:]]##CANCELLED)(|[[:space:]]*) ]]; then
    		# Yes, so skip both the old and new events.
    		(( done = 1 ))
    	      fi
    	      # We'll skip this UID when we encounter it again.
    	      continue
    	    fi
    	    if (( new_recurring )); then
    	      # Replacing a recurrence; there can be only one.
    	      # TBD: do we replace existing occurrences of the
    	      # replaced recurrent event?  I'm guessing not, but
    	      # if we keep the UID then maybe we should.
    	      #
    	      # TBD: ick, suppose we're cancelling an even that
    	      # we added to a recurring sequence but didn't replace
    	      # the recurrence.  We might get RPT CANCELLED for this.
    	      # That would be bad.  Should invent better way of
    	      # cancelling non-recurring event.
    	      continue
    	    else
    	      # The recorded event is recurring, but the new one is a
    	      # one-off event. If there are embedded OCCURRENCE declarations,
    	      # use those.
    	      #
    	      # TBD: We could be clever about text associated
    	      # with the occurrence.  Copying the entire text
    	      # of the meeting seems like overkill but people often
    	      # add specific remarks about why this occurrence was
    	      # moved/cancelled.
    	      #
    	      # TBD: one case we don't yet handle is cancelling
    	      # something that isn't replacing a recurrence, i.e.
    	      # something we added as OCCURRENCE XXXXXXXXTXXXXXX .
    	      # If we're adding a CANCELLED occurrence we should
    	      # look to see if it matches  and if so simply
    	      # delete that occurrence.
    	      #
    	      # TBD: one nasty case is if the new occurrence
    	      # occurs before the current scheduled time.  As we
    	      # never look backwards we'll miss it.
    	      text=$addline
    	      occurrences=()
    	      while [[ $text = (#b)(|*[[:space:]\#])"OCCURRENCE"[[:space:]]##([^[:space:]]##[[:space:]]##[^[:space:]]##)(|[[:space:]]*) ]]; do
    		occurrences+=($match[2])
    		text="$match[1] $match[3]"
    	      done
    	      if (( ! ${#occurrences} )); then
    		# No embedded occurrences.  We'll manufacture one
    		# that doesn't refer to an original recurrence.
    		strftime -s REPLY $vdatefmt $my_date
    		occurrences=("XXXXXXXXTXXXXXX $REPLY")
    	      fi
    	      # Add these occurrences, checking if they replace
    	      # an existing one.
    	      for occur in ${(o)occurrences}; do
    		REPLY=${occur%%[[:space:]]*}
    		# Only update occurrences that refer to genuine
    		# recurrences.
    		if [[ $REPLY = [[:digit:]](#c8)T[[:digit:]](#c6) && $line = (#b)(|*[[:space:]\#])(OCCURRENCE[[:space:]]##)${REPLY}[[:space:]]##[^[:space:]]##(|[[:space:]]*) ]]; then
    		  # Yes, update in situ
    		  line="${match[1]}${match[2]}$occur${match[3]}"
    		else
    		  # No, append.
    		  [[ $line = *$'\n' ]] || line+=$'\n'
    		  line+="  # OCCURRENCE $occur"
    		fi
    	      done
    	      # The line we're adding now corresponds to the
    	      # original event.  We'll skip the matching UID
    	      # in the file below, however.
    	      addline=$line
    	      # We need to work out which event is next, so
    	      # reparse.
    	      if calendar_parse $addline; then
    		parse_new=("${(@kv)reply}")
    		(( my_date = ${parse_new[time]} ))
    		if zstyle -t $context reformat-date; then
    		  zstyle -s $context date-format datefmt
    		  strftime -s REPLY $datefmt $parse_new[time]
    		  addline="$REPLY $parse_new[text1]"
    		fi
    	      fi
    	    fi
    	  fi
    	fi
          done
        fi
    
        {
          for line in $calendar_entries; do
    	calendar_parse $line  ||  continue
    	parse_old=("${(@kv)reply}")
    	if (( ! done && ${parse_old[time]} > my_date )); then
    	  print -r -- $addline
    	  (( done = 1 ))
    	fi
    	# We've already merged any information on the same UID
    	# with our new text, probably.
    	if [[ $keep_my_uid -eq 0 && -n $my_uid && $line = ${~uidpat} ]]; then
    	  their_uid=${(U)match[1]}
    	  [[ $my_uid = $their_uid ]] && continue
    	fi
    	if [[ $parse_old[time] -eq $my_date && $line = $addline ]]; then
    	  (( done )) && continue # paranoia: shouldn't happen
    	  (( done = 1 ))
    	fi
    	print -r -- $line
          done
          (( done )) || print -r -- $addline
        } >$newfile
        if (( ! nobackup )); then
          if ! mv $calendar $calendar.old; then
    	print "Couldn't back up $calendar to $calendar.old.
    New calendar left in $newfile." >&2
    	(( rstat = 1 ))
          fi
        fi
      else
        (( done )) || print -r -- $addline >$newfile
      fi
    
      if (( !rstat )) && ! mv $newfile $calendar; then
        print "Failed to rename $newfile to $calendar.
    Old calendar left in $calendar.old." >&2
        (( rstat = 1 ))
      fi
    } always {
      (( ${#lockfiles} )) && rm -f $lockfiles
    }
    
    exit $rstat
    )
    PK[fk,functions/catchnuW+A# Catch an exception.  Returns 0 if the exception in question was caught.
    # The first argument gives the exception to catch, which may be a
    # pattern.
    # This must be within an always-block.  A typical set of handlers looks
    # like:
    #   {
    #     # try block; something here throws exceptions
    #   } always {
    #      if catch MyExcept; then
    #         # Handler code goes here.
    #         print Handling exception MyExcept
    #      elif catch *; then
    #         # This is the way to implement a catch-all.
    #         print Handling any other exception
    #      fi
    #   }
    # As with other languages, exceptions do not need to be handled
    # within an always block and may propagate to a handler further up the
    # call chain.
    #
    # It is possible to throw an exception from within the handler by
    # using "throw".
    #
    # The shell variable $CAUGHT is set to the last exception caught,
    # which is useful if the argument to "catch" was a pattern.
    #
    # Use "function" keyword in case catch is already an alias.
    function catch {
      if [[ $TRY_BLOCK_ERROR -gt 0 && $EXCEPTION = ${~1} ]]; then
        (( TRY_BLOCK_ERROR = 0 ))
        typeset -g CAUGHT="$EXCEPTION"
        unset EXCEPTION
        return 0
      fi
    
      return 1
    }
    # Never use globbing with "catch".
    alias catch="noglob catch"
    
    catch "$@"
    PK[9'[		functions/zfinitnuW+Aemulate -L zsh
    
    if [[ $1 != -n ]]; then
       zmodload -i zsh/net/tcp || return 1
       zmodload -ia zsh/zftp zftp || return 1
    fi
    
    if zmodload -i zsh/zutil; then
      local arr
      # Set defaults for styles if none set.
      zstyle -g arr ':zftp:*' progress || zstyle ':zftp:*' progress bar
      zstyle -g arr ':zftp:*' update   || zstyle ':zftp:*' update   1
      zstyle -g arr ':zftp:*' titlebar || zstyle ':zftp:*' titlebar true
      if functions chpwd >&/dev/null && ! zstyle -g arr ':zftp:*' chpwd; then
        zstyle ':zftp:*' chpwd true
      fi
    
      typeset -gA zfconfig
      zfconfig=(lastsession default)
    fi
    
    alias zfcd='noglob zfcd'
    alias zfget='noglob zfget'
    alias zfls='noglob zfls'
    alias zfdir='noglob zfdir'
    alias zfuget='noglob zfuget'
    
    autoload -Uz zfanon zfautocheck zfcd zfcd_match zfcget zfclose zfcput
    autoload -Uz zfdir zffcache zfgcp zfget zfget_match zfgoto zfhere zfinit zfls
    autoload -Uz zfmark zfopen zfparams zfpcp zfput zfrglob zfrtime zfsession
    autoload -Uz zfstat zftp_chpwd zftp_progress zftransfer zftype zfuget zfuput
    
    #
    # zftp completions: only use these if new-style completion is not
    # active.
    #
    if [[ ${#_patcomps} -eq 0 || -z ${_patcomps[(r)_zf*]} ]] &&
      (compctl >/dev/null 2>&1); then
      # only way of getting that noglob out of the way: this is unnecessary with
      # widget-based completion
      setopt completealiases
    
      compctl -f -x 'p[1]' \
        -k '(open params user login type ascii binary mode put putat
        get getat append appendat ls dir local remote mkdir rmdir delete
        close quit)'  - \
        'w[1,cd][1,ls][1,dir][1,rmdir]' -K zfcd_match -S/ -q - \
        'W[1,get*]' -K zfget_match - 'w[1,delete][1,remote]' -K zfget_match - \
        'w[1,open][1,params]' -k hosts - \
        'w[1,session]' -s '${$(zftp session):#$ZFTP_SESSION}' -- zftp
      compctl -K zfcd_match -S/ -q zfcd zfdir zfls
      compctl -K zfget_match zfget zfgcp zfuget zfcget
      compctl -k hosts zfanon zfopen zfparams
      compctl -s \
        '$(awk '\''{print $1}'\'' ${ZFTP_BMFILE:-${ZDOTDIR:-$HOME}/.zfbkmarks})' \
        -x 'W[1,-*n*]' \
        -s '$(awk -F, '\''NR > 2 { print $1 }'\'' ~/.ncftp/bookmarks)' -- \
        zfgoto zfmark
      compctl -s '${$(zftp session):#$ZFTP_SESSION}' zfsession
      # in _zftp for new completion, but hard to inline into a compctl
      zftransfer_match() {
        local sess=${1%%:*} oldsess=$ZFTP_SESSION
        [[ -n $sess ]] && zftp session $sess
        zfget_match ${1#*:} $2
        [[ -n $sess && -n $oldsess ]] && zftp session $oldsess
        reply=(${sess}:${^reply})
      }
      compctl -s '$(zftp session)' -S : -x 'C[0,*:*]' \
        -K zftransfer_match -- zftransfer
    fi
    
    return 0
    PK[functions/tcp_lognuW+A# Log TCP output.
    #
    # Argument:  Output filename.
    #
    # Options:
    #   -a    Append.  Otherwise the existing file is truncated without warning.
    #	  (N.B.: even if logging was already active to it!)
    #   -s    Per-session logs.  Output to 1, 2, etc.
    #   -c    Close logging.
    #   -n/-N Turn off or on normal output; output only goes to the logfile, if
    #         any.  Otherwise, output also appears interactively.  This
    #         can be given with -c (or any other option), then no output
    #         goes anywhere.  However, input is still handled by the usual
    #         mechanisms --- $tcp_lines and $TCP_LINE are still set, hence
    #         tcp_expect still works.  Equivalent to (un)setting TCP_SILENT.
    #
    # With no options and no arguments, print the current configuration.
    #
    # Per-session logs are raw output, otherwise $TCP_PROMPT is prepended
    # to each line.
    
    emulate -L zsh
    setopt cbases extendedglob
    
    local opt append sess close
    integer activity
    while getopts "ascnN" opt; do
      (( activity++ ))
      case $opt in
        # append to existing file
        a) append=1
           ;;
        # per-session
        s) sess=1
           ;;
        # close
        c) close=1
           ;;
        # turn off interactive output
        n) TCP_SILENT=1
           ;;
        # turn on interactive output
        N) unset TCP_SILENT
           ;;
        # incorrect option
        \?) return 1
    	;;
        # correct option I forgot about
        *) print "$0: option -$opt not handled, oops." >&2
           return 1
           ;;
      esac
    done
    (( OPTIND > 1 )) && shift $(( OPTIND - 1)) 
    
    if [[ -n $close ]]; then
      if (( $# )); then
        print "$0: too many arguments for -c" >&2
        return 1
      fi
      unset TCP_LOG TCP_LOG_SESS
      return 0
    fi
    
    if (( $# == 0 && ! activity )); then
      print "\
    Per-session log: ${TCP_LOG_SESS:-}
    Overall log:     ${TCP_LOG:-}
    Silent?          ${${TCP_SILENT:+yes}:-no}"
      return 0
    fi
    
    if (( $# != 1 )); then
      print "$0: wrong number of arguments" >&2
      return 1
    fi
    
    if [[ -n $sess ]]; then
      typeset -g TCP_LOG_SESS=$1
      if [[ -z $append ]]; then
        local sesslogs
        integer i
        sesslogs=(${TCP_LOG_SESS}*(N))
        # yes, i know i can do this with multios
        for (( i = 1; i <= $#sesslogs; i++ )); do
          : >$sesslogs[$i]
        done
      fi
    else
      typeset -g TCP_LOG=$1
      [[ -z $append ]] && : >$TCP_LOG
    fi
    
    return 0
    PK[{functions/_aptitudenuW+A#compdef aptitude
    
    local curcontext="$curcontext" state line cmds ret=1
    
    function _aptitude_release() {
      #{{{
      local expl releases
      releases=(
    ${${(M)${(f)"$(cmds' \
      '*: :->args' && ret=0
    
    case $state in
      cmds)
        cmds=( ${${(M)${(f)"$(LC_ALL=C _call_program commands aptitude -h 2>/dev/null)"}:#* - *}/(#b) (*[^ ]) #- (*)/$match[1]:$match[2]:l})
    
        _describe -t commands 'aptitude command' cmds && ret=0
      ;;
      args)
        case $line[1] in
          search)
            _message -e patterns pattern
          ;;
          (download|show|changelog|why|why-not|build-dep|build-depends)
            _deb_packages avail && ret=0
          ;;
          (remove|purge|hold|unhold|reinstall|forbid-version|markauto|unmarkauto)
            _deb_packages installed && ret=0
          ;;
          install)
            _deb_packages uninstalled && ret=0
          ;;
          *)
            (( ret )) && _message 'no more arguments'
          ;;
        esac
      ;;
    esac
    
    return ret
    PK[d7functions/_stracenuW+A#compdef strace
    
    # TODO:
    #	- make _sys_calls system-dependent
    #	- allow negated calls (e.g. -e!write)
    _sys_calls () {
    	local expl
    
    	sys_calls=(_llseek _newselect _sysctl accept access acct
    		adjtimex afs_syscall alarm bdflush bind break brk cacheflush
    		capget capset chdir chmod chown chown32 chroot clone close connect
    		creat create_module delete_module dup dup2 execve exit fchdir
    		fchmod fchown fchown32 fcntl fcntl64 fdatasync flock fork fstat
    		fstat64 fstatfs fsync ftime ftruncate ftruncate64 get_kernel_syms
    		getcwd getdents getdents64 getegid getegid32 geteuid geteuid32
    		getgid getgid32 getgroups getgroups32 getitimer getpagesize getpeername
    		getpmsg getpgid getpgrp getpid getppid getpriority getresgid getresgid32
    		getresuid getresuid32 getrlimit getrusage getsid getsockname getsockopt
    		gettid gettimeofday getuid getuid32 gtty idle init_module ioctl ioperm
    		iopl ipc kill lchown lchown32 link listen lock lseek lstat lstat64
    		madvise mincore mkdir mknod mlock mlockall mmap modify_ldt mount mprotect
    		mpx mremap msync munlock munlockall munmap nanosleep nfsservctl nice
    		oldfstat oldlstat oldolduname oldstat oldumount olduname open pause
    		personality phys pipe pivot_root poll prctl pread prof profil ptrace
    		putpmsg pwrite query_module quotactl read readahead readdir readlink
    		readv reboot recv recvfrom recvmsg rename rmdir rt_sigaction
    		rt_sigpending rt_sigprocmask rt_sigqueueinfo rt_sigreturn rt_sigsuspend
    		rt_sigtimedwait sched_get_priority_max sched_get_priority_min
    		sched_getparam sched_getscheduler sched_rr_get_interval sched_setparam
    		sched_setscheduler sched_yield security select sendfile send sendmsg sendto
    		setdomainname setfsgid setfsgid32 setfsuid setfsuid32 setgid setgid32
    		setgroups setgroups32 sethostname setitimer setpgid setpriority setregid
    		setregid32 setresgid setresgid32 setresuid setresuid32 setreuid setreuid32
    		setrlimit setsid setsockopt settimeofday setuid setuid32 setup sgetmask
    		shutdown sigaction sigaltstack signal sigpending sigprocmask sigreturn
    		sigsuspend socket socketcall socketpair ssetmask stat stat64 statfs stime
    		stty swapoff swapon symlink sync sysfs sysinfo syslog time times truncate
    		truncate64 ulimit umask umount uname unlink uselib ustat utime vfork vhangup
    		vm86 vm86old wait4 waitpid write writev)
    
    	for t in ${(s:,:)${PREFIX}}; do
    		sys_calls=( ${sys_calls:#$t} )
    	done
    	compset -P '*,'
    	_wanted sys_calls expl 'System calls' compadd -qS , -a sys_calls
    }
    
    _sets () {
    	_alternative \
    		'special:special values:(all none)' \
    		'calls::_sys_calls'
    }
    
    _traces () {
    	local expl
    	traces=('file:trace all system calls which take a file name as an argument'
    		'process:trace all system calls which involve process management'
    		'network:trace all the network related system calls'
    		'signal:trace all signal related system calls'
    		'ipc:trace all IPC related system calls'
    		'desc:trace all file descriptor related system calls')
    	compset -P '*,'
    	_describe -t traces 'Related system calls' traces -qS ,
    }
    
    _traces_sets () {
    	_alternative \
    		'traces::_traces' \
    		'sets::_sets'
    }
    
    _expression () {
    	_values -S = "Qualifying expression" \
    		'trace[trace specified set of system calls only]:system calls:_traces_sets' \
    		'abbrev[abbreviate the output from printing each member of large structures]:system calls:_sets' \
    		'verbose[dereference structures for the specified set of system calls]:system calls:_sets' \
    		'raw[print raw, undecoded arguments for the specified set of system calls]:system calls:_sets' \
    		'signal[trace only the specified subset of signals]:signal:{compset -P "*,"; _signals -s -qS ,}' \
    		'read[perform a full hex and ASCII dump of all the data read from listed file descriptors]:file descriptors:{compset -P "*,"; _file_descriptors -qS ,}' \
    		'write[perform a full hex and ASCII dump of all the data written to listed file descriptors]:file descriptors:{compset -P "*,"; _file_descriptors -qS ,}'
    	if [[ -z "$words[CURRENT]" || -n "${words[CURRENT]:#*=*}" ]]; then
    		_traces_sets
    	fi
    }
    
    _arguments \
    	'()-c[count time, calls, and errors for each system call and report a summary]' \
    	-d'[show some debugging output of strace itself on the standard error]' \
    	-f'[trace child processes as they are created by currently traced processes]' \
    	-ff'[write each process trace to . (when using -o ]' \
    	'(-c -d -f -ff -i -q -r -t -tt -ttt -T -v -V -x -xx -a -e -o -O -p -s -S -u -E)-h[print help]' \
    	-i'[print the instruction pointer at the time of the system call]' \
    	-q'[suppress messages about attaching, detaching etc.]' \
    	-r'[print a relative timestamp upon entry to each system call]' \
    	'(-ttt)-t[prefix each line of the trace with the time of day]' \
    	'(-ttt -tt)-tt[prefix each line of the trace with the time of day including the microseconds]' \
    	'(-tt -t)-ttt[prefix each line of the trace with the number of seconds and microseconds since the epoch]' \
    	-T'[show the time spent in system calls]' \
    	-v'[print unabbreviated versions of environment, stat, termios, etc. calls]' \
    	'(-c -d -f -ff -h -i -q -r -t -tt -ttt -T -v -x -xx -a -e -o -O -p -s -S -u -E)-V[print the version number of strace]' \
    	'(-xx)-x[print all non-ASCII strings in hexadecimal string format]' \
    	'(-x)-xx[print all strings in hexadecimal string format]' \
    	-a'[align return values in a specific column (default 40)]:column number' \
    	'*-e[select events to trace or how to trace]:system call:_expression' \
    	'-o[write the trace output to the file]:output file:_files' \
    	'-O[overhead for tracing system calls]:overhead microseconds' \
    	'(:)-p[attach to the process with specified process ID and begin tracing]:process ID:_pids' \
    	'-s[specify the maximum string size to print (default 32)]:maximum string size' \
    	'-S[sort the output of the histogram (-c option) by the specified criterion]:sort by:(time calls name nothing)' \
    	'-u[run as specified user]:user:_users' \
    	'*-E[remove variable from the inherited list of environment or define a value]:variable:_printenv' \
    	'(-):command name: _command_names -e' \
    	'*::arguments:_normal'
    PK[u̝		functions/_dispatchnuW+A#autoload
    
    local comp pat val name i ret=1 _compskip="$_compskip"
    local curcontext="$curcontext" service str noskip
    local -a match mbegin mend
    
    # If we get the option `-s', we don't reset `_compskip'.
    
    if [[ "$1" = -s ]]; then
      noskip=yes
      shift
    fi
    
    [[ -z "$noskip" ]] && _compskip=
    
    curcontext="${curcontext%:*:*}:${1}:"
    
    shift
    
    # See if there are any matching pattern completions.
    
    if [[ "$_compskip" != (all|*patterns*) ]]; then
    
      for str in "$@"; do
        [[ -n "$str" ]] || continue
        service="${_services[$str]:-$str}"
        for i in "${(@)_patcomps[(K)$str]}"; do
          if [[ $i = (#b)"="([^=]#)"="(*) ]]; then
    	service=$match[1]
    	i=$match[2]
          fi
          eval "$i" && ret=0
          if [[ "$_compskip" = *patterns* ]]; then
            break
          elif [[ "$_compskip" = all ]]; then
            _compskip=''
            return ret
          fi
        done
      done
    fi
    
    # Now look up the names in the normal completion array.
    
    ret=1
    for str in "$@"; do
      [[ -n "$str" ]] || continue
      # The following means we look up the names of commands
      # after stripping quotes.  This is presumably correct,
      # but do we need to do the same elsewhere?
      str=${(Q)str}
      name="$str"
      comp="${_comps[$str]}"
      service="${_services[$str]:-$str}"
    
      [[ -z "$comp" ]] || break
    done
    
    # And generate the matches, probably using default completion.
    
    if [[ -n "$comp" && "$name" != "${argv[-1]}" ]]; then
      _compskip=patterns
      eval "$comp" && ret=0
      [[ "$_compskip" = (all|*patterns*) ]] && return ret
    fi
    
    if [[ "$_compskip" != (all|*patterns*) ]]; then
      for str; do
        [[ -n "$str" ]] || continue
        service="${_services[$str]:-$str}"
        for i in "${(@)_postpatcomps[(K)$str]}"; do
          _compskip=default
          eval "$i" && ret=0
          if [[ "$_compskip" = *patterns* ]]; then
            break
          elif [[ "$_compskip" = all ]]; then
            _compskip=''
            return ret
          fi
        done
      done
    fi
    
    [[ "$name" = "${argv[-1]}" && -n "$comp" &&
       "$_compskip" != (all|*default*) ]] &&
      service="${_services[$name]:-$name}" &&
       eval "$comp" && ret=0
    
    _compskip=''
    
    return ret
    PK[lllfunctions/_datenuW+A#compdef date
    
    local -a args
    
    if _pick_variant gnu="Free Software Foundation" unix --version; then
      args=(
        '-d[output specified date]:time string'
        '-f[output dates specified in file]:file:_files'
        '-I-[iso-8601]:precision:(date hours minutes seconds)'
        '-r[reference]:file:_files'
        '-R[rfc-2822]'
        '-s[set]:time string'
        '--rfc-3339=-[output date and time in RFC 3339 format]:output type:(date seconds ns)'
        --
        '*=FILE*:file:_files'
        '*=DATEFILE*:date file:_files'
      )
    else
      case "$OSTYPE" in
        solaris*)
          args=( '-a:adjustment' )
        ;;
        freebsd*|darwin*)
          args=(
    	'-n[only set time on current machine]'
    	'-d:daylight saving time value'
    	'-j[do not try to set date]'
    	'-f:parsing format'
    	'-r:seconds since epoch'
    	'-t:minutes west of GMT'
    	'-v:adjustment value'
          )
        ;;
        openbsd*)
          args=(
    	'-n[only set time on current machine]'
    	'-d:daylight saving time value'
    	'-a[gradually skew]'
    	'-r:seconds since epoch'
    	'-t:minutes west of GMT'
          )
        ;;
      esac
    fi
    
    _arguments \
      '-u[display or set time in UTC]' \
      ': :_guard "^--*" "format or date"' \
      "$args[@]"
    PK[ά@Ffunctions/_flexnuW+A#compdef flex
    
    local curcontext="$curcontext" state line ret=1
    typeset -A opt_args
    
    _arguments -C -s \
      --help --version \
      '-b[generate backing-up information]' \
      '-d[make scanner running in debug mode]' \
      '-f[generate fast scanner (full table)]' \
      '-h[show help]' \
      '-i[generate case-insensitive scanner]' \
      '-l[maximum compatibility with lex]' \
      '-p[generate performance report]' \
      '-s[suppress default rule]' \
      '-t[write scanner to stdout]' \
      '-v[show summary of statistics about scanner]' \
      '-w[suppress warnings]' \
      '-B[generate batch scanner]' \
      '-F[use fast scanner table representation]' \
      '-I[generate interactive scanner]' \
      '-L[don'"'"'t generate #line directives]' \
      '-T[trace mode]' \
      '-V[show version]' \
      '-7[generate 7-bit scanner]' \
      '-8[generate 8-bit scanner]' \
      '-\+[generate C++ scanner class]' \
      '-C-[specify degree of table compression]:table compression:->tabcomp' \
      '-o-[specify output file]:output file:_files' \
      '-P-[change yy prefix]:prefix string:' \
      '-S-[override skeleton file]:skeleton file:_files' \
      '*:input files:_files -g "*.(#i)(f|)lex(-.)"' && ret=0
    
    if [[ -n "$state" ]]; then
      _values -s '' 'table compression' \
        'a[align tables]' \
        'e[construct equivalence classes]' \
        '(m)f[generate full tables]' \
        '(m)F[generate fast tables]' \
        '(f F)m[construct meta-equivalence classes]' \
        'r[don'"'"'t use stdio library]' && ret=0
    fi
    
    return ret
    PK[w!functions/_lighttpdnuW+A#compdef lighty-enable-mod lighty-disable-mod
    
    local -a mods
    
    case "$service" in
        lighty-enable-mod)
    		mods=( `echo /etc/lighttpd/conf-available/*.conf(N:r:t) | sed -e 's/\b[0-9][0-9]-//g'` )
    		_wanted mods expl mods compadd -a mods
    	;;
        lighty-disable-mod)
    		mods=( `echo /etc/lighttpd/conf-enabled/*.conf(N:r:t) | sed -e 's/\b[0-9][0-9]-//g'` )
    		_wanted mods expl mods compadd -a mods
    	;;
    esac
    
    return 0
    PK[K,((functions/_zattrnuW+A#compdef zgetattr zsetattr zdelattr zlistattr
    
    local state line expl ret=1 REPLY
    local -a args privs
    
    case $service in
    zgetattr)
    _arguments \
      '1:file:_files' \
      '2:attribute:->attrs' \
      '3:parameter'
    ;;
    zsetattr)
    _arguments \
      '1:file:_files' \
      '2:attribute:->attrs' \
      '3:value'
    ;;
    zdelattr)
    _arguments \
      '1:file:_files' \
      '2:attribute:->attrs'
    ;;
    zlistattr)
    _arguments \
      '1:file:_files' \
      '2:parameter'
    ;;
    esac
    
    if [[ $state = attrs ]]; then
      zlistattr $~line[1] REPLY 2> /dev/null
      _wanted attrs expl 'attribute' compadd $REPLY
    fi
    PK[S[\functions/_sysctlnuW+A#compdef sysctl
    
    case $OSTYPE in
      *freebsd[5-9].*|freebsd4.[4-9]*)
        local -a sysctlvars
        sysctlvars=( $(sysctl -aN) )
        _arguments -s -A "-*" \
          '(*)-a[list all]' \
          '-b[binary output]' \
          '(-n)-N[show only variable names]' \
          '(-N)-n[show only variable values]' \
          '(-x)-o[show opaques as well (values suppressed)]' \
          '(-o)-x[show opaques as well (entire values)]' \
          '(-a)*:sysctl variable:_multi_parts -i . sysctlvars'
      ;;
      freebsd[0-4].*|darwin*|dragonfly*)
        : ${(A)_cache_sysctlvars:=${${$(sysctl -A 2>/dev/null):#[^a-z]*}%%:*}}
        _arguments -s -A "-*" \
          '(-w -X *)-a[list all]' \
          '(-w -X *)-A[show all opaques (values suppressed)]' \
          '(-w)-b[binary output]' \
          '(-w)-n[show only variable values]' \
          '(-a -A -b -n -X)-w[write mode]' \
          '(-a -A -w *)-X[show all opaques (entire values)]' \
          '(-a -A -X)*:sysctl variable:_multi_parts ${words[(r)-w]:+-S=} -i . _cache_sysctlvars'
      ;;
      linux*)
        _arguments -A "-*" \
          '-n[show only variable values]' \
          '(-n -p -a -A)-w[write mode]' \
          '(-n -w -a -A *)-p[specify file to load sysctl settings from]:file:_files' \
          '(-n -w -p -A *)-a[list all]' \
          '(-n -w -p -a *)-A[list all in table form]' \
          '(-n -p -a -A)*:sysctl variable:_files -W /proc/sys'
      ;;
      openbsd*)
        : ${(A)_cache_sysctlvars:=${${(f)"$(sysctl -a)"}%% *}}
        _arguments -s -A "-*" \
          '(-w -A *)-a[list all string and integer variables]' \
          '(-w -a *)-A[list all known variables]' \
          '(-w)-n[show only values]' \
          '(-a -A -n)-w[write variable]' \
          '(-a -A)*:sysctl variable:_multi_parts ${words[(r)-w]:+-S=} -i . _cache_sysctlvars'
        ;;
    esac
    PK[Vfunctions/_pscpnuW+A#compdef pscp pscp.exe
    #Generated by Felix Rosencrantz
    
    _arguments \
      '-p[preserve file attributes]' \
      "-q[quiet, don't show statistics]" \
      '-r[copy directories recursively]' \
      '-v[show verbose messages]' \
      '-load[load settings from saved session]:session' \
      '-P[connect to specified port]:port:_ports' \
      '-l[connect with specified username]:username:_users' \
      '-pw[login with specified password]:password' \
      '(-1 -2)'{-1,-2}'[force use of particular SSH protocol version]' \
      '-C[enable compression]' \
      '-i[specify private key file for authentication]:private key file:_files' \
      '-batch[disable all interactive prompts]' \
      '-unsafe[allow server-side wildcards (DANGEROUS)]' \
      '*: :_files'
    PK[Oj11functions/VCS_INFO_get_data_cdvnuW+A## vim:ft=zsh
    ## codeville support by: Frank Terbeck 
    ## Distributed under the same BSD-ish license as zsh itself.
    
    setopt localoptions NO_shwordsplit
    local cdvbase
    
    cdvbase=${vcs_comm[basedir]}
    rrn=${cdvbase:t}
    VCS_INFO_formats '' "${cdvbase:t}" "${cdvbase}" '' '' '' ''
    return 0
    PK[l/(functions/tcp_sendnuW+Aemulate -L zsh
    setopt extendedglob cbases
    
    local opt quiet all sess fd nonewline cat line
    local -a sessions write_fds
    integer mystat
    
    while getopts "acl:nqs:" opt; do
        case $opt in
    	(a) all=1
    	    ;;
            (c) cat=1
    	    ;;
    	(n) nonewline=-n
    	    ;;
    	(q) quiet=1
    	    ;;
    	(l) for sess in ${(s.,.)OPTARG}; do
    	        if [[ -z ${tcp_by_name[$sess]} ]]; then
    		    print "$0: no such session: $sess" >&2
    		    return 1
    		fi
    		sessions+=($sess)
    	    done
    	    ;;
    	(s) if [[ -z $tcp_by_name[$OPTARG] ]]; then
                    print "No such session: $OPTARG" >&2
    		return 1
    	    fi
    	    sessions+=($OPTARG)
    	    ;;
    	(*) [[ $opt != '?' ]] && print Unhandled option, complain: $opt >&2
                return 1
    	    ;;
        esac
    done
    (( OPTIND > 1 )) && shift $(( OPTIND - 1 ))
    
    if [[ -n $all ]]; then
        sessions=(${(k)tcp_by_name})
    elif (( ! ${#sessions} )); then
        sessions=($TCP_SESS)
    fi
    if (( ! $#sessions )); then
        if [[ -z $quiet ]]; then
    	print "No current TCP session open." >&2
        fi
        return 1
    fi
    
    # Writing on a TCP connection closed by the remote end can cause SIGPIPE.
    # The following test is reasonably robust, though in principle we can
    # mistake a SIGPIPE owing to another fd.  That doesn't seem like a big worry.
    # `emulate -L zsh' will already have set localtraps.
    local TCP_FD_CLOSED
    trap 'TCP_FD_CLOSED=1' PIPE
    
    local TCP_SESS
    
    while true; do
      if [[ -n $cat ]]; then
        read -r line || break
      else
        line="$*"
      fi
      for TCP_SESS in $sessions; do
        fd=${tcp_by_name[$TCP_SESS]}
        if [[ -z $fd ]]; then
          print "No such session: $TCP_SESS" >&2
          mystat=1
          continue
        fi
        print -u $fd $nonewline -r -- $line
        if [[ $? -ne 0 || -n $TCP_FD_CLOSED ]]; then
          print "Session ${TCP_SESS}: fd $fd unusable." >&2
          unset TCP_FD_CLOSED
          mystat=1
          continue
        fi
        if [[ -n $TCP_OUTPUT ]]; then
          tcp_output -P "$TCP_OUTPUT" -S $TCP_SESS -F $fd -q "${(j. .)*}"
        fi
      done
      [[ -z $cat ]] && break
    done
    
    return $mystat
    PK[
    ueefunctions/_pbmnuW+A#compdef -P (p[bgpn]m*|*top[bgpn]m)
    
    # Completion for all (or most, you'll never know) pbmplus commands.
    # For some of them there are special cases in the biggish `case' below.
    # Note that since this function is a post-pattern function, these
    # defaults can be overridden by simply defining completion functions
    # for those commands whose arguments you want to complete differently.
    
    local pat expl ret=1
    
    if [[ "$service" = pnm* ]]; then
      pat='*.(#i)p[bgp]m(-.)'
    elif [[ "$service" = *top[bgpn]m ]]; then
      pat="*.(#i)${service%%top[bgpn]m}(-.)"
    else
      pat="*.(#i)${service[1,3]}(-.)"
    fi
    
    if (( $# + $+_in_pbm )); then
      _wanted files expl 'picture file' _path_files "$@" -g "$pat" - ||
          _files "$@" "$expl[@]" -g '*.(#i)p[bgp]m(-.)'
      return
    fi
    
    local _in_pbm=yes
    
    case "$service" in
    asciitop[gn]m)
      _arguments \
        '-d[specify divisor]:divisor' \
        ':height' ':width' ':file:_pbm'
      ;;
    
    fitstopgm)
      _arguments \
        '-image[specify image number]:image number' \
        ':file:_pbm'
      ;;
    
    fitstopnm)
      _arguments \
        '-image[specify image number]:image number' \
        '-noraw[produce ASCII pnm file]' \
        '(-min -max)-scanmax[force scanning data for minimum and maximum]' \
        '-printmax[only print minimum and maximum values]' \
        '(-scanmax)-min[override minimum value]:minimum value' \
        '(-scanmax)-max[override maximum value]:maximum value' \
        ':file:_pbm'
      ;;
    
    g3topbm)
      _arguments \
        '-kludge[ignore first few lines]' \
        '-reversebits[interpret bits least-significant first]' \
        '-stretch[duplicate each row]' \
        ':file:_pbm'
      ;;
    
    giftopnm)
      _arguments \
        '-alphaout=[output alpha channel]:file:_pbm' \
        '-verbose[verbose mode]' \
        '-comments[only print comment fields]' \
        '-image[specify image number]:image number' \
        ':file:_pbm'
      ;;
    
    jpegtopnm)
      _arguments \
        '-dct:dct method:(int fast float)' \
        -{nosmooth,adobe,notadobe,dumpexif,comments,verbose} \
        '-maxmemory:memory use limit (kB)' \
        '-exif=:file:_files' \
        '-tracelevel:trace level' \
        ':file:_pbm'
      ;;
    
    macptopbm)
      _arguments '-extraskip:number of bytes to skip' ':file:_pbm'
      ;;
    
    pbmclean)
      if [[ "$PREFIX" = -* ]]; then
        _message -e neighbours 'maximum number of identical neighbours'
      else
        _pbm
      fi
      ;;
    
    pbmmake)
      _arguments \
        '(-black -gray)-white[produce white pbm file]' \
        '(-white -gray)-black[produce black pbm file]' \
        '(-white -black)-gray[produce gray pbm file (stippled)]' \
        ':width' ':height'
      ;;
    
    pbmmask)
      _arguments '-expand[expand mask by one pixel]' ':file:_pbm'
      ;;
    
    pbmpscale)
      _arguments ':scale factor' ':file:_pbm'
      ;;
    
    pbmreduce)
      _arguments \
        '(-fs -threshold)-floyd[use Floyd-Steinberg error diffusion]' \
        '(-floyd -threshold)-fs[use Floyd-Steinberg error diffusion]' \
        '(-floy -fs)-threshold[use simple thresholding]' \
        '-value[specify thresholding value]:threshold value' \
        ':reduction factor' ':file:_pbm'
      ;;
    
    pbmtext)
      _arguments \
        '(-builtin)-font[specify font file]:font file:_files -g "*.(#i)pbm(-.)"' \
        '(-font)-builtin[select builtin font]:builtin font:(bdf fixed)' \
        '-space[add space between characters]:space (pixels)' \
        '*:text'
      ;;
    
    pbmto10x)
      _arguments '-h[use resolution 120 x 144]' ':file:_pbm'
      ;;
    
    pbmtobg|pbmtobbnbg)
      _arguments ':raster operation' ':x position' ':y position'
      ;;
    
    pbmtoepsi)
      _arguments '-bbonly[only create boundary box]' ':file:_pbm'
      ;;
    
    pbmtolj)
      _arguments \
        '-resolution[specify output device resolution]:resolution:(75 100 150 300 600)' \
        '-float[suppress positioning information]' \
        "-norest[don't write reset sequences]" \
        '(-delta -compress)-packbits[enable use of TIFF packbits compression]' \
        '(-packbits -compress)-delta[enable use of delta-between-rows compression]' \
        '(-packbits -delta)-compress[enable both compression schemes]' \
        ':file:_pbm'
      ;;
    
    pbmtoln03)
      _arguments \
        '-l[specify left margin]:left margin' \
        '-r[specify right margin]:right margin' \
        '-t[specify top margin]:top margin' \
        '-b[specify bottom margin]:bottom margin' \
        '-f[specify form length]:form length' ':file:_pbm'
      ;;
    
    pbmtolps)
      _arguments '-dpi[specify output resolution]:resolution' ':file:_pbm'
      ;;
    
    pbmtomacp)
      _arguments \
        '-l[specify left offset]:left offset' \
        '-r[specify right offset]:right offset' \
        '-t[specify top offset]:top offset' \
        '-b[specify bottom offset]:bottom offset' \
        ':file:_pbm'
      ;;
    
    pbmtopgm)
      _arguments ':width' ':height' ':file:_pbm'
      ;;
    
    pbmtopk)
      _arguments \
        '-s[set design size]:design size' \
        '-C[set coding scheme]:coding scheme' \
        '-F[set font family comment]:font family' \
        '-f[specify file with options]:option file:_files' \
        '*-c[specify next character number]:character number' \
        '*-W[specify TFM width of next character]:width' \
        '*-H[specify TFM height of next character]:height' \
        '*-D[specify TFM depth of next character]:depth' \
        '*-I[specify italic correction of next character]:italic correction' \
        '*-h[specify horizontal escapement of next character]:horizontal escapement' \
        '*-v[specify vertical escapement of next character]:vertical escapement' \
        '*-x[specify x offset of next character]:x offset' \
        '*-y[specify y offset of next character]:y offset' \
        ':pk file:_files -g "*.(#i)pk(-.)"' \
        ':tfm file:_files -g "*.(#i)tfm(-.)"' \
        '*:file:_pbm'
      ;;
    
    pbmupc)
      _arguments -s{1,2} ':product type' ':manufacturer code' ':product code'
      ;;
    
    pgmcrater)
      _arguments \
        '-number[specify number of craters]:number of craters' \
        '-gamma[specify gamma correction factor]:gamma factor' \
        '(-ysize)-height[specify picture height]:height' \
        '(-height)-ysize[specify picture height]:height' \
        '(-xsize)-width[specify picture width]:width' \
        '(-width)-xsize[specify picture width]:width'
      ;;
    
    pgmkernel)
      _arguments '-weight:weight' ':width' ':height'
      ;;
    
    pgmnoise)
      _arguments ':width' ':height'
      ;;
    
    pgmnorm|ppmnorm)
      _arguments \
        '(-bvalue)-bpercent[specify percentage to map to black]:black percentage' \
        '(-bpercent)-bvalue[specify pixel value to map to black]:black pixel value' \
        '(-wvalue)-wpercent[specify percentage to map to white]:white percentage' \
        '(-wpercent)-wvalue[specify pixel value to map to white]:white pixel value' \
        ':file:_pbm'
      ;;
    
    pgmoil)
      _arguments '-n[specify smear size]:smear size' ':file:_pbm'
      ;;
    
    pgmramp)
      _arguments \
        '(-tb -rectangle -ellipse)-lr[produce left to right ramp]' \
        '(-lr -rectangle -ellipse)-tb[produce top to bottom ramp]' \
        '(-lr -tb -ellipse)-rectangle[produce rectangular ramp]' \
        '(-lr -tb -rectangle)-ellipse[produce elliptical ramp]' \
        ':width' ':height'
      ;;
    
    pgmtexture)
      _arguments '-d[specify distance]:distance' ':file:_pbm'
      ;;
    
    pgmtopbm)
      _arguments \
        '(-fs -threshold -hilbert -dither8 -d8 -cluster3 -c3 -cluster4 -c4 -cluster8 -c8 -clump)-floyd[use FLoyd-Steinberg error diffusion]' \
        '(-floyd -threshold -hilbert -dither8 -d8 -cluster3 -c3 -cluster4 -c4 -cluster8 -c8 -clump)-fs[use FLoyd-Steinberg error diffusion]' \
        '(-floyd -fs -hilbert -dither8 -d8 -cluster3 -c3 -cluster4 -c4 -cluster8 -c8 -clump)-threshold[use simple thresholding]' \
        '(-floyd -fs -threshold -dither8 -d8 -cluster3 -c3 -cluster4 -c4 -cluster8 -c8 -value)-hilbert[use space filling curve halftoning (hilbert curve)]' \
        '(-floyd -fs -threshold -hilbert -d8 -cluster3 -c3 -cluster4 -c4 -cluster8 -c8 -value -clump)-dither8[use Bayer'"'"'s ordered dither (16 x 16 matrix)]' \
        '(-floyd -fs -threshold -hilbert -dither8 -cluster3 -c3 -cluster4 -c4 -cluster8 -c8 -value -clump)-d8[use Bayer'"'"'s ordered dither (16 x 16 matrix)]' \
        '(-floyd -fs -threshold -hilbert -dither8 -d8 -c3 -cluster4 -c4 -cluster8 -c8 -value -clump)-cluster3[use 45 degree clustered dither]' \
        '(-floyd -fs -threshold -hilbert -dither8 -d8 -cluster3 -cluster4 -c4 -cluster8 -c8 -value -clump)-c3[use 45 degree clustered dither]' \
        '(-floyd -fs -threshold -hilbert -dither8 -d8 -cluster3 -c3 -c4 -cluster8 -c8 -value -clump)-cluster4[use 45 degree clustered dither]' \
        '(-floyd -fs -threshold -hilbert -dither8 -d8 -cluster3 -c3 -cluster4 -cluster8 -c8 -value -clump)-c4[use 45 degree clustered dither]' \
        '(-floyd -fs -threshold -hilbert -dither8 -d8 -cluster3 -c3 -cluster4 -c4 -c8 -value -clump)-cluster8[use 45 degree clustered dither]' \
        '(-floyd -fs -threshold -hilbert -dither8 -d8 -cluster3 -c3 -cluster4 -c4 -cluster8 -value -clump)-c8[use 45 degree clustered dither]' \
        '-value[specify thresholding value]:threshold value' \
        '-clump[specify number of pixels per clump]:number of pixel' \
        ':file:_pbm'
      ;;
    
    pgmtoppm)
      if [[ CURRENT -eq 2 ]]; then
        if compset -P '?*-'; then
          _x_color
          return
        fi
        _x_color && ret=0
    
        _wanted options expl option compadd - -map && ret=0
    
        return ret
      elif [[ CURRENT -eq 3 && "$words[2]" = -map ]]; then
        _description files expl 'map file'
        _files "$expl[@]" -g '*.(#i)ppm(-.)'
      else
        _pbm
      fi
      ;;
    
    pktopbm)
      _arguments \
        '*-x[set width of next bitmap]:width' \
        '*-y[set height of next bitmap]:height' \
        '*-c[set next character number]:character number' \
        ':pk file:_files -g "*.(#i)pk(-.)"' \
        '*:file:_pbm'
      ;;
    
    pngtopnm)
      _arguments \
        -{verbose,alpha,mix,time} \
        '-background:color:_x_color' \
        '-gamma:value' '-text:file:_files' \
        ':file:_pbm'
      ;;
    
    pnmalias)
      _arguments \
        '-bgcolor[specify background color]:background color:_x_color' \
        '-fgcolor[specify background color]:foreground color:_x_color' \
        '(-bonly)-fonly[apply antialias only to foreground pixels]' \
        '(-fonly)-bonly[apply antialias only to background pixels]' \
        '(-balias)-falias[apply antialias to all pixels around foreground pixels]' \
        '(-falias)-balias[apply antialias to all pixels around foreground pixels]' \
        '-weight[set central aliasing weight]:central aliasing weight' \
        ':file:_pbm'
      ;;
    
    pnmarith)
      _arguments \
        '(-)'-{add,subtract,multiply,difference,minimum,maximum} \
        '*:file:_pbm'
      ;;
    
    pnmcat)
      _arguments \
        '(-black)-white[]' \
        '(-white)-black[]' \
        '(-lr -topbottom -tb -jleft -jright)-leftright[place pictures left to right]' \
        '(-leftright -topbottom -tb -jleft -jright)-lr[place pictures left to right]' \
        '(-tb -leftright -lr -jtop -jbottom)-topbottom[place pictures top to bottom]' \
        '(-topbottom -leftright -lr -jtop -jbottom)-tb[place pictures top to bottom]' \
        '(-topbottom -tb -jbottom -jleft -jright)-jtop[align pictures at top]' \
        '(-topbottom -tb -jtop -jleft -jright)-jbottom[align pictures at bottom]' \
        '(-leftright -lr -jright -jtop -jbottom)-jleft[align pictures at left side]' \
        '(-leftright -lr -jleft -jtop -jbottom)-jright[align pictures at right side]' \
        '*:file:_pbm'
      ;;
    
    pnmcomp)
      _arguments \
        '-invert[invert overlay pixel values]' \
        '(-align)-xoff[specify overlay x offset]:x offset' \
        '(-valign)-yoff[specify overlay y offset]:y offset' \
        '(-xoff)-align=[specify horizontal alignment for overlay image]:alignment:(left center right)' \
        '(-yoff)-valign=[specify vertical alignment for overlay image]:alignment:(top middle bottom)' \
        '-alpha[specify alpha mask file]:alpha mask file:_files -g "*.(#i)pgm(-.)"' \
        ':overlay file:_pbm' '*:file:_pbm'
      ;;
    
    pnmconvol)
      _arguments ':convolution file:_pbm' ':file:_pbm'
      ;;
    
    pnmcrop)
      _arguments \
        '(-black)-white' \
        '(-white)-black' \
        -sides \
        -{left,right,top,bottom} \
        -verbose \
        ':file:_pbm'
      ;;
    
    pnmcut)
      _arguments \
        '-left:left col' '-right:right col' '-top:top col' '-bottom:bottom col' \
        '-width:width' '-height:height' -pad -verbose \
        ':x position' ':y position' ':width' ':height' ':file:_pbm'
      ;;
    
    pnmdepth)
      _arguments ':new maximum value' ':file:_pbm'
      ;;
    
    pnmenlarge)
      _arguments ':enlargement factor' ':file:_pbm'
      ;;
    
    pnmflip)
      _arguments \
        \*-{leftright,lr,topbottom,tb,transpose,xy,rotate90,r90,ccw,rotate270,r270,cw,rotate180,r180} \
        ':file:_pbm'
      ;;
    
    pnmgamma)
      _arguments \
        -ungamma -cieramp \
        '1:gamma value or red gamma value' \
        '2: :{ _message -e gamma-values "green gamma value";_pbm }' \
        '3:blue gamma value' \
        '4:file:_pbm'
      ;;
    
    pnmhisteq)
      _arguments \
        '-verbose[verbose mode]' \
        '-gray[modify only gray pixels]' \
        '-rmap[specify input luminosity map file]:luminosity map file:_files -g "*.(#i)pgm(-.)"' \
        '-wmap[specify output luminosity map file]:luminosity map file:_files -g "*.(#i)pgm(-.)"' \
        ':file:_pbm'
      ;;
    pnmhistmap)
      _arguments -{black,white,verbose} '-max:maximum value' ':file:_pbm'
      ;;
    
    pnmindex)
      _arguments \
        '-size[set size of index pictures]:image size' \
        '-across[specify number of pictures per ros]:images per row' \
        '-colors[specify maximum number of colors]:number of colors' \
        '-black[use black padding]' \
        '-title[specify a title to place at the top of the image]:title' \
        '(-noquant)-quant[enable quantization]' \
        '(-quant)-noquant[disable quantization]' \
        '*:file:_pbm'
      ;;
    
    pnmmargin)
      _arguments \
        '(-black -colors)-white' \
        '(-white -colors)-black' \
        '(-white -black)-color:color:_x_color' \
        ':border width' \
        ':file:_pbm'
      ;;
    
    pnmnlfilt)
      _arguments ':alpha value' ':radius' ':file:_pbm'
      ;;
    
    pnmpad)
      _arguments \
        '(-white)-black[add black border]' \
        '(-black)-white[add white border]' \
        '-l-[specify left border width]:left border width' \
        '-r-[specify right border width]:right border width' \
        '-t-[specify top border width]:top border width' \
        '-b-[specify bottom border width]: :_guard "[0-9]#" "bottom border width"' \
        ':file:_pbm'
      ;;
    
    pnmpaste)
      _arguments \
        '(-)'{-replace,-or,-and,-xor} \
        ':"from" picture file:_pbm' \
        :{x,y}' position' \
        ':"into" picture file:_pbm'
      ;;
    
    pnmrotate)
      _arguments '-noantialias' ':rotation angle' ':file:_pbm'
      ;;
    
    pnmscale)
      local -a scale
    
      [[ "$words[2]" = -* ]] || scale=( ':scale factor' )
    
      _arguments \
        '(-)-reduce:reduction factor' \
        '(-reduce -xysize -pixels -width -xscale)-xsize:width' \
        '(-reduce -xysize -pixels -xsize -xscale)-width:width' \
        '(-reduce -xysize -pixels -height -yscale)-ysize:height' \
        '(-reduce -xysize -pixels -ysize -yscale)-height:height' \
        '(-reduce -xysize -pixels -width -xsize)-xscale:horizontal scale factor' \
        '(-reduce -xysize -pixels -height -ysize)-yscale:vertical scale factor' \
        '(-width -xsize -height -ysize -xscale -yscale -pixels)-xysize:width::height' \
        '(-width -xsize -height -ysize -xscale -yscale -xysize)-pixels:total number of pixels' \
        '-verbose' "$scale[@]" \
        ':file:_pbm'
      ;;
    
    pnmshear)
      _arguments '-noantialias' ':shearing angle' ':file:_pbm'
      ;;
    
    pnmtile)
      _arguments ':width' ':height' ':file:_pbm'
      ;;
    
    pnmtoddif)
      _arguments \
        '-resolution:horizontal resolution::vertical resolution' \
        ':file:_pbm' ':ddif file:_files -g "*.(#i)ddif(-.)"'
      ;;
    
    pnmtofits)
      _arguments '-max:maximum value' '-min:minimum value' ':file:_pbm'
      ;;
    
    pnmtojpeg)
      _arguments \
        '--exif=:file:_files' \
        '--quality=:quality' \
        --{grayscale,greyscale,optimize,progressive,verbose,baseline} \
        '--comment=:comment' \
        '--dct=:dct method:(int fast float)' \
        '--restart=:rows' \
        '--smooth=:strength' \
        '--maxmemory=:memory use limit (kB)' \
        '--qtables=:file:_files' \
        '--qslots=:table' \
        '--sample=:sampling factor' \
        '--scans:file:_files' \
        ':file:_pbm'
      ;;
    
    pnmtopng)
      _arguments \
        -{verbose,downscale,interlace,hist,force} \
        '-alpha:file:_files' '-gamma:value' \
        '-transparent::color:_x_color' '-background:color:_x_color' \
        '-chroma:wx::wy::rx::ry::gx::gy::bx::by' \
        '-phys:x::y::unit' \
        '-text:file:_files' '-ztxt:file:_files' \
        '-time:date ([yy]yy-mm-dd)::time (hh:mm:ss)' \
        '-filter:type:((0\:none 1\:sub 2\:up 3\:avg 4\:paeth))' \
        '-compression:level:(0 1 2 3 4 5 6 7 8 9)' \
        ':file:_pbm'
      ;;
    
    pnmtops)
      _arguments \
        '(-noturn)-turn' '(-turn)-noturn' \
        '(-nocenter)-center '(-center)-nocenter \
        '(-rle)-runlength' '(-runlength)-rle' \
        '(-imagewidth -imageheight)-scale:scale factor' \
        '-dpi:output resolution' \
        '(-scale -equalpixels)-imagewidth:width on page (inches)' \
        '(-scale -equalpixels)-imageheight:height on page (inches)' \
        '-width:page width' '-height:page height' \
        '(-imagewidth -imageheight)-equalpixels' \
        ':file:_pbm'
      ;;
    
    pnmtorast)
      _arguments '(-rle)-standard' '(-standard)-rle' ':file:_pbm'
      ;;
    
    pnmtosgi)
      _arguments \
        '(-rle)-verbatim' '(-verbatim)-rle' \
        '-imagename:image name' \
        ':file:_pbm'
      ;;
    
    pnmtotiff)
      _arguments \
        '(-packbits -lzw -g3 -g4 -2d -fill -predictor)-none' \
        '(-none -lzw -g3 -g4 -2d -fill -predictor)-packbits' \
        '(-none -packbits -g3 -g4 -2d -fill -predictor)-lzw' \
        '(-none -packbits -lzw -g4 -predictor)-g3' \
        '(-none -packbits -lzw -g3 -2d -fill -predictor)-g4' \
        '-2d' \
        '-fill' '-minisblack' \
        '(-lsb2msb)-msb2lsb' \
        '(-msb2lsb)-lsb2msb' \
        '-predictor:LZW predictor:((1\:without\ differencing 2\:with\ differencing))' \
        '-rowsperstrip:number of rows per strip' ':file:_pbm'
      ;;
    
    pnmtoxwd)
      _arguments \
        '-pseudodepth:depth of PseudoColor dumps' '-directcolor' \
        ':file:_pbm'
      ;;
    
    ppm3d)
      _arguments :{left,right}' picture file:_pbm' ':horizontal offset'
      ;;
    
    ppmbrighten)
      _arguments \
        '-n[normalize value]' \
        '-s[specify saturation difference]:saturation difference' \
        '-v[specify value difference]:value difference' \
        ':file:_pbm'
      ;;
    
    ppmchange)
      local curcontext="$curcontext" state line
    
      _arguments -C \
        "-closeness[specify how close a pixel's color should be]:closeness (percent)" \
        '-remainder[specify replacement for colours not given explicit replacement]:color:_x_color' \
        '*: :->args' && ret=0
    
      if [[ -n "$state" ]]; then
        if (( CURRENT & 1 )); then
          _wanted colors expl 'new color' _x_color && ret=0
        else
          _alternative \
    	'files:file:_pbm' \
    	'colors:old color:_x_color' && ret=0
        fi
      fi
    
      return ret
      ;;
    
    ppmdim)
      _arguments ':diminishing factor' ':file:_pbm'
      ;;
    
    ppmdist)
      _arguments \
        '(-frequency)-intensity[sort colors by grayscale intensity]' \
        '(-intensity)-frequency[sort colors by frequency]' \
        ':file:_pbm'
      ;;
    
    ppmdither)
      _arguments \
        '-dim:matrix size' \
        '-red:number of red shades' \
        '-green:number of green shades' \
        '-blue:number of blue shades' \
        ':file:_pbm'
      ;;
    
    ppmflash)
      _arguments ':flash factor' ':file:_pbm'
      ;;
    
    ppmforge)
      _arguments \
        -{clouds,night} \
        '-dimension:fractal dimension' '-hour:hour angle' \
        '(-tilt)-inclination:inclination angle' \
        '(-inclination)-tilt:inclination angle' \
        '-mesh:FFT mesh size' '-power:elevations power factor' \
        '-glaciers:glacier elevation' '-ice:polar ice cap extent' \
        '-saturation:star color saturation' \
        '-seed:random number seed' \
        '-stars:minimum star pixel percentage' \
        '(-xsize)-width:width'   '(-width)-xsize:width' \
        '(-ysize)-height:height' '(-height)-ysize:height'
      ;;
    
    ppmmake)
      _arguments ':color:_x_color' ':width' ':height'
      ;;
    
    ppmmix)
      _arguments ':fade factor' ':file:_pbm' ':file:_pbm'
      ;;
    
    ppmntsc)
      _arguments ':dim factor' ':file:_pbm'
      ;;
    
    ppmpat)
      _arguments \
        '(-)'-{gingham{2,3},g{2,3},madras,tartan,poles,squig,camo,anticamo} \
        ':width' ':height'
      ;;
    
    ppmquant)
      local opt=yes
    
      if [[ "$words[2]" = -(fs|floyd) ]]; then
        (( CURRENT-- ))
        shift 1 words
        opt=''
      fi
    
      if [[ CURRENT -eq 2 ]]; then
        if [[ -n "$opt" ]]; then
          _wanted options expl option compadd - -map -fs -floyd && ret=0
        else
          _wanted options expl option compadd - -map && ret=0
        fi
        _message -e numbers 'number of colors'
    
        return ret
      elif [[ CURRENT -eq 3 && "$words[2]" = -map ]]; then
        _description files expl 'map file'
        _files "$expl[@]" -g '*.(#i)ppm(-.)'
      else
        _pbm
      fi
      ;;
    
    ppmquantall)
      _arguments \
        '-ext:extension' ': :_guard "[0-9]#" "number of colors"' \
        '*:file:_pbm'
      ;;
    
    ppmshift)
      _arguments ':shift value' ':file:_pbm'
      ;;
    
    ppmspread)
      _arguments ':maximum spread amount' ':file:_pbm'
      ;;
    
    ppmtoacad)
      _arguments \
        '(-poly)-dxb[write AutoCAD binary database import file]' \
        '(-dxb)-poly[render pixels as filled polygons]' \
        '-8[restrict colors to the 8 RGB shades]' \
        '(-background)-white[use white background]' \
        '(-white)-background:background color (0-255)' \
        '-aspect:pixel aspect ratio' \
        ':file:_pbm'
      ;;
    
    ppmtobmp)
      _arguments \
        '(-windows)-os2' '(-os2)-windows' \
        '-bpp[secify bits per pixel for BMP file]:bits per pixel:(1 4 8 24)' \
        ':file:_pbm'
      ;;
    
    ppmtogif)
      _arguments \
        '-interlace[produce interlaced GIF]' \
        '-sort[produce GIF with sorted color map]' \
        '-map[use colors in specified file]:map file:_files' \
        '(-alpha)-transparent[specify transparent color]:color' \
        '(-transparent)-alpha[specify PGM file containing alpha mask]:file:_pbm' \
        '-comment[include a comment in the GIF file]:comment text' \
        '-nolxw[skip LZW compression]' \
        ':file:_pbm'
      ;;
    
    ppmtoicr)
      _arguments \
        '-windowname:window name' '-expand:expansion factor' \
        '-display:display screen' '-rle' ':file:_pbm'
      ;;
    
    ppmtoilbm)
      _arguments \
        '(-mp -maxplanes)'{-mp,-maxplanes}':planes' \
        '(-fp -fixplanes)'{-fp,-fixplanes}':planes' \
        '(-hambits -hamplanes)'{-hambits,-hamplanes}':planes' \
        -normal -hamif -24if -dcif -hamforce -24force -dcforce \
        '(-dcbits -dcplanes)'{-dcbits,-dcplanes}':bits for red: :bits for green: :bits for blue' \
        -ecs -aga -ham6 -ham8 -compress '-cmethod:method:(none byterun1)' \
        '-map:ppm file:_pbm' -cmaponly -savemem \
        ':file:_pbm'
      ;;
    
    ppmtomap)
      _arguments -s{ort,quare} ':file:_pbm'
      ;;
    
    ppmtomitsu)
      _arguments \
        '-sharpness:sharpness:(1 2 3 4)' \
        '-enlarge:enlargement factor:(1 2 3)' \
        '-media:output media (default\: 1184x1350):((A\:1216x1350 A4\:1184x1452 AS\:1216x1650 A4S\:1184x1754))' \
        '-copy:number of copies:(1 2 3 4 5 6 7 8 9)' \
        -{dpi300,tiny} ':file:_pbm'
      ;;
    
    ppmtopcx)
      _arguments -{24bit,packed} ':file:_pbm'
      ;;
    
    ppmtopj)
      _arguments \
        '-gamma:gamma value' '-xpos:x position' -{rle,center} \
        '-ypos:y position' '-back:background brightness:(dark lite)' \
        '-render:rendering algorithm:(none snap bw dither diffuse monodither monodiffuse clusterdither monoclusterdither)' \
        ':file:_pbm'
      ;;
    
    ppmtopjxl)
      _arguments \
        -{nopack,presentation,dark,diffuse,cluster,dither} \
        '-gamma:gamma value' \
        '-xshift:x shift' '-yshift:y shift' \
        '(-width -xscale)-xscale:width' \
        '(-xsize -xscale)-width:width' \
        '(-xsize -width)-xscale:horizontal scale factor' \
        '(-height -yscale)-ysize:height' \
        '(-ysize -yscale)-height:height' \
        '(-ysize -height)-yscale:vertical scale factor' \
        ':file:_pbm'
      ;;
    
    ppmtosixel)
      _arguments -{raw,margin} ':file:_pbm'
      ;;
    
    ppmtotga)
      _arguments -{mono,cmap,rgb,norle} ':file:_pbm'
      ;;
    
    ppmtouil)
      _arguments '-name:name prefix' ':file:_pbm'
      ;;
    
    ppmtorle)
      _arguments \
        '-name=:name prefix' \
        '-rgb=:X11 rgb file:_files' \
        '-alphamask=:pgm file:_pbm' \
        ':file:_pbm'
      ;;
    
    ppmtoyuvsplit)
      _arguments ':base name' ':file:_pbm'
      ;;
    
    psidtopgm)
      _arguments \
        ':width' ':height' ':bits per sample' \
        ':postscript file:_files -g "*.(#i)(ps|eps)(-.)"'
      ;;
    pstopnm)
      _arguments \
        '(-portrait)-landscape' \
        '(-landscape)-portrait' \
        '(-pgm -ppm)-pbm' \
        '(-pbm -ppm)-pgm' \
        '(-pbm -pgm)-ppm' \
        -{forceplain,help,nocrop,verbose} \
        '-llx:loxer left x position' '-lly:lower left y position' \
        '-urx:upper right x position' '-ury:upper right y position' \
        '-xborder:x border fraction' '-yborder:y border fraction' \
        '-xmax:maximum width' '-ymax:maximum height' \
        '-xsize:width' '-ysize:height' \
        ':postscript file:_files -g "*.(#i)(ps|eps)(-.)"'
      ;;
    
    rawtopgm)
      _arguments \
        '-maxval:value' \
        '-bpp:bytes:(1 2)' \
        -littleendian \
        '(-bt -bottomfirst -rowskip)-'{bt,bottomfirst} \
        '-headerskip:header bytes to skip' \
        '(-bt -bottomfirst)-rowskip:row padding to skip' \
        ': :_guard "[0-9]#" width' ':height' ':grayscale bytes'
      ;;
    
    rawtoppm)
      _arguments \
        '-headerskip:header bytes to skip' \
        '-rowskip:row padding to skip' \
        '(-rgb -rbg -grb -gbr -brg -bgr)'-{rgb,rbg,grb,gbr,brg,bgr} \
        '(-interrow)-interpixel' \
        '(-interpixel)-interrow' \
        ': :_guard "[0-9]#" width' ':height' ':grayscale bytes'
      ;;
    
    rgb3toppm)
      if [[ CURRENT -eq 2 ]]; then
        expl='red picture file'
      elif [[ CURRENT -eq 3 ]]; then
        expl='green picture file'
      elif [[ CURRENT -eq 4 ]]; then
        expl='blue picture file'
      fi
    
      if [[ -n "$expl" ]]; then
        _description files expl "$expl"
        _files "$expl" -g '*.(#i)pgm(-.)'
      fi
      ;;
    
    rletopnm)
      _arguments \
        '--alphaout=:alpha file:_pbm' \
        -{h,-headerdump,v,-verbose,p,-plain} \
        ':file:_pbm'
      ;;
    
    sgitopnm)
      _arguments '-verbose' '-channel:channel' ':file:_pbm'
      ;;
    
    sldtoppm)
      _arguments \
        -{adjust,dir,info,verbose} \
        '(-width -xsize)'-{width,xsize}:width \
        '(-height -ysize)'-{height,ysize}:height \
        '-scale:scale factor' \
        '(-lib -Lib)'-{l,L}'ib:slide name' \
        ':file:_pbm'
      ;;
    
    yuvsplittoppm)
      _arguments ':base name' ':width' ':height' '-ccir601'
      ;;
    
    yuvtoppm)
      _arguments ':width' ':height' ':image bytes'
      ;;
    
    zeisstopnm)
      _arguments '(-pgm -ppm)'-p{g,p}m ':file:_pbm'
      ;;
    
    *)
      _wanted files expl 'picture file' _path_files -g "$pat" ||
          _files "$expl[@]" -g '*.(#i)p[bgp]m(-.)'
    esac
    PK[i&&functions/_dpkg_sourcenuW+A#compdef dpkg-source
    
    _arguments \
      '-x[specify source file]:Debian source file:_files -g "*.dsc(-.)"' \
      '-b[specify source directory]:Debian source directory:_files -/' \
      '-c-[control file]:control file:_files' \
      '-l-[changelog file]:changelog file:_files' \
      '-F-[changelog format]:changelog format:' \
      '-V-[set substitutions variable]:expression:' \
      '-T-[alternate variable file]:varlistfile:' \
      '-D-[override dsc field]:expression:' \
      '-U-[remove a field]:field:' \
      '-i-[ignore files in diff]:filter:' \
      '-sa[autoselect orig source]' \
      '-sk[use packaged orig source - unpack and keep]' \
      '-sp[use packaged orig source - unpack and remove]' \
      '-su[use unpackaged orig source - unpack and keep]' \
      '-sr[use unpackaged orig source - unpack and remove]' \
      '-ss[trust packed and unpacked source are the same]' \
      '-sn[no diff, do main tarfile only]' \
      '-sA[autoselect orig source with overwrite]' \
      '-sK[use packaged orig source - unpack and keep with overwrite]' \
      '-sP[use packaged orig source - unpack and remove with overwrite]' \
      '-sU[use unpackaged orig source - unpack and keep with overwrite]' \
      '-sR[use unpackaged orig source - unpack and remove with overwrite]' \
      '-sp[leave original source packed in cwd]' \
      '-su[unpack original source tree too]' \
      '-h[help]'
    PK[I&&functions/_bittorrentnuW+A#compdef btdownloadcurses btdownloadheadless btdownloadgui btlaunchmany btlaunchmanycurses bttrack btshowmetainfo btreannounce btmakemetafile btrename
    
    # Bittorrent completion commands. Originally written by Jussi
    # Pakkanen, 2004. Most of the command descriptions are from the Debian
    # project's man pages.
    
    # Modified by R.Ramkumar, 2006 to conform to zsh completion standards and
    # enhance completion for certain options.
    
    case $service in
    
    # Start with the clients.
    
     btdownloadcurses)
       ;&
     btdownloadheadless)
       ;&
     btdownloadgui)
       ;&
     btlaunchmany)
       ;&
     btlaunchmanycurses)
      _arguments -s -S \
          '(--responsefile)--responsefile+[specify file for server response]:file:_files -g "*"'\
          "--url+[specify URL of torrent file]:URL:_urls"\
          '(-i --ip)'{-i+,--ip+}'[specify ip address to report as]:ip address'\
          "--bind+[specify ip to bind to instead of default]:ip:_bind_addresses"\
          "--minport+[specify minimum port to listen to]:port:"\
          "--maxport+[specify maximum port to listen to]:port:"\
          "--saveas+[specify file to save to]:file:_files -/"\
          "--max_uploads+[specify maximum amount of uploads]:uploads:"\
          "--max_upload_rate+[specify maximum upload rate]:rate (kb):"\
          "--keepalive_interval+[specify pause between keepalives]:time (s):"\
          "--download_slice_size+[specify bytes to query per request]:size (b):"\
          "--request_backlog+[specify number of requests to keep in a single pipe]:requests:"\
          "--max_message_length+[specify maximum length of prefix encoding]:size (b):"\
          "--timeout+[specify timeout before closing sockets on receiving nothing]:timeout (s):"\
          "--timeout_check_interval+[specify interval to check for connection time]:time interval (s):"\
          "--max_slice_length+[specify maximum size of requests accepted from peers]:size (b):"\
          "--max_rate_recalculate_interval+[specify length of pauses leading to reduced rate]:time (s):"\
          "--max_rate_period+[specify maximum time taken to guess the current rate estimate]:time (s):"\
          "--upload_rate_fudge+[specify time equivalent of writing to kernel TCP buffer]:time (s):"\
          "--display_interval+[specify time between updates to displayed information]:time (s):"\
          "--rerequest_interval+[specify time between requests for more peers]:time (s)"\
          "--min_peers+[specify peers needed before stopping or delaying requests for peers]:peers:"\
          "--http_timeout+[specify timeout for http connections]:timeout (s):"\
          "--snub_time+[specify timeout to decide that connection is semi-permanently choked]:timeout (s):"\
          "--spew+[display diagnostic info to stdout]:enable:(0 1)"\
          "--check_hashes+[check hashes on disk]:enable:(0 1)"\
          "--max_initiate+[specify peers needed before stopping initiating new connections]:peers:"\
          "--report_hash_failures+[report hash failures to user]:enable:(0 1)"\
          "--rarest_first_priority_cutoff+[specify peers which need to have a piece before other partials take priority over rarest first]:peers:"\
          ':torrent file:_files -g "*.torrent"' \
          && return 0
      ;;
    
    # Next up are the torrent file manipulation programs.
    
      btshowmetainfo)
       _files -g "*.torrent" && return 0
       ;;
    
      btrename)
       _files -g '*.torrent' && return 0
      ;;
    
      btmakemetafile)
        _arguments -s -S \
          '--piece_size_pow2+[specify power of 2 to set the piece size to]:power:' \
          "--comment+[specify human-readable comment to put in .torrent]:comment:"\
          "--target+[specify target file for the torrent]:file:_files"\
          ':file:_files -g "*"' \
          && return 0;
      ;;
    
      btreannounce)
       _files -g '*.torrent' && return 0
      ;;
    
    # Lastly the tracker.
    
      bttrack)
        _arguments -s -S \
          "--port+[specify port to listen on]:port number:" \
          "--dfile+[specify file to store recent downloader info]:file:_files" \
          "--bind+[specify ip to bind to]:bind address:_bind_addresses" \
          "--socket_timeout+[specify timeout for closing connections]:timeout (s):"\
          "--save_dfile_interval+[specify interval between saving dfile]:time (s):"\
          "--timeout_downloaders_interval+[timeout for expiring downloaders]:time (s):" \
          "--reannounce_interval+[specify interval downloaders should wait between reannouncements]:time (s):" \
          "--response_size+[specify peers to send in an info message]:peers:" \
          "--timeout_check_interval+[specify connection timeout]:timeout (s):"\
          "--nat_check=[check back and ban downloaders behind NAT]:enable:(0 1)" \
          "--min_time_between_log_flushes+[specify minimum time between log flushes]:time (s):" \
          "--allowed_dir+[specify directory having downloadable torrents]:directory:_files -/" \
          "--parse_allowed_interval+[specify interval between reloading allowed_dir]:time (min):" \
          "--show_names+[display names from allowed dir]:enable:(0 1)"\
          && return 0
        ;;
    esac
    PK[蘜 functions/_complete_help_genericnuW+A#autoload
    
    # Note this is a normal ZLE widget, not a completion widget.
    # A completion widget can't call another widget, while a normal
    # widget can.
    
    [[ $WIDGET = *noread* ]] || local ZSH_TRACE_GENERIC_WIDGET
    
    if [[ $WIDGET = *debug* ]]; then
      ZSH_TRACE_GENERIC_WIDGET=_complete_debug
    else
      ZSH_TRACE_GENERIC_WIDGET=_complete_help
    fi
    
    if [[ $WIDGET != *noread* ]]; then
      zle read-command && zle $REPLY -w
    fi
    PK[S;;functions/getjobsnuW+A# Call this from the preexec function like so:
    #   preexec() {
    #	  getjobs "${(z)2}"  # Use "${(z)1}" prior to zsh-4.0.1
    #   }
    setopt localoptions noshwordsplit noksharrays
    local texts
    case $1 in
        fg|bg) shift; [[ -n $1 ]] || set -- %% ;;
        %*) ;;
        *) return 0 ;;
    esac
    repeat $#
    do
        # This case statement emulates jobs.c:getjob()
        case $1 in
    	[\;\&\|]|\|\||\&\&) break ;;
    	%(|[%+])) 1=${(k)jobstates[(r)*:+:*]} ;;
    	%-) 1=${(k)jobstates[(r)*:-:*]} ;;
    	%<->) 1=${1#%} ;;
    	%[?]*) 1=${${(Ok)jobtexts[(R)*${1#%[?]}*]}[1]} ;;
    	*) 1=${${(Ok)jobtexts[(R)$1*]}[1]} ;;
        esac
        [[ -n $1 ]] && texts=($texts ${jobtexts[$1]})
        shift
    done
    # Remove the "-s" below if you'd prefer that this just report
    # what jobs are being affected rather than modify the history
    (( $#texts )) && print -s ${(j:; :)texts} "$*"
    return 0
    PK[D		functions/_monotonenuW+A#compdef mtn
    
    local context state line ret
    typeset -a cmds
    typeset -A opt_args
    
    _arguments \
      '--brief[print a brief version of the normal output]' \
      '--confdir[set location of configuration directory]:confdir:_files -/' \
      '(-d --db)'{-d,--db}'[set name of database]:dbname' \
      '--debug[print debug log to stderr while running]' \
      '--dump[file to dump debugging log to, on failure]:dumpfile:_files' \
      '--full-version[print detailed version number, then exit]' \
      '(-h --help)'{-h,--help}'[display help message]' \
      '(-k --key)'{-k,--key}'[set key for signatures]:key:' \
      '--keydir[set location of key store]:keydir:_files -/' \
      '--log[file to write the log to]:logfile:_files' \
      '--norc[do not load ~/.monotone/monotonerc or _MTN/monotonerc lua files]' \
      '--nostd[do not load standard lua hooks]' \
      '--pid-file[record process id of server]:arg:' \
      '--quiet[suppress verbose, informational and progress messages]' \
      '--rcfile[load extra rc file]:extra rcfile:_files' \
      '--reallyquiet[suppress warning, verbose, informational and progress messages]' \
      '--root[limit search for workspace to specified root]:root:_files -/' \
      '--ticker[set ticker style]:ticker style:(count dot none)' \
      '--version[print version number, then exit]' \
      '(-@ --xargs)'{-@,--xargs}'[insert command line arguments taken from the given file]:file:_files' \
      '*:command:->cmd' && return 0
    
    case "$state" in
      (cmd)
      if (( CURRENT == 2 )); then
        cmds=(automate:automation db:database fdiff:debug fload:debug fmerge:debug get_roster:debug identify:debug rcs_import:debug annotate:informative cat:informative complete:informative diff:informative help:informative list:informative log:informative ls:informative show_conflicts:informative status:informative cert:key+cert chkeypass:key+cert dropkey:key+cert genkey:key+cert trusted:key+cert pull:network push:network serve:network sync:network privkey:packet\ i/o pubkey:packet\ i/o read:packet\ i/o cvs_import:rcs approve:review comment:review disapprove:review tag:review testresult:review checkout:tree co:tree explicit_merge:tree heads:tree merge:tree merge_into_dir:tree migrate_workspace:tree propagate:tree refresh_inodeprints:tree setup:tree set:vars unset:vars add:workspace attr:workspace ci:workspace commit:workspace drop:workspace mv:workspace pivot_root:workspace pluck:workspace rename:workspace revert:workspace rm:workspace update:workspace)
        _describe -t commands 'cmds' cmds && ret=0
      else
        _files
      fi
      ;;
    esac
    
    return ret
    PK[;33functions/_gpgnuW+A#compdef gpg gpgv gpg-zip
    
    local curcontext="$curcontext" state line expl ret=1
    local -a gpgbasic gpgextra gpgv gpgzip
    typeset -A opt_args
    
    gpgv=('(-q --quiet)*'{-v,--verbose}'[increase amount of output]'
      '(-q --quiet -v --verbose)'{-q,--quiet}'[reduce amount of output]'
      '--keyring=[add specified file to list of keyrings]:file:_files'
      '--'{status,logger}'-fd:file descriptor:_file_descriptors'
      '--ignore-time-conflict'
      '--homedir:directory:_directories')
    
    gpgzip=('--gpg[command to use instead of gpg]:command:_command'
      '--gpg-args[gpg arguments]:gpg arguments:'
      '--tar[command to use instead of tar]:command:_command'
      '--tar-args[tar arguments]:tar arguments:'
      '--list-archive[list archive contents]')
    
    gpgbasic=('(-e --encrypt)'{-e,--encrypt}'[encrypt data. this option may be combined  with --sign]'
      {-d,--decrypt}'[decrypt file or stdin]'
      '(-c --symmetric)'{-c,--symmetric}'[encrypt with symmetric cypher only]'
      '(-s --sign)'{-s,--sign}'[make a signature]'
      '*'{-r+,--recipient}'[specify user to encrypt for]:recipient:->public-keys'
      '(-u --local-user)'{-u+,--local-user}'[use name as the user ID to sign]:user attachment:_users'\
      '(-o --output)'{-o+,--output}'[write output to file]:output file:_files'
      '(-h --help)'{-h,--help}'[display usage information]'
      '--version[print info on program version and supported algorithms]')
    
    gpgextra=('--decrypt-files[decrypt multiple files]'
      '(-b --detach-sign)'{-b,--detach-sign}'[make a detached signature]'
      '--clearsign[make a clear text signature]'
      '--store[store only]'
      '--verify[verify a signature]'
      '--verify-files[verify a list of files]'
      '(-f --encrypt-files)'{-f,--encrypt-files}'[encrypt 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:->public-keys'
      '--list-options[modify what the various --list-* commands show]'
      '--check-sigs[list key, signatures and check them]:key attachment:->public-keys'
      '--fingerprint[list all keys with their fingerprints]:key attachment:->public-keys'
      '--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:->public-keys'
      '--sign-key[sign a key]:key attachment:->public-keys'\
      '--lsign-key[sign a key but mark as non-exportable]:key attachment:->public-keys'
      '--nrsign-key[sign a key non-revocably]'
      '--delete-key[remove key from public keyring]:key attachment:->public-keys'
      '--delete-secret-key[remove key from public & private keyring]:key attachment:->secret-keys'
      '--delete-secret-and-public-key:key attachment:->secret-keys'
      '--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:->public-keyids'
      '--export-all[export all key and not OpenPGP compatible keys]'
      '--export-secret-keys:key attachment:->secret-keys'
      '--export-secret-subkeys:key attachment:->secret-keys'
      '--import[import a gpg key from a file]:_files attachment:_files'
      '--fast-import[import a file without build trustdb]:_files attachment:_files'
      '--fetch-keys[fetch key at URIs]:uri:'
      '--recv-keys[receive a list of keys from a keyserver]:key attachment:->public-keyids'
      '--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'
      '--warranty[print warranty info]'
      '(-a --armor)'{-a,--armor}'[create ASCII armored output]'
      '--default-key[specify default user-id for signatures]:key:->secret-keys'
      '--default-recipient[specify default recipient]:recipient:->public-keys'
      '--default-recipient-self[use default key as default recipient]'
      '--no-default-recipient[reset default recipient]'
      '*--encrypt-to[specify recipient]:key:->public-keys'
      '(--encrypt-to)--no-encrypt-to[disable the use of all --encrypt-to keys]'
      '(-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]'
      '--secret-keyring[add specified file to list of secret keyrings]:file:_files'
      '--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]"
      '--'{attribute,passphrase,command}'-fd:file descriptor:_file_descriptors'
      '--sk-comments[include secret key comments when exporting keys]'
      '(--emit-version)--no-emit-version[omit version string in clear text signatures]'
      '(--no-emit-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' '--'{,no-}'escape-from-lines' '--'{,no-}'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-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'
      '--card-edit[present smartcard menu]' '--card-status[show smartcard content]'
      '--change-pin[present menu to change smartcard pin]'
      '--list-config[display internal configuration parameters]'
      '--hidden-recipient[hidden recipient]:recipient:->public-keys'
      '--dump-options[show all options]' '--default-preference-list:string'
      '--fetch-keys:URIs:' '--gpgconf-list' '--gpgconf-test'
      '--hidden-encrypt-to:recipient:->public-keys'
      '--compress-level:integer:'
      '--bzip2-compress-level:integer:' '--bzip2-decompress-lowmem'
      '--default-sig-expire' '--default-cert-expire' '--no-ask-cert-expire'
      '--default-cert-level:integer:'
      '--min-cert-level' '--ask-cert-level' '--no-ask-cert-level'
      '--max-output[maximum output generated when processing file]:bytes:'
      '--gpg-agent-info[override GPG_AGENT_INFO]:'
      '--primary-keyring:file:_files'
      '--'{,no-}'verify-options:parameters:_multi_parts -q -S, ","
        "(show-photos show-policy-urls show-notations show-std-notations
        show-user-notations show-keyserver-urls show-uid-validity show-unusable-uids
        show-primary-uid-only pka-lookups pka-trust-increase)"'
      '--debug:flags:' '--debug-all' '--status-file:file:'
      '--attribute-file:file:' '--load-extension:file:_files'
      '--gnupg' '--rfc2440' '--rfc4880' '--pgp8'
      '--s2k-count:integer:' '--'{,no-}'throw-keyids'
      '--sig-notation:name=value:' '--cert-notation:name=value:'
      '--passphrase-file:file:_files' '--passphrase-repeat:integer:'
      '--command-file:file:_files' '--trustdb-name:file:_files'
      '--'{,no-}'require-secmem'
      '--trust-model:trust model:((pgp classic direct always auto))'
      '--sig-policy-url:string:' '--cert-policy-url:string:'
      '--sig-keyserver-url:string:' '--comment[comment]:comment:'
      '--no-comments[disable comments]'
      '--logger-file[write log to file]:file:_files'
      '--'{,no-}'use-embedded-filename'
      '--rebuild-keydb-caches[create signature caches in keyring]'
      '--default-keyserver-url:name:'
      '--display-charset[set native charset]:charset:((iso-8859-1 iso-8859-2 iso-8859-15 koi8-r utf-8))'
      '--ungroup[remove group]:group name:'
      '--no-groups[remove all entries from --group list]'
      '--'{,no}'mangle-dos-filenames'
      '--enable-progress-filter[enable progress status output]'
      '--multifile[process multiple files]'
      '--keyid-format[key id format]:key format:((short 0xshort long 0xlong))'
      '--exit-on-status-write-error[exit immediately on error write]'
      '--limit-card-insert-tries:integer:'
      '--reader-port[card reader port]:port:'
      '--ctapi-driver[file to use to access smartcard reader]:file:_files'
      '--pcsc-driver[file to use to access smartcard reader]:file:_files'
      '--disable-ccid' '--debug-ccid-driver'
      '--'{enable,disable}'-dsa2'
      '--'{,no-}'allow-multiple-messages' '--'{,no-}'require-cross-certification'
      '--auto-key-locate:parameters:' '--no-auto-key-locate'
      '--dump-options[show all options]')
    
    case "$service" in
      gpg)
        _arguments -C -s -S -A "-*" $gpgbasic $gpgextra $gpgv '*:args:->args'
        ;;
    
      gpgv)
        _arguments -C -s -S -A "-*" $gpgv '*:args:->args'
        ;;
    
      gpg-zip)
        _arguments -C -s -S -A "-*" $gpgbasic $gpgzip '*:args:->args'
        ;;
    esac
    
    if [[ $state = args ]]; then
      if (( ${+opt_args[--export]} || ${+opt_args[--list-keys]} || ${+opt_args[--list-public-keys]} )); then
        state=public-keys
      elif (( ${+opt_args[--list-secret-keys]} )); then
        state=secret-keys
      else
        _files && return
      fi
    fi
    
    # We need to keep some arguments to get a consistent list of keys
    # etc.
    local -a needed
    integer krind=${words[(I)--keyring(|=*)]}
    needed=(${words[(r)--no-default-keyring]})
    if (( krind )); then
      # We have a --keyring option.  We can't be completing its
      # argument because that was handled above, so it must be complete.
      if [[ $words[krind] = --keyring ]]; then
        if [[ -n $words[krind+1] ]]; then
          needed+=(--keyring=$words[krind+1])
        fi
      else
        needed+=($words[krind])
      fi
    fi
    
    case "$state" in
      public-keys)
        _wanted public-keys expl 'public key' \
    	compadd ${${(Mo)$(_call_program public-keys gpg $needed --list-public-keys --list-options no-show-photos 2>/dev/null):%<*>}//(<|>)/} && return
      ;;
      secret-keys)
        _wanted secret-keys expl 'secret key' compadd \
    	${${(Mo)$(_call_program secret-keys gpg $needed --list-secret-keys --list-options no-show-photos 2>/dev/null):%<*>}//(<|>)/} && return
      ;;
      ciphers)
        _wanted ciphers expl cipher compadd \
            ${${(s.,.)${(M)${(f)"$(_call_program ciphers gpg $needed --version)"}:#Cipher*}#*:}# } && return
      ;;
      (public-keyids)
        _wanted public-keys expl 'public keyid' \
    	compadd ${${${(M)${(f)"$(_call_program public-keyids gpg $needed --list-public-keys --list-options no-show-photos 2>/dev/null)"}:%pub*}#pub */}%% *} && return
      ;;
    esac
    
    return ret
    PK[
    ~kfunctions/_configurenuW+A#compdef configure config.status
    
    _arguments -- -i '(--(disable|enable)-FEATURE* --(with|without)-PACKAGE*)' \
                  -s '((#s)--disable- --enable-
    	           (#s)--enable- --disable-
    		   (#s)--with- --without-
    		   (#s)--without- --with-)' \
    	      '*=(E|)PREFIX*:prefix directory:_files -/' \
                  '*=PROGRAM*:program:_command_names -e' \
    	      '*=NAME*executable*:program:_command_names -e' \
    	      '*=NAME*:file:_files'
    PK[_EEfunctions/VCS_INFO_detect_cvsnuW+A## vim:ft=zsh
    ## cvs support by: Frank Terbeck 
    ## Distributed under the same BSD-ish license as zsh itself.
    
    setopt localoptions NO_shwordsplit
    
    [[ $1 == '--flavours' ]] && return 1
    
    VCS_INFO_check_com ${vcs_comm[cmd]} || return 1
    [[ -d "./CVS" ]] && [[ -r "./CVS/Repository" ]] && return 0
    return 1
    PK[[77functions/_xscreensavernuW+A#compdef xscreensaver-command
    
    _arguments \
      '-demo[ask the xscreensaver process to enter interactive demo mode]' \
      '-prefs[ask the xscreensaver process to bring up the preferences panel]' \
      '-activate[turn on the screensaver]' \
      '-deactivate[turn off the screensaver]' \
      '-cycle[stop the current graphics demo and run a new one]' \
      '-next' \
      '-prev' \
      '-select[but runs the Nth element in the list of hacks]:element number:' \
      '-exit[causes the xscreensaver process to exit gracefully]' \
      '-restart[restart the screensaver process]' \
      '-lock[lock the screen immediately]' \
      '-version[prints the version of xscreensaver that is currently running]' \
      '-time[prints the time at which the screensaver last activated or deactivated]' \
      '-watch[prints a line each time the screensaver changes state]'
    PK[I\llfunctions/zfsessionnuW+A# function zfsession {
    # Change or list the sessions for the current zftp connection.
    
    emulate -L zsh
    
    [[ $curcontext = :zf* ]] || local curcontext=:zfsession
    local opt opt_l opt_v opt_o opt_d hadopts
    
    while getopts ":lovd" opt; do
      [[ $opt = "?" ]] && print "zfsession: bad option: -$OPTARG" >&2 && return 1
      eval "opt_$opt=1"
      hadopts=1
    done
    (( OPTIND > 1 )) && shift $(( OPTIND - 1 ))
    
    if [[ $# -gt 1 || (( -n $hadopts && -z $opt_d ) && $# -gt 0 ) ]]
    then
      print "Usage: zfsession ( [ -lvod ] | session )" 1>&2
      return 1
    fi
    
    if [[ -n $opt_v ]]; then
      local sess
      for sess in $(zftp session); do
        print -n "${(r.15.. ..:.)sess}\t${zfconfig[lastloc_$sess]:-not connected}"
        if [[ $sess = $ZFTP_SESSION ]]; then
          print " *"
        else
          print
        fi
      done
    elif [[ -n $opt_l ]]; then
      zftp session
    fi
    
    if [[ -n $opt_o ]]; then
      if [[ $zfconfig[lastsession] != $ZFTP_SESSION ]]; then
        local cursession=$ZFTP_SESSION
        zftp session $zfconfig[lastsession]
        zfconfig[lastsession]=$cursession
        print $ZFTP_SESSION
      else
        print "zfsession: no previous session." >&2
        return 1
      fi
    fi
    
    if [[ -n $opt_d ]]; then
      local del=${1:-$ZFTP_SESSION} key
      key=${zfconfig[fcache_$del]}
      [[ -n $key ]] && unset $key
      for key in fcache lastloc lastdir curdir otherdir otherargs lastuser; do
        unset "zfconfig[${key}_${del}]"
      done
      zftp rmsession $del
      return
    fi
    
    [[ -n $hadopts ]] && return $stat
    
    if [[ $# = 0 ]]; then
      print $ZFTP_SESSION
      return
    fi
    
    local oldsession=${ZFTP_SESSION:-default}
    zftp session $1
    if [[ $ZFTP_SESSION != $oldsession ]]; then
      zfconfig[lastsession]=$oldsession
      zftp_chpwd
    fi
    # }
    PK[
    cBqqfunctions/_cvsnuW+A#compdef cvs
    
    # redefine _cvs.
    
    _cvs() {
      local extra
    
      # "+Qqrwtnlvb:T:e:d:Hfz:s:xa"
    
      _arguments -s \
        '-R[read only access]' \
        '-a[authenticate]' \
        '-f[disable .cvsrc]' \
        '(-n)-l[disable logging]' \
        '(-l)-n[no change]' \
        '(-q)-Q[really quiet]' \
        '(-Q)-q[somewhat quiet]' \
        '(-w)-r[make new working file read only]' \
        '-t[trace]' \
        '(-r)-w[make new working file read-write]' \
        '-x[encrypt client/server communication]' \
        '(-)'{-v,--version}'[print version and copyright information]' \
        '(-)'{-H,--help}'[print help information]' \
        '(-)--help-commands[command help]' \
        '(-)--help-synonyms[command synonyms help]' \
        '(-)--help-options[global options help]' \
        '*--allow-root=[allowable root for pserver]:rootdir:_files -/' \
        '-T+[temporary directory]:temporary directory:_cvs_tempdir' \
        '-d+[cvs root directory]:cvsroot:_cvs_root' \
        '-e+[editor]:editor:_cvs_editor' \
        '-s+[user variable]:user variable:_cvs_user_variable' \
        '-z+[gzip level]:gzip level:(0 1 2 3 4 5 6 7 8 9)' \
        '*::cvs command:_cvs_command'
    }
    
    # define cvs command dispatch function.
    
    (( $+functions[_cvs_command] )) ||
    _cvs_command() {
      local cmd cvsroot="$CVSROOT" ret=1
      [[ -f CVS/Root ]] && cvsroot="$(&1)"}[2,-2]/(#b) #([a-z]#)   #([a-z]#) ([a-z]#)/$match[1] $match[2]:$match[3]} )
      fi
    
      (( $+_cvs_cmds )) || _cvs_cmds=(
        ${${(f)"$(_call_program commands cvs --help-commands 2>&1)"}[2,-2]/(#b) #([a-z]##) #([A-Z])/$match[1]:${match[2]:l}}
      )
    
      if (( CURRENT == 1 )); then
        _describe -t commands 'cvs command' _cvs_cmds || compadd "$@" - ${(s.:.)${(j.:.)_cvs_syns}}
      else
        local curcontext="$curcontext"
    
        cmd="${${_cvs_cmds[(r)$words[1]:*]%%:*}:-${(k)_cvs_syns[(r)(*:|)$words[1](:*|)]}}"
        if (( $#cmd )); then
          curcontext="${curcontext%:*:*}:cvs-${cmd}:"
          _call_function ret _cvs_$cmd || _message 'no more arguments'
        else
          _message "unknown cvs command: $words[1]"
        fi
        return ret
      fi
    }
    
    # define completion functions for each cvs command
    
    (( $+functions[_cvs_add] )) ||
    _cvs_add() {
      # "+k:m:"
      _arguments -s \
        '-k+[keyword]:keyword substitution:_cvs_k' \
        '-m+[message]:message:_cvs_m' \
        '*:added file:_cvs_files_unmaintained' \
    }
    
    (( $+functions[_cvs_admin] )) ||
    _cvs_admin() {
      # "+ib::c:a:A:e::l::u::LUn:N:m:o:s:t::IqxV:k:"
      _arguments -s \
        -{i,x} \
        '(-U)-L[set lock strict]' \
        '(-L)-U[set locl non-strict]' \
        '-I[interactive]' \
        '-q[quiet]' \
        '-b-[default branch]:default branch:(1.1.1)' \
        '-c+:comment leader (not used)' \
        '-a+:login names (not work with CVS)' \
        '-A+:access list to append (not work with CVS)' \
        '-e-:access list to erase (not work with CVS)' \
        '-l-[lock]:revision to lock' \
        '-u-[unlock]:revision to unlock' \
        '-n+[name revision]:symbolic-name(\:revision)' \
        '-N+[force to name revision]:symbolic-name(\:revision)' \
        '-m+[replace log]:revision\:msg' \
        '-o+[delete revision]:range to delete' \
        '-s+[replace state attribute]:state(\:revision)' \
        '-t-[replace descriptive text]:descriptive text:_cvs_admin_t' \
        '-V+:version (obsolete)' \
        '-k+[set keyword substitution]:keyword substitution:_cvs_k' \
        '*:file:_cvs_files'
    }
    
    (( $+functions[_cvs_admin_t] )) ||
    _cvs_admin_t() {
      if compset -P -; then
        _message -e descriptions 'descriptive text'
      else
        _files "$@"
      fi
    }
    
    (( $+functions[_cvs_annotate] )) ||
    _cvs_annotate() {
      # "+lr:D:fR"
      _arguments -s \
        "(-R)-l[don't recurse]" \
        '-f[use head revision]' \
        '(-l)-R[recursive]' \
        '(-f -D)-r+[specify revision]:tag:_cvs_revisions' \
        '(-f -r)-D+[specify date]:date:_cvs_D' \
        '*:file:_cvs_files'
    }
    
    (( $+functions[_cvs_rannotate] )) ||
    _cvs_rannotate() {
      # "+lr:D:fR"
      _arguments -s \
        "(-R)-l[don't recurse]" \
        '-f[use head revision]' \
        '(-l)-R[recursive]' \
        '(-f -D)-r+[specify revision]:tag:_cvs_revisions' \
        '(-f -r)-D+[specify date]:date:_cvs_D' \
        '*:file:_cvs_modules'
    }
    
    (( $+functions[_cvs_checkout] )) ||
    _cvs_checkout() {
      # "+ANnk:d:flRpQqcsr:D:j:P"
      _arguments -s \
        '-N[don'\''t shorten module paths]' \
        '-A[reset sticky tags, dates and -k]' \
        '-n[disable checkout program]' \
        '-f[use most recent revision if -D/-r is not matched]' \
        "(-R)-l[don't recurse]" \
        '(-l)-R[recursive]' \
        '(-s)-c[module database]' \
        '(-c)-s[module database with status]' \
        '-P[prune empty directory]' \
        '-k+[keyword]:keyword substitution:_cvs_k' \
        '-d+[directory]:directory:_files -/' \
        '(-D)-r+[specify revision]:tag:_cvs_revisions' \
        '(-r)-D+[specify date]:date:_cvs_D' \
        '-j+[merge]:tag:_cvs_revisions' \
        '*:module:_cvs_modules'
    }
    
    (( $+functions[_cvs_commit] )) ||
    _cvs_commit() {
      # "+nlRm:fF:r:"
      _arguments -s \
        '-n[disable module program]' \
        "(-R)-l[don't recurse]" \
        '(-l)-R[recursive]' \
        '-f[force to commit]' \
        '(-F)-m+[message]:message:_cvs_m' \
        '(-m)-F+[message file]:log message file:_files' \
        '-r+[specify revision]:tag:_cvs_revisions' \
        '*:modified file:_cvs_commit_arg'
    }
    
    (( $+functions[_cvs_commit_arg] )) ||
    _cvs_commit_arg() {
      if (( $+opt_args[-f] )); then
        _cvs_files
      else
        _cvs_files_modified
      fi
    }
    
    (( $+functions[_cvs_diff] )) ||
    _cvs_diff() {
      local of ofwuc ouc oss ofwy ofwg ofwl
      # output formats
      of="-y --side-by-side -n --rcs -e -f --ed -q --brief -c -C --context -u -U \
      --unified --old-group-format --new-group-format --changed-group-format \
      --unchanged-group-format --line-format --old-line-format --new-line-format \
      --unchanged-line-format"
    
      # output formats w/o unified and context
      ofwuc="-y --side-by-side -n --rcs -e -f --ed -q --brief --old-group-format \
      --new-group-format --changed-group-format --unchanged-group-format \
      --line-format --old-line-format --new-line-format --unchanged-line-format"
    
      # option specific to unified or context diff
      ouc='-L --label -p --show-c-function -F --show-function-line'
    
      # option specific to side by side
      oss='-W --width --left-column --suppress-common-lines'
    
      # output formats w/o side by side
      ofwy="-n --rcs -e -f --ed -q --brief -c -C --context -u -U --unified \
      --old-group-format --new-group-format --changed-group-format \
      --unchanged-group-format --line-format --old-line-format \
      --new-line-format --unchanged-line-format"
    
      # output formats w/o group format
      ofwg="-n --rcs -e -f --ed -q --brief -c -C --context -u -U --unified \
      --line-format --old-line-format --new-line-format --unchanged-line-format"
    
      # output formats w/o line format
      ofwl="-n --rcs -e -f --ed -q --brief -c -C --context -u -U --unified \
      --old-group-format --new-group-format --changed-group-format \
      --unchanged-group-format"
    
      # "+abcdefhilnpstuw0123456789BHNRC:D:F:I:L:U:V:W:k:r:"
      _arguments -s \
        "(-R)-l[don't recurse]" \
        '(-l)-R[recursive]' \
        '-k+[keyword]:keyword substitution:_cvs_k' \
        {,}'(-r)-D+[specify date]:date:_cvs_D' \
        {,}'(-D)-r+[specify revision]:tag:_cvs_revisions' \
        -{h,0,1,2,3,4,5,6,7,8,9} \
        '--binary[binary mode]' \
        '--ifdef=[set macro name for merged if-then-else format]:name' \
        '(-i --ignore-case)'{-i,--ignore-case}'[case insensitive]' \
        '(-w --ignore-all-space)'{-w,--ignore-all-space}'[ignore all white space]' \
        '(-b --ignore-space-change)'{-b,--ignore-space-change}'[ignore changes in the amount of white space]' \
        '(-B --ignore-blank-lines)'{-B,--ignore-blank-lines}'[ignore lines that are all blank]' \
        '(-I --ignore-matching-lines)'{-I+,--ignore-matching-lines=}'[ignore lines that match regex]:line exclusion regex' \
        '(-a --text)'{-a,--text}'[treat all files as text]' \
        "($of $oss)"{-C+,--context=-}'[context diff; specify lines of context]:number of lines of context' \
        "($of $oss)-c[output a context diff]" \
        "($of $oss)"{-U+,--unified=-}'[unified diff; specify lines of context]:number of lines of context' \
        "($of $oss)-u[output a unified diff]" \
        {,}"($ofwuc $oss -L --label)"{-L+,--label=}'[set label to use instead of file name]:label' \
        "($ofwuc $oss -p --show-c-function)"{-p,--show-c-function}'[show C function of each change]' \
        "($ofwuc $oss -F --show-function-line=)"{-F+,--show-function-line=}'[show the most recent line matching regex]:regex' \
        "($of $ouc $oss)--brief[output only whether files differ]" \
        "($of $ouc $oss)"{-e,--ed}'[output an ed script]' \
        "($of $ouc $oss)"{-f,--forward-ed}'[output a reversed ed script]' \
        "($of $ouc $oss)"{-n,--rcs}'[RCS format diff]' \
        "($of $ouc)--side-by-side[output in two columns]" \
        "($of $ouc)-y[output in two columns]" \
        "($ofwy $ouc -W --width)"{-W+,--width=}'[set size of line]:number of characters per line' \
        "($ofwy $ouc)--left-column[output only left column of common lines]" \
        "($ofwy $ouc)--suppress-common-lines[do not output common lines]" \
        "($ofwg $ouc $oss)--old-group-format=[set old group format]:old group format" \
        "($ofwg $ouc $oss)--new-group-format=[set new group format]:new group format" \
        "($ofwg $ouc $oss)--changed-group-format=[set changed group format]:changed group format" \
        "($ofwg $ouc $oss)--unchanged-group-format=[set unchanged group format]:unchanged group format" \
        "($ofwl $ouc $oss)--line-format=[set line format]:line format" \
        "($ofwl $ouc $oss)--old-line-format=[set old line format]:old line format" \
        "($ofwl $ouc $oss)--new-line-format=[set new line format]:new line format" \
        "($ofwl $ouc $oss)--unchanged-line-format=[set unchanged line format]:unchanged line format" \
        '--paginate[output through pr]' \
        '(-t --expand-tabs)'{-t,--expand-tabs}'[expand tabs to spaces]' \
        '--initial-tab[prepend a tab]' \
        '(-N --new-file)'{-N,--new-file}'[treat absent files as empty]' \
        '(-s --report-identical-files)'{-s,--report-identical-files}'[report when two files are the same]' \
        '--horizon-lines=[set number of lines to keep in prefix and suffix]:number of horizon lines' \
        '(-d --minimal)'{-d,--minimal}'[try to find a smaller set of changes]' \
        '(-H --speed-large-files)'{-H,--speed-large-files}'[assume large files and many small changes]' \
        '*:file:_cvs_diff_arg'
    }
    
    (( $+functions[_cvs_diff_arg] )) ||
    _cvs_diff_arg() {
      _cvs_files_modified || _cvs_files
    }
    
    (( $+functions[_cvs_edit] )) ||
    _cvs_edit() {
      # "+lRa:"
      _arguments -s \
        "(-R)-l[don't recurse]" \
        '(-l)-R[recursive]' \
        '-a+[specify action]:action:(edit unedit commit all none)' \
        '*:file:_cvs_files'
    }
    
    (( $+functions[_cvs_editors] )) ||
    _cvs_editors() {
      # "+lR"
      _arguments -s \
        "(-R)-l[don't recurse]" \
        '(-l)-R[recursive]' \
        '*:file:_cvs_files'
    }
    
    (( $+functions[_cvs_export] )) ||
    _cvs_export() {
      # "+Nnk:d:flRQqr:D:"
      _arguments -s \
        '-N[don'\''t shorten module paths]' \
        '-n[disable checkout program]' \
        '-f[use most recent revision if -D/-r is not matched]' \
        "(-R)-l[don't recurse]" \
        '(-l)-R[recursive]' \
        '-k+[keyword]:keyword substitution:_cvs_k' \
        '-d+[directory]:directory:_files -/' \
        '(-D)-r+[specify revision]:tag:_cvs_revisions' \
        '(-r)-D+[specify date]:date:_cvs_D' \
        '*:module:_cvs_modules'
    }
    
    (( $+functions[_cvs_history] )) ||
    _cvs_history() {
      # "+Tacelow?D:b:f:m:n:p:r:t:u:x:X:z:"
      _arguments -s \
        '-T[all tags]' \
        '-a[all users]' \
        '-c[modified files]' \
        '-e[everything]' \
        '-l[last modification]' \
        '-o[check-outed modules]' \
        '-w[working directory]' \
        '-D+[since date]:date:_cvs_D' \
        '-b+[back to record]:string' \
        '-f+[specify file]:file:_cvs_files' \
        '-m+[specify module]:module:_cvs_modules' \
        '*-n+[in module]:module:_cvs_modules' \
        '*-p+[in repository]:repository' \
        '-r+[since revision]:rev' \
        '-t+[since tag]:tag' \
        '*-u+[specify user]:user name' \
        '-x+[specify type]:type:_cvs_history_x' \
        '-X+[debugging]:arg' \
        '-z+[specify timezone]:timezone' \
        '*:file:_cvs_files'
    }
    
    (( $+functions[_cvs_history_x] )) ||
    _cvs_history_x() {
      _values -s '' 'type' \
        'F[release]' \
        'O[checkout]' \
        'E[export]' \
        'T[rtag]' \
        'C[merge collision-detected]' \
        'G[merge succeed]' \
        'U[working file was copied]' \
        'W[working file was deleted]' \
        'A[a file was added]' \
        'M[a file was modified]' \
        'R[a file was removed]'
    }
    
    (( $+functions[_cvs_import] )) ||
    _cvs_import() {
      # "+Qqdb:m:I:k:W:"
      _arguments -s \
        '-d[use file modification time]' \
        '-b+[specify vendor branch]:branch:(1.1.3)' \
        '-m+[message]:message:_cvs_m' \
        '*-I+[ignore files]:name:_files' \
        '-k+[keyword]:keyword substitution:_cvs_k' \
        '*-W+[wrapper specification]:spec:_files' \
        ':repository:_cvs_modules' \
        ':vendor tag:_cvs_vendor_branches' \
        ':release tag'
    }
    
    (( $+functions[_cvs_log] )) ||
    _cvs_log() {
      # "+bd:hlNRr::s:tw::"
      _arguments -s \
        '-b[default branch]' \
        '(-t)-h[header]' \
        '-l[don'\''t recurse]' \
        '-R[print the name of RCS file in the repository]' \
        '-N[don'\''t list tags]' \
        '(-h)-t[header with descriptive text]' \
        '-d+[specify dates]:dates' \
        '-r-[specify revisions]:revisions' \
        '-s+[specify states]:states:(Exp Stab Rel dead)' \
        '-w-[specify logins]:logins' \
        '*:file:_cvs_files'
    }
    
    (( $+functions[_cvs_rlog] )) ||
    _cvs_rlog() {
      # "+bd:hlNRr::s:tw::"
      _arguments -s \
        '-b[default branch]' \
        '(-t)-h[header]' \
        "(-R)-l[don't recurse]" \
        '(-l)-R[recursive]' \
        '-N[don'\''t list tags]' \
        '(-h)-t[header with descriptive text]' \
        '-d+[specify dates]:dates' \
        '-r-[specify revisions]:revisions' \
        '-s+[specify states]:states:(Exp Stab Rel dead)' \
        '-w-[specify logins]:logins' \
        '*:file:_cvs_modules'
    }
    
    (( $+functions[_cvs_rdiff] )) ||
    _cvs_rdiff() {
      # "+V:k:cuftsQqlRD:r:"
      _arguments -s \
        '-c[output a context diff]' \
        '-u[output a unified diff]' \
        '-f[use most recent revision if -D/-r is not matched]' \
        '-s[short patch]' \
        "(-R)-l[don't recurse]" \
        '(-l)-R[recursive]' \
        '-V+[specify version]:version' \
        '-k+[keyword]:keyword substitution:_cvs_k' \
        '(-D -D -r -r)-t[top two differences]' \
        '(-t -r)-D+[specify date]:date:_cvs_D' \
        '(-t -r)-D+[specify date]:date:_cvs_D' \
        '(-t -D)-r+[specify revision]:tag:_cvs_revisions' \
        '(-t -D)-r+[specify revision]:tag:_cvs_revisions' \
        '*:module:_cvs_modules'
    }
    
    (( $+functions[_cvs_release] )) ||
    _cvs_release() {
      # "+Qdq"
      _arguments -s \
        '-d[delete]' \
        '*:directory:_files -/'
    }
    
    (( $+functions[_cvs_remove] )) ||
    _cvs_remove() {
      # "+flR"
      _arguments -s \
        '-f[force to remove]' \
        "(-R)-l[don't recurse]" \
        '(-l)-R[recursive]' \
        '*:removed file:_cvs_remove_arg'
    }
    
    (( $+functions[_cvs_remove_arg] )) ||
    _cvs_remove_arg() {
      if (( $+opt_args[-f] )); then
        _cvs_files
      else
        _cvs_files_removed
      fi
    }
    
    (( $+functions[_cvs_rtag] )) ||
    _cvs_rtag() {
      # "+FanfQqlRdbr:D:"
      _arguments -s \
        '(-d)-F[move tag if already exists]' \
        '(-d)-a[clear tag from removed files]' \
        '-n[disable tag program]' \
        '(-d)-f[force a head revision]' \
        "(-R)-l[don't recurse]" \
        '(-l)-R[recursive]' \
        '(-b)-d[delete tag]' \
        '(-d)-b[create branch]' \
        '-D+[specify date]:date:_cvs_D' \
        '-r+[specify revision]:tag:_cvs_revisions' \
        ':tag' \
        '*:module:_cvs_modules'
    }
    
    (( $+functions[_cvs_status] )) ||
    _cvs_status() {
      # "+vlR"
      _arguments -s \
        '-v[verbose]' \
        "(-R)-l[don't recurse]" \
        '(-l)-R[recursive]' \
        '*:file:_cvs_files'
    }
    
    (( $+functions[_cvs_tag] )) ||
    _cvs_tag() {
      # "+FQqlRcdr:D:bf"
      _arguments -s \
        '(-d)-F[move tag if already exists]' \
        "(-R)-l[don't recurse]" \
        '(-l)-R[recursive]' \
        '-c[check that working files unmodified]' \
        '(-b)-d[delete tag]' \
        '(-d)-b[create branch]' \
        '(-d)-f[force a head revision]' \
        '-r+[specify revision]:tag:_cvs_revisions' \
        '-D+[specify date]:date:_cvs_D' \
        ':tag:_cvs_revisions' \
        '*:file:_cvs_files'
    }
    
    (( $+functions[_cvs_unedit] )) ||
    _cvs_unedit() {
      # "+lR"
      _arguments -s \
        "(-R)-l[don't recurse]" \
        '(-l)-R[recursive]' \
        '*:file:_cvs_files'
    }
    
    (( $+functions[_cvs_update] )) ||
    _cvs_update() {
      # "+ApCPflRQqduk:r:D:j:I:W:"
      _arguments -s \
        '-C[overwrite local modification]' \
        '-A[reset sticky tags, dates and -k]' \
        '-p[check out to standard output]' \
        '-P[prune empty directory]' \
        '-f[use head revision]' \
        "(-R)-l[don't recurse]" \
        '(-l)-R[recursive]' \
        '-d[create directories]' \
        '-k+[keyword]:keyword substitution:_cvs_k' \
        '(-D)-r+[specify revision]:tag:_cvs_revisions' \
        '(-r)-D+[specify date]:date:_cvs_D' \
        '*-j+[merge]:tag:_cvs_revisions' \
        '*-I+[ignore files]:file:_files' \
        '*-W+[wrapper specification]:spec:_files' \
        '*:file:_cvs_files'
    }
    
    (( $+functions[_cvs_watch] )) ||
    _cvs_watch() {
      local expl
    
      if (( CURRENT == 2 )); then
        _wanted values expl 'watch command' compadd on off add remove
      else
        case "$words[2]" in
          on|off) # "+lR"
    	_arguments -s \
    	  "(-R)-l[don't recurse]" \
    	  '(-l)-R[recursive]' \
    	  ':watch command' \
    	  '*:file:_cvs_files'
          ;;
          add|remove) # "+lRa:"
    	_arguments -s \
    	  "(-R)-l[don't recurse]" \
    	  '(-l)-R[recursive]' \
    	  '*-a+[specify action]:action:(edit unedit commit all none)' \
    	  ':watch command' \
    	  '*:file:_cvs_files'
          ;;
        esac
      fi
    }
    
    (( $+functions[_cvs_watchers] )) ||
    _cvs_watchers() {
      # "+lR"
      _arguments -s \
        "(-R)-l[don't recurse]" \
        '(-l)-R[recursive]' \
        '*:file:_cvs_files'
    }
    
    (( $+functions[_cvs_loadstat] )) ||
    _cvs_loadstat() {
      (( $+_cvs_loadstat_status )) && return $_cvs_loadstat_status
    
      zmodload -F zsh/stat b:zstat 2>/dev/null
      (( _cvs_loadstat_status = ! $+builtins[zstat] ))
      return $_cvs_loadstat_status
    }
    
    (( $+functions[_cvs_root] )) ||
    _cvs_root() {
      local cvspassfile id slash
    
      typeset -gU _cvs_roots
    
      if [[ -f "${cvspassfile::=${CVS_PASSFILE:-$HOME/.cvspass}}" ]]; then
        if _cvs_loadstat; then
          id="$(LC_ALL=C builtin zstat -g +mtime -F '%Y/%m/%d-%T' "$cvspassfile")"
        else
          id="$(LC_ALL=C ls -l "$cvspassfile")"
        fi
        if [[ "$id" != "$_cvs_pass_id" ]]; then
          slash=/
          _cvs_roots=($_cvs_roots ${${${${(f)"$(<$cvspassfile)"}#/1 }%% *}/:2401${slash}/:/})
          _cvs_pass_id="$id"
        fi
      fi
    
      _tags files && {
        compadd -M 'r:|[:@./]=** r:|=**' "$@" -a _cvs_roots || {
          compset -P ':(local|fork):'; _files "$@" -W / -/
        }
      }
    }
    
    (( $+functions[_cvs_tempdir] )) ||
    _cvs_tempdir() {
      _tags directories && compadd "$@" $TMPPREFIX:h $TMPDIR /tmp
    }
    
    (( $+functions[_cvs_user_variable] )) ||
    _cvs_user_variable() {
      if compset -P '*='; then
        _default
      else
        _message -e variables "variable"
      fi
    }
    
    # define completion functions for cvs global options.
    
    (( $+functions[_cvs_editor] )) ||
    _cvs_editor() {
      _tags commands && compadd "$@" vi
    }
    
    # define completion functions for cvs common options and arguments.
    
    (( $+functions[_cvs_D] )) ||
    _cvs_D() {
      _tags values && compadd "$@" today yesterday week\ ago month\ ago
    }
    
    (( $+functions[_cvs_k] )) ||
    _cvs_k() {
      _values 'keyword substitution' \
        'kv[generate keyword strings using the default form]' \
        "kvl[include locker's name in strings if given revision is locked]" \
        'k[generate only keyword names in keyword strings; omit their values]' \
        'o[generate the old keyword string as present in the file before check in]' \
        "b[binary - like \`o' but also inhibit line ending conversions]" \
        'v[generate only keyword values for keyword strings]'
    }
    
    (( $+functions[_cvs_m] )) ||
    _cvs_m() {
      _message -e messages "log message"
    }
    
    (( $+functions[_cvs_modules] )) ||
    _cvs_modules() {
      if compset -P '(#m)(*/)'; then
        _cvs_sub_modules "$cvsroot" "${MATCH%/}"
      else
        _cvs_top_modules "$cvsroot"
      fi
    }
    
    (( $+functions[_cvs_top_modules] )) ||
    _cvs_top_modules() {
      local root="$1"
    
      if [[ -d $root ]]; then
        _wanted modules expl 'module name' \
    	compadd - $root/*(/:t) \
    	    ${${(M)${(f)"$(<$root/CVSROOT/modules)"}:#[^#]*}%%[ 	]*}
      else
        if [[ "$_cvs_top_modules_cache_key" != "$root" ]]; then
          _cvs_top_modules_cache_key="$root"
          _cvs_top_modules_cache_mods=()
          if zstyle -T ":completion:${curcontext}:" remote-access; then
    	_cvs_remote_directories "$root" . _cvs_top_modules_cache_mods
    	_cvs_top_modules_cache_mods=(
    	  "$_cvs_top_modules_cache_mods[@]"
    	  ${(M)${${(f)"$(
    	    CVS_IGNORE_REMOTE_ROOT= _call_program modules cvs -d "$root" co -c
    	  )"}%%[ 	]*}:#?*}
    	)
          fi
        fi
        if (( $#_cvs_top_modules_cache_mods )); then
          _wanted modules expl 'module name' \
    	compadd -a _cvs_top_modules_cache_mods
        else
          _message -e modules 'module name'
        fi
      fi
    }
    
    (( $+functions[_cvs_sub_modules] )) ||
    _cvs_sub_modules() {
      local root="$1" dir="$2" ignore
    
      if [[ -d $root ]]; then
        _wanted modules expl 'module name' \
    	_path_files -W "($root/$dir)" -/ -F "(Attic */Attic)"
      else
        if [[ $_cvs_sub_modules_cache_key != "$root $dir" ]]; then
          _cvs_sub_modules_cache_key="$root $dir"
          _cvs_sub_modules_cache_mods=()
          if zstyle -T ":completion:${curcontext}:" remote-access; then
    	_cvs_remote_directories "$root" "$dir" _cvs_sub_modules_cache_mods
          fi
        fi
        if (( $#_cvs_sub_modules_cache_mods )); then
          _wanted modules expl 'module name' \
    	compadd -qS/ -a _cvs_sub_modules_cache_mods
        else
          _message -e modules 'module name'
        fi
      fi
    }
    
    # _cvs_run cvsroot directory cvs-arguments...
    (( $+functions[_cvs_run] )) ||
    _cvs_run() {
      local cvsroot="$1" dir="$2"
      shift 2
      local d=/tmp/zsh-cvs-work-$$
      mkdir $d >&/dev/null
      cd $d
      mkdir CVS >&/dev/null
      print -r - "$cvsroot" > CVS/Root
      print "$dir" > CVS/Repository
      print D > CVS/Entries
      CVS_IGNORE_REMOTE_ROOT= cvs "$@"
      cd $OLDPWD
      rm -rf $d
    }
    
    # _cvs_remote_directories cvsroot directory [variable]
    (( $+functions[_cvs_remote_directories] )) ||
    _cvs_remote_directories() {
      local root="$1" dir="$2" subdirs
      shift 2
      subdirs=(${${(M)${(f)"$(_call_program directories _cvs_run "$root" "$dir" update -r00 -d -p 2>&1)"}:#* New directory \`*\' -- ignored}/(#b)*\`(*)\'*/$match[1]})
      if (( $# )); then
        eval "$1=(\"\$subdirs[@]\")"
      else
        if (( $#subdirs )); then
          print -lr - $subdirs
        fi
      fi
    }
    
    (( $+functions[_cvs_vendor_branches] )) ||
    _cvs_vendor_branches() {
      local expl vendor_branch
      vendor_branch=()
      if zstyle -T ":completion:${curcontext}:" remote-access; then
        if [[ -n $opt_args[-b] ]]; then
          _cvs_extract_vendor_branch -b "$opt_args[-b]" "$cvsroot" "$line[1]" \
    	vendor_branch
        else
          _cvs_extract_vendor_branch "$cvsroot" "$line[1]" vendor_branch
        fi
      fi
      if (( $#vendor_branch )); then
        _wanted values expl 'vendor branch' compadd -a vendor_branch
      else
        _message -e branches 'vendor branch'
      fi
    }
    
    # _cvs_extract_vendor_branch [-b numeric-branch] cvsroot directory [variable]
    (( $+functions[_cvs_extract_vendor_branch] )) ||
    _cvs_extract_vendor_branch() {
      local numeric='1\.1\.1'
      if [[ $1 = -b ]]; then
        numeric="${2//./\\.}"
        shift 2
      fi
      local root="$1" dir="$2"
      shift 2
    
      local vtags
      vtags=($(
        _call_program tags _cvs_run "$root" "$dir" -Q log -h 2>/dev/null |
        sed -ne $'/^symbolic names:/{
    n
    :loop
    /^[^ \t]/d
    /: '"$numeric"$'$/b found
    n
    b loop
    :found
    s/^[ \t]*\\(.*\\): '"$numeric"$'$/\\1/p
    n
    /^[ \t]/b found
    q
    }'))
      if (( $# )); then
        eval "$1=(\"\$vtags[@]\")"
      else
        if (( $#vtags )); then
          print -lr - "$vtags[@]"
        fi
      fi
    }
    
    (( $+functions[_cvs_revisions] )) ||
    _cvs_revisions() {
      local expl
    
      if [[ $_cvs_revisions_key != $cvsroot:$PWD ]]; then
        _cvs_revisions_key="$cvsroot:$PWD"
        if zstyle -T ":completion:${curcontext}:" remote-access; then
          _cvs_revisions_cache=(
    	$(CVS_IGNORE_REMOTE_ROOT= _call_program tags cvs -d "$cvsroot" -q status -vl .|
    	  sed -n -e '/No Tags Exist/d' \
    		 -e 's/^	\([A-Za-z][-_0-9A-Za-z+]*\).*/\1/p'|
    	  sort|uniq)
          )
        else
          _cvs_revisions_cache=()
        fi
      fi
    
      if (( $#_cvs_revisions_cache )); then
        _wanted values expl revision compadd -a _cvs_revisions_cache
      else
        _message -e revisions revision
      fi
    }
    
    # define completion functions for files maintained by cvs.
    
    (( $+functions[_cvs_files] )) ||
    _cvs_files() {
      _alternative \
        'directories:directory:_cvs_existing_directories' \
        'existing-files:file:_cvs_existing_entries' \
        'removed-files:removed file:_cvs_nonexistent_entries'
    }
    
    (( $+functions[_cvs_files_modified] )) ||
    _cvs_files_modified() {
      _alternative \
        'directories:directory:_cvs_existing_directories' \
        'existing-files:file:_cvs_modified_entries' \
        'removed-files:removed file:_cvs_nonexistent_entries'
    }
    
    (( $+functions[_cvs_files_removed] )) ||
    _cvs_files_removed() {
      _alternative \
        'directories:directory:_cvs_existing_directories' \
        'removed-files:removed file:_cvs_nonexistent_entries'
    }
    
    (( $+functions[_cvs_files_unmaintained] )) ||
    _cvs_files_unmaintained() {
      _cvs_nonentried_files ||
      _cvs_existing_directories ||
      _cvs_strict_nonentried_files
    }
    
    (( $+functions[_cvs_existing_directories] )) ||
    _cvs_existing_directories() {
      local expl
      _wanted directories expl directory _path_files -g "*~(*/|)CVS(/)" ||
      _cvs_path_prefixes
    }
    
    (( $+functions[_cvs_existing_entries] )) ||
    _cvs_existing_entries() {
      local expl match linedir realdir pat
      match=()
      : ${PREFIX:#(#b)(*/)(*)}
      linedir="$match[1]"
      realdir=${(e)~linedir}
      [[ -f "$realdir"CVS/Entries ]] &&
      pat=(${(@)${(@)${(@M)${(@f)"$(<"$realdir"CVS/Entries)"}:#/*}#/}%%/*})
      (( ${#pat} )) && _wanted files expl file _path_files -a pat
    }
    
    (( $+functions[_cvs_modified_entries] )) ||
    _cvs_modified_entries() {
      if _cvs_loadstat; then
        local expl match linedir realdir pat slash=/
        match=()
        : ${PREFIX:#(#b)(*/)(*)}
        linedir="$match[1]"
        realdir=${(e)~linedir}
        [[ -f "$realdir"CVS/Entries ]] && {
          local -a mtime
          LC_ALL=C builtin zstat -A mtime -gn +mtime -F $'%a %b %e %T %Y\n' ${realdir}*(D) 2>/dev/null
          [[ -n ${pat::="${(@j:|:)${(@)${(@)${(@)${(@)${(@)${(@M)${(@f)"$(<"$realdir"CVS/Entries)"}:#/*}#/}/${slash}[^${slash}]#${slash}//}%/[^/]#/[^/]#}:#${(j:|:)~${(f)${(j:/:)${mtime##*/}}//(#m)[][*?()<|^~#\\]/\\$MATCH}#/}}%%/*}//(#m)[][*?()<|^~#\\]/\\$MATCH}"} ]]
        } &&
        _wanted files expl 'modified file' _path_files -g "$pat"
      else
        _cvs_existing_entries
      fi
    }
    
    (( $+_cvs_ignore_default )) ||
    _cvs_ignore_default=(
      RCS SCCS CVS CVS.adm RCSLOG 'cvslog.*' tags TAGS .make.state .nse_depinfo
      '*\~' '\#*' '.\#*' ',*' '_$*' '*$' '*.old' '*.bak' '*.BAK' '*.orig' '*.rej'
      '.del-*' '*.a' '*.olb' '*.o' '*.obj' '*.so' '*.exe' '*.Z' '*.elc' '*.ln'
      core
    )
    
    (( $+functions[_cvs_strict_nonentried_files] )) ||
    _cvs_strict_nonentried_files() {
      local expl match linedir realdir omitpats
    
      match=()
      : ${PREFIX:#(#b)(*/)(*)}
      linedir="$match[1]"
      realdir=${(e)~linedir}
      [[ -f "$realdir"CVS/Entries ]] && {
        omitpats=(
          ${${${${(M)${(f)"$(<"$realdir"CVS/Entries)"}:#/*}#/}%%/*}//(#m)[][*?()<|^~#\\]/\\$MATCH}
        )
        if (( $#omitpats )); then
          _path_files -g "*~(*/|)(${(j:|:)~omitpats})(D.)"
        else
          _path_files -g "*~(*/|)(D.)"
        fi
      }
    }
    
    (( $+functions[_cvs_nonentried_files] )) ||
    _cvs_nonentried_files() {
      local expl match linedir realdir omitpats
    
      match=()
      : ${PREFIX:#(#b)(*/)(*)}
      linedir="$match[1]"
      realdir=${(e)~linedir}
      [[ -f "$realdir"CVS/Entries ]] && {
        omitpats=(
          ${${${${(M)${${(f)"$(<"$realdir"CVS/Entries)"}:#/*/-*/*/*/*}:#(D|)/*}#(D|)/}%%/*}//(#m)[][*?()<|^~#\\]/\\$MATCH}
          $_cvs_ignore_default
          ${=cvsignore}
        )
        [[ -r ~/.cvsignore ]] && omitpats=($omitpats $(<~/.cvsignore))
        [[ -r ${realdir}.cvsignore ]] && omitpats=($omitpats $(<${realdir}.cvsignore))
        omitpats=($omitpats $=CVSIGNORE)
    
        _path_files -g "*~(*/|)(${(j:|:)~omitpats})(D.)"
      }
    }
    
    (( $+functions[_cvs_nonexistent_entries] )) ||
    _cvs_nonexistent_entries() {
      local expl match linedir realdir files
      match=()
      : ${PREFIX:#(#b)(*/)(*)}
      linedir="$match[1]"
      realdir=${(e)~linedir}
      files=(${realdir}*(D:t))
      [[ -f "$realdir"CVS/Entries ]] && {
        files=(
          ${${${${(M)${(f)"$(<"$realdir"CVS/Entries)"}:#(D|)/*}#(D|)/}%%/*}:#${(j:|:)~${files//(#m)[][*?()<|^~#\\]/\\$MATCH}}}
        )
        compquote files
        _wanted files expl 'removed file' compadd -Qp "$linedir" -a files
      }
    }
    
    (( $+functions[_cvs_path_prefixes] )) ||
    _cvs_path_prefixes() {
      local expl match
      match=()
      [[ "$PREFIX$SUFFIX" = (#b)(*)(/[^/]#) ]] && {
        PREFIX="$match[1]"
        ISUFFIX="$match[2]$ISUFFIX"
        SUFFIX=''
        _wanted directories expl directory \
    	_path_files -g "*~($PREFIX|(*/|)CVS)(/)" -S ''
      }
    }
    
    _cvs "$@"
    PK[Sz̐functions/_apmnuW+A#compdef apm
    
    if [[ $OSTYPE == linux* ]]; then
    
      _arguments -s \
        '(-)'{-V,--version}'[print the apm program version and exit immediately]' \
        '(-v --verbose)'{-v,--verbose}'[print information about APM BIOS and Linux APM driver version]' \
        '(-m --minutes)'{-m,--minutes}'[print total minutes remaining instead of using an hh:mm format]' \
        '(-s --suspend)'{-s,--suspend}'[put the machine into suspend mode if possible]' \
        '(-S --standby)'{-S,--standby}'[put the machine into standby mode if possible]' \
        '(-n --noignore)'{-n,--noignore}'[tell the system not to ignore system-generated APM message]' \
        '(-i --ignore)'{-i,--ignore}'[tell the system to ignore system-generated APM message]' && return
    
    elif [[ $OSTYPE == (freebsd|dragonfly)* ]]; then
    
      _arguments \
        '-a[display AC line status]' \
        '-b[display battery status]' \
        '-d[disable/enable display suspension]:bool:' \
        '-e[disable/enable apm functions]:bool:' \
        '-h[disable/enable HLT in kernel context switch]:bool:' \
        '-l[display remaining battery percentage]' \
        '-r[enable resume wakeup timer]' \
        '-s[display status of APM support]' \
        '-t[display estimated remaining battery life in seconds]' \
        '-Z[transition system into standby mode]' \
        '-z[suspend the system]' && return
    
    elif [[ $OSTYPE == openbsd* ]]; then
      _arguments \
        '-z[engage suspend mode]' \
        '-S[engage stand-by mode]' \
        '-l[display estimated battery lifetime percentage]' \
        '-m[display estimated battery lifetime minutes]' \
        '-b[display battery status]' \
        '-a[display AC line status]' \
        '-v[verbose]' \
        '-f[socket]:sockname:_files' && return
    fi
    
    return 1
    PK[^vfunctions/_deb_packagesnuW+A#autoload
    
    # Usage: _deb_packages expl... avail|installed|uninstalled
    
    _deb_packages_update_avail () {
      if ( [[ ${+_deb_packages_cache_avail} -eq 0 ]] ||
          _cache_invalid DEBS_avail ) && ! _retrieve_cache DEBS_avail;
      then
        _deb_packages_cache_avail=(
          ${(f)"$(apt-cache --generate pkgnames 2>/dev/null)"}
        )
    
        _store_cache DEBS_avail _deb_packages_cache_avail
      fi
      cachevar=_deb_packages_cache_avail
    }
    
    _deb_packages_update_installed () {
      if ( [[ ${+_deb_packages_cache_installed} -eq 0 ]] ||
          _cache_invalid DEBS_installed ) && ! _retrieve_cache DEBS_installed;
      then
        _deb_packages_cache_installed=()
        dpkg --get-selections | while read package state ; do
            [[ $state = (install|hold) ]] && _deb_packages_cache_installed+=$package
        done
        _store_cache DEBS_installed _deb_packages_cache_installed
      fi
      cachevar=_deb_packages_cache_installed
    }
    
    _deb_packages_update_held () {
      if ( [[ ${+_deb_packages_cache_held} -eq 0 ]] ||
          _cache_invalid DEBS_held ) && ! _retrieve_cache DEBS_held;
      then
        _deb_packages_cache_held=()
        dpkg --get-selections | while read package state ; do
            [[ $state = hold ]] && _deb_packages_cache_held+=$package
        done
        _store_cache DEBS_held _deb_packages_cache_held
      fi
      cachevar=_deb_packages_cache_held
    }
    
    _deb_packages_update_deinstalled () {
      if ( [[ ${+_deb_packages_cache_deinstalled} -eq 0 ]] ||
          _cache_invalid DEBS_deinstalled ) && ! _retrieve_cache DEBS_deinstalled;
      then
        _deb_packages_cache_deinstalled=()
        dpkg --get-selections | while read package state ; do
            [[ $state = deinstall ]] && _deb_packages_cache_deinstalled+=$package
        done
        _store_cache DEBS_deinstalled _deb_packages_cache_deinstalled
      fi
      cachevar=_deb_packages_cache_deinstalled
    }
    
    _deb_packages_update_xinstalled () {
      if ( [[ ${+_deb_packages_cache_xinstalled} -eq 0 ]] ||
          _cache_invalid DEBS_xinstalled ) && ! _retrieve_cache DEBS_xinstalled;
      then
        _deb_packages_cache_xinstalled=()
        dpkg --get-selections | while read package state ; do
            _deb_packages_cache_xinstalled+=$package
        done
        _store_cache DEBS_xinstalled _deb_packages_cache_xinstalled
      fi
      cachevar=_deb_packages_cache_xinstalled
    }
    
    _deb_packages_update_uninstalled () {
      _deb_packages_update_avail
      _deb_packages_update_installed
      if (( ! $+_deb_packages_cache_uninstalled )); then
        _deb_packages_cache_uninstalled=(
          ${_deb_packages_cache_avail:#${(j:|:)~${_deb_packages_cache_installed:q}}}
        )
      fi
      cachevar=_deb_packages_cache_uninstalled
    }
    
    _deb_packages () {
      local command="$argv[$#]" expl cachevar pkgset update_policy
    
      zstyle -s ":completion:*:*:$service:*" cache-policy update_policy
      if [[ -z "$update_policy" ]]; then
        zstyle ":completion:*:*:$service:*" cache-policy _debs_caching_policy
      fi
    
      [[ "$command" = (installed|deinstalled|xinstalled|held|uninstalled|avail|available) ]] || {
        _message "unknown command: $command"
        return
      }
    
      zstyle -s ":completion:${curcontext}:" packageset pkgset
    
      [[ "$pkgset" = (installed|deinstalled|xinstalled|held|uninstalled|avail|available) ]] || {
        pkgset="$command"
      }
    
      [[ "$pkgset" = "available" ]] && pkgset="avail"
    
      expl=("${(@)argv[1,-2]}")
    
      _deb_packages_update_$pkgset
    
      typeset -gH $cachevar
    
      _tags packages && compadd "$expl[@]" - "${(@P)cachevar}"
    }
    
    _debs_caching_policy () {
      # rebuild if cache is more than a week old
      local -a oldp
      oldp=( "$1"(mw+1) )
      (( $#oldp )) && return 0
    
      [[ /var/cache/apt/pkgcache.bin -nt "$1" ||
         /var/lib/dpkg/available -nt "$1" ]]
    }
    
    _deb_packages "$@"
    PK[[[functions/_rubynuW+A#compdef ruby -P -value-,RUBY(LIB|OPT|PATH),-default-
    
    # ruby 1.8.2 (2004-12-25) [i686-linux]
    
    local curcontext="$curcontext" state line expl ret=1
    typeset -A opt_args
    
    local -a args opts
    
    args=(
      '(-)1:script file:_files'
      '*::script argument: _normal'
    )
    
    opts=(
      '-0-[specify record separator]:input record separator in octal (default \0):'
      '-a[autosplit mode with -n or -p (splits $_ into $F)]'
      '-c[check syntax only]'
      '-C+[cd to directory, before executing your script]:directory:_files -/'
      '(-d --debug)'{-d,--debug}'[set debugging flags (set $DEBUG to true)]'
      "(1)*-e+[one line of script (several -e's allowed, omit program file)]:one line of script:"
      '-F-[split() pattern for autosplit (-a)]:input field separator:'
      '-i-[edit ARGV files in place (make backup if extension supplied)]:suffix for in-place-edit mode:(.bak)'
      '*-I+[specify $LOAD_PATH directory (may be used more than once)]:library directory:_files -/'
      '-K-[specifies KANJI (Japanese) code-set]:KANJI encoding:((e\:EUC-JP s\:Shift_JIS u\:UTF-8 N\:None))'
      "-l[assume 'while gets(); ... end' loop around your script]"
      "(-p)-n[assume 'while gets(); ... end' loop around your script]"
      '(-n)-p[assume loop like -n but print line also like sed]'
      '*-r+[require the library, before executing your script]:library name:->library'
      '-s[enable some switch parsing for switches after script name]'
      '-S[look for the script using PATH environment variable]'
      '-T-[turn on tainting checks]:taint level (default 0):((0\:strings\ from\ streams/environment/ARGV\ are\ tainted 1\:no\ dangerous\ operation\ by\ tainted\ value 2\:process/file\ operations\ prohibited 3\:all\ generated\ objects\ are\ tainted 4\:no\ global\ \(non-tainted\)\ variable\ modification/no\ direct\ output))'
      '(-v --verbose)'{-v,--verbose}'[print version number, then turn on verbose mode]'
      '-w[turn warnings on for your script]'
      '-W-[set warning level]:warning level (default 2):((0\:silent 1\:medium 2\:verbose))'
      '(-y --yydebug)'{-y,--yydebug}'[enable yacc debugging in the parser]'
      '-x-[strip off text before #!ruby line and perhaps cd to directory]:directory:_files -/'
      '(1 * -)--copyright[print the copyright]'
      '(1 * -)'{-h,--help}'[print help message]'
      '(1 * -)--version[print the version]'
    )
    
    case "$service" in
      *RUBY(LIB|PATH)*)
        _dir_list && return 0
      ;;
      *RUBYOPT*)
        compset -q
        words=( fake "$words[@]" )
        (( CURRENT++ ))
        _arguments -C -s : "${(@M)opts:#*-[IdvwrK](|[-+])\[*}" && ret=0
      ;;
      ruby)
        _arguments -C -s -S : "$opts[@]" "$args[@]" && ret=0
      ;;
    esac
    
    case "$state" in
      library)
        local -a dirs
        local cmd
        if [[ "$service" = *RUBYOPT* ]]; then
          cmd=ruby
        else
          cmd=$words[1]
        fi
        dirs=( $(_call_program directories $cmd -e 'puts\ \$:' 2>/dev/null) ${(s.:.)opt_args[-I]} )
        _wanted libraries expl library _path_files -W dirs && ret=0
      ;;
    esac
    
    return ret
    PK[^-functions/_emulatenuW+A#compdef emulate
    
    _arguments -C -s -A "-*" \
      '-L[set local_options and local_traps as well]' \
      '-R[reset all options instead of only those needed for script portability]' \
      '::shell to emulate:(zsh sh ksh csh)'
    PK[fQ;functions/_printersnuW+A#compdef -value-,PRINTER,-default- -value-,LPDEST,-default-
    
    local expl ret=1 list disp sep tmp servopt
    integer ind
    
    if (( $+commands[lsallq] )); then
      # Use AIX's command to list print queues
      _wanted printers expl printer compadd "$@" - $(lsallq)
      return
    fi
    
    zstyle -s ":completion:${curcontext}:printers" list-separator sep || sep=--
    
    # If we've been given a different print server on the command line,
    # list printers on that.  This information shouldn't be cached.
    # (I) searches backwards---this is good, since some commands, such
    # as lpoptions, can take multiple -h arguments and we want the last
    # one before the current argument.  For lpr, -h might mean something
    # else and the option is -H.
    if [[ $service = lpr ]]; then
      servopt=-H
    else
      servopt=-h
    fi
    if (( $+commands[lpstat] )); then
      ind=${words[1,CURRENT][(I)${servopt}*]}
      if (( ind > 0 )); then
        if [[ $words[ind] = $servopt ]]; then
          tmp=-h$words[ind+1]
        else
          tmp=-h${words[ind][3,-1]}
        fi
        _wanted printers expl printer compadd "$@" - \
          ${${(f)"$(_call_program printers lpstat $tmp -a 2>/dev/null)"}%% *} &&
            return
      fi
    fi
    
    
    if (( ! $+_lp_cache )); then
      local file entry names i
    
      file=( /etc/(printcap|printers.conf) )
    
      _lp_cache=()
      _lp_alias_cache=()
    
      if (( $#file )); then
        while read entry; do
          if [[ "$entry" = [^[:blank:]\#\*_]*:* ]]; then
            names=( "${(s:|:)entry%%:*}" )
            if [[ "$entry" = *:description=* ]]; then
              disp="${${entry##*:description=}%%:*}"
            elif [[ $#names -gt 1 && "$names[-1]" = *\ * ]] ;then
              disp="$names[-1]"
            else
              disp=''
            fi
            if [[ -n "$disp" ]]; then
              _lp_cache+=( "${names[1]}:${disp}" )
      	  _lp_alias_cache+=( "${(@)^names[2,-1]:#*\ *}:${disp}" )
            else
              _lp_cache+=( "${names[1]}" )
      	  _lp_alias_cache+=( "${(@)names[2,-1]:#*\ *}" )
            fi
          fi
        done < $file[1]
      fi
    
      if (( $+commands[lpstat] )); then
        # If lpstat it exists, it's possible there are some other
        # printers there, so add them.
        _call_program printers lpstat -a 2>/dev/null | while read entry; do
          entry=${entry%%[[:blank:]]*}
          if (( ${_lp_cache[(I)$entry:*]} == 0 )); then
    	_lp_cache+=( $entry )
          fi
        done
      fi
    
      if [[ $OSTYPE = solaris* ]] && (( ${+commands[ypcat]} )) &&
          tmp=$(_call_program printers ypcat printers.conf.byname 2>/dev/null); then
        _lp_cache+=( ${${${(S)${(f)tmp}/(#b):*((#e)|description=([^:]#):)*/:${match[2]}|}%%|*}:#_default*} ) # If you use YP
      fi
    
      (( $#_lp_cache )) || _lp_cache=( 'lp0:guessed default printer' )
      (( $#_lp_alias_cache )) || unset _lp_alias_cache
    fi
    
    if zstyle -T ":completion:${curcontext}:printers" verbose; then
      zformat -a list " $sep " "$_lp_cache[@]"
      disp=(-ld list)
    else
      disp=()
    fi
    _wanted printers expl printer \
        compadd "$@" "$disp[@]" - "${(@)_lp_cache%%:*}" && return 0
    
    (( $+_lp_alias_cache )) || return 1
    
    if zstyle -T ":completion:${curcontext}:printers" verbose; then
      zformat -a list " $sep " "$_lp_alias_cache[@]"
      disp=(-ld list)
    else
      disp=()
    fi
    _wanted printers expl printer \
        compadd "$@" "$disp[@]" - "${(@)_lp_alias_cache%%:*}" && return 0
    
    return 1
    PK[n?
    functions/_complete_debugnuW+A#compdef -k complete-word \C-x?
    
    eval "$_comp_setup"
    
    (( $+_debug_count )) || integer -g _debug_count
    local tmp=${TMPPREFIX}${$}${words[1]:t}$[++_debug_count]
    local pager w="${(qq)words}"
    
    exec 3>&-	# Too bad if somebody else is using it ...
    [[ -t 2 ]] && { exec 3>&2 2>| $tmp ; trap 'exec 2>&3 3>&-' EXIT INT }
    
    setopt xtrace
    : $ZSH_NAME $ZSH_VERSION
    ${1:-_main_complete}
    integer ret=$?
    unsetopt xtrace
    
    [[ -t 3 ]] && {
        zstyle -s ':completion:complete-debug::::' pager pager
        print -sR "${pager:-${PAGER:-${VISUAL:-${EDITOR:-more}}}} ${(q)tmp} ;: $w"
        _message -r "Trace output left in $tmp (up-history to view)"
        [[ $compstate[nmatches] -le 1 && $compstate[list] != *force* ]] &&
            compstate[list]='list force messages'
    }
    
    return ret
    PK[E+y I
    I
    functions/colorsnuW+A# Put standard ANSI color codes in shell parameters for easy use.
    # Note that some terminals do not support all combinations.
    
    typeset -Ag color colour
    
    color=(
    # Codes listed in this array are from ECMA-48, Section 8.3.117, p. 61.
    # Those that are commented out are not widely supported or aren't closely
    # enough related to color manipulation, but are included for completeness.
    
    # Attribute codes:
      00 none                 # 20 gothic
      01 bold                 # 21 double-underline
      02 faint                  22 normal
      03 standout               23 no-standout
      04 underline              24 no-underline
      05 blink                  25 no-blink
    # 06 fast-blink           # 26 proportional
      07 reverse                27 no-reverse
      08 conceal                28 no-conceal
    # 09 strikethrough        # 29 no-strikethrough
    
    # Font selection:
    # 10 font-default
    # 11 font-first
    # 12 font-second
    # 13 font-third
    # 14 font-fourth
    # 15 font-fifth
    # 16 font-sixth
    # 17 font-seventh
    # 18 font-eighth
    # 19 font-ninth
    
    # Text color codes:
      30 black                  40 bg-black
      31 red                    41 bg-red
      32 green                  42 bg-green
      33 yellow                 43 bg-yellow
      34 blue                   44 bg-blue
      35 magenta                45 bg-magenta
      36 cyan                   46 bg-cyan
      37 white                  47 bg-white
    # 38 iso-8316-6           # 48 bg-iso-8316-6
      39 default                49 bg-default
    
    # Other codes:
    # 50 no-proportional
    # 51 border-rectangle
    # 52 border-circle
    # 53 overline
    # 54 no-border
    # 55 no-overline
    # 56 through 59 reserved
    
    # Ideogram markings:
    # 60 underline-or-right
    # 61 double-underline-or-right
    # 62 overline-or-left
    # 63 double-overline-or-left
    # 64 stress
    # 65 no-ideogram-marking
    )
    
    # A word about black and white:  The "normal" shade of white is really a
    # very pale grey on many terminals; to get truly white text, you have to
    # use bold white, and to get a truly white background you have to use
    # bold reverse white bg-xxx where xxx is your desired foreground color
    # (and which means the foreground is also bold).
    
    # Map in both directions; could do this with e.g. ${(k)colors[(i)normal]},
    # but it's clearer to include them all both ways.
    
    local k
    for k in ${(k)color}; do color[${color[$k]}]=$k; done
    
    # Add "fg-" keys for all the text colors, for clarity.
    
    for k in ${color[(I)3?]}; do color[fg-${color[$k]}]=$k; done
    
    # This is inaccurate, but the prompt theme system needs it.
    
    color[grey]=${color[black]}
    color[fg-grey]=${color[grey]}
    color[bg-grey]=${color[bg-black]}
    
    # Assistance for the color-blind.
    
    colour=(${(kv)color})	# A case where ksh namerefs would be useful ...
    
    # The following are terminal escape sequences used by colored prompt themes.
    
    local lc=$'\e[' rc=m	# Standard ANSI terminal escape values
    
    typeset -Hg reset_color bold_color
    reset_color="$lc${color[none]}$rc"
    bold_color="$lc${color[bold]}$rc"
    
    # Foreground
    
    typeset -AHg fg fg_bold fg_no_bold
    for k in ${(k)color[(I)fg-*]}; do
        fg[${k#fg-}]="$lc${color[$k]}$rc"
        fg_bold[${k#fg-}]="$lc${color[bold]};${color[$k]}$rc"
        fg_no_bold[${k#fg-}]="$lc${color[normal]};${color[$k]}$rc"
    done
    
    # Background
    
    typeset -AHg bg bg_bold bg_no_bold
    for k in ${(k)color[(I)bg-*]}; do
        bg[${k#bg-}]="$lc${color[$k]}$rc"
        bg_bold[${k#bg-}]="$lc${color[bold]};${color[$k]}$rc"
        bg_no_bold[${k#bg-}]="$lc${color[normal]};${color[$k]}$rc"
    done
    PK['88functions/transpose-words-matchnuW+A# Transpose words, matching the words using match-words-by-style, q.v.
    # The group of word characters preceding the cursor (not necessarily
    # immediately) are transposed with the group of word characters following
    # the cursor (again, not necessarily immediately).
    #
    # Note the style skip-chars, used in the context of the current widget.
    # This gives a number of character starting from the cursor position
    # which are never considered part of a word and hence are always left
    # alone.  The default is 0 and typically the only useful alternative
    # is one.  This would have the effect that `fooXbar' with the cursor
    # on X would be turned into `barXfoo' with the cursor still on the X,
    # regardless of what the character X is.
    
    autoload -Uz match-words-by-style
    
    local curcontext=":zle:$WIDGET" skip
    local -a matched_words
    integer count=${NUMERIC:-1} neg
    
    (( count < 0 )) && (( count = -count, neg = 1 ))
    
    while (( count-- > 0 )); do
        match-words-by-style
    
        [[ -z "$matched_words[2]$matched_words[5]" ]] && return 1
    
        if (( neg )); then
    	LBUFFER="$matched_words[1]"
    	RBUFFER="$matched_words[5]${(j..)matched_words[3,4]}\
    $matched_words[2]${(j..)matched_words[6,7]}"
        else
    	LBUFFER="$matched_words[1]$matched_words[5]${(j..)matched_words[3,4]}\
    $matched_words[2]"
    	RBUFFER="${(j..)matched_words[6,7]}"
        fi
    
    done
    
    return 0
    PK[zE!functions/_sep_partsnuW+A#autoload
    
    # This function can be used to separately complete parts of strings
    # where each part may be one of a set of matches and different parts
    # have different sets.
    # Arguments are alternately arrays and separator strings. Arrays may
    # be given by name or literally as words separated by white space in
    # parentheses, e.g.:
    #
    #  _sep_parts '(foo bar)' @ hosts
    #
    # This will make this function complete the strings `foo' and `bar'.
    # If the string on the line contains a `@', the substring after it
    # will be completed from the array `hosts'. Of course more arrays
    # may be given, each preceded by another separator string.
    #
    # This function understands the `-J group', `-V group', and
    # `-X explanation' options.
    
    local str arr sep test testarr tmparr prefix suffixes autosuffix
    local matchflags opt group expl nm=$compstate[nmatches] opre osuf opts matcher
    
    # Get the options.
    
    zparseopts -D -a opts \
        'J+:=group' 'V+:=group' P: F: S: r: R: q 1 2 n 'X+:=expl' 'M+:=matcher'
    
    # Get the string from the line.
    
    opre="$PREFIX"
    osuf="$SUFFIX"
    str="$PREFIX$SUFFIX"
    SUFFIX=""
    prefix=""
    
    # Walk through the arguments to find the longest unambiguous prefix.
    
    while [[ $# -gt 1 ]]; do
      # Get the next array and separator.
      arr="$1"
      sep="$2"
    
      if [[ "$arr[1]" == '(' ]]; then
        tmparr=( ${=arr[2,-2]} )
        arr=tmparr
      fi
    
      # Is the separator on the line?
    
      [[ "$str" != *${sep}* ]] && break
    
      # Get the matching array elements.
    
      PREFIX="${str%%(|\\)${sep}*}"
      builtin compadd -O testarr "$matcher[@]" -a "$arr"
      [[ $#testarr -eq 0 && -n "$_comp_correct" ]] &&
        compadd -O testarr "$matcher[@]" -a "$arr"
    
      # If there are no matches we give up. If there is more than one
      # match, this is the part we will complete.
    
      (( $#testarr )) || return 1
      [[ $#testarr -gt 1 ]] && break
    
      # Only one match, add it to the prefix and skip over it in `str',
      # continuing with the next array and separator.
    
      prefix="${prefix}${testarr[1]}${sep}"
      str="${str#*${sep}}"
      shift 2
    done
    
    # Get the array to work upon.
    
    arr="$1"
    if [[ "$arr[1]" == '(' ]]; then
      tmparr=( ${=arr[2,-2]} )
      arr=tmparr
    fi
    
    if [[ $# -le 1 || "$str" != *${2}* ]]; then
      # No more separators, build the matches.
    
      PREFIX="$str"
      builtin compadd -O testarr "$matcher[@]" -a "$arr"
      [[ $#testarr -eq 0 && -n "$_comp_correct" ]] &&
        compadd -O testarr "$matcher[@]" -a "$arr"
    fi
    
    [[ $#testarr -eq 0 || ${#testarr[1]} -eq 0 ]] && return 1
    
    # Now we build the suffixes to give to the completion code.
    
    shift
    suffixes=("")
    autosuffix=()
    
    while [[ $# -gt 0 && "$str" == *${1}* ]]; do
      # Remove anything up to the the suffix.
    
      str="${str#*${1}}"
    
      # Again, we get the string from the line up to the next separator
      # and build a pattern from it.
    
      if [[ $# -gt 2 ]]; then
        PREFIX="${str%%${3}*}"
      else
        PREFIX="$str"
      fi
    
      # We incrementally add suffixes by appending to them the separators
      # and the strings from the next array that match the pattern we built.
    
      arr="$2"
      if [[ "$arr[1]" == '(' ]]; then
        tmparr=( ${=arr[2,-2]} )
        arr=tmparr
      fi
    
      builtin compadd -O tmparr "$matcher[@]" -a "$arr"
      [[ $#tmparr -eq 0 && -n "$_comp_correct" ]] &&
        compadd -O tmparr "$matcher[@]" - "$arr"
    
      suffixes=("${(@)^suffixes[@]}${(q)1}${(@)^tmparr}")
    
      shift 2
    done
    
    # If we were given at least one more separator we make the completion
    # code offer it by appending it as a autoremovable suffix.
    
    (( $# )) && autosuffix=(-qS "${(q)1}")
    
    # Add the matches for each of the suffixes.
    
    PREFIX="$pre"
    SUFFIX="$suf"
    for i in "$suffixes[@]"; do
      compadd -U "$group[@]" "$expl[@]" "$autosuffix[@]" "$opts[@]" \
              -i "$IPREFIX" -I "$ISUFFIX" -p "$prefix" -s "$i" -a testarr
    done
    
    # This sets the return value to indicate that we added matches (or not).
    
    [[ nm -ne compstate[nmatches] ]]
    PK[泈I66functions/_dladmnuW+A#compdef dladm
    
    _dladm_links() {
    	compadd "$@" - $(dladm show-link -p -o link)
    }
    
    _dladm_devs() {
    	compadd "$@" - $(dladm show-phys -p -o device)
    }
    
    _dladm_aggrs() {
    	compadd "$@" - $(dladm show-aggr -p -o link)
    }
    
    _dladm_aggr_ports() {
    	compadd "$@" - $(dladm show-aggr -p -x -o ports)
    }
    
    _dladm_vlans() {
    	compadd "$@" - $(dladm show-vlan -p -o link)
    }
    
    _dladm_wifi_links() {
    	compadd "$@" - $(dladm show-wifi -p -o link)
    }
    
    _dladm_wifi_nets() {
    	compadd "$@" - ${(f)"$(dladm scan-wifi -p -o essid)"}
    }
    
    _dladm_secobjs() {
    	compadd "$@" - ${(f)"$(dladm show-secobj -p -o object)"}
    }
    
    _dladm_ethers() {
    	compadd "$@" - $(dladm show-ether -p -o link)
    }
    
    _dladm_linkprops() {
    	# TODO: complete property values, when available
    	compadd "$@" - $(dladm show-linkprop -c -o property)
    }
    
    _dladm_vnics() {
    	compadd "$@" - $(dladm show-vnic -p -o link)
    }
    
    _dladm_etherstubs() {
    	compadd "$@" - $(dladm show-etherstub)
    }
    
    _dladm() {
    	local context state line expl
    	typeset -A opt_args
    	local -a subcmds rw_properties rw_propnames ro_properties
    	local -a link_properties link_stats_properties
    	local -a aggr_properties aggr_lacp_properties aggr_ext_properties
    	local -a vlan_properties wifi_properties wifi_connect_properties
    	local -a ether_properties linkprop_properties secobj_properties
    
    	# TODO: some subcommands can take multiple comma-separated targets
    	# TODO: some option sets may be different based on other commandline flags
    	# TODO: some subcommands may take different arguments based on options
    
    	subcmds=(
    		"show-ether" "show-usage"
    		{"rename","show"}"-link"
    		{"add","create","delete","modify","remove","show"}"-aggr"
    		{"connect","disconnect","scan","show"}"-wifi"
    		{"reset","set","show"}"-linkprop"
    		{"create","delete","show"}"-secobj"
    		{"create","delete","show"}"-vlan"
    		{"delete","show"}"-phys"
    		{"create","delete","show"}"-vnic"
    		{"create","delete","show"}"-etherstub"
    	)
    
    	if [[ $service == "dladm" ]]; then
    		_arguments -C -A "-*" \
    			'-\?[help]' \
    			'*::command:->subcmd' && return 0
    
    		if (( CURRENT == 1 )); then
    			_wanted commands expl "dladm subcommand" compadd -a subcmds
    			return
    		fi
    		service="$words[1]"
    		curcontext="${curcontext%:*}=$service:"
    	fi
    
    	link_properties=( "link" "class" "mtu" "state" "over" )
    	link_stats_properties=( "link" "ipackets" "rbytes" "ierrors" "opackets" "obytes" "oerrors" )
    
    	aggr_properties=( "link" "policy" "addrpolicy" "lacpactivity" "lacptimer" "flags" )
    	aggr_lacp_properties=( "link" "port" "aggregatable" "sync" "coll" "dist" "defaulted" "expired" )
    	aggr_ext_properties=( "link" "port" "speed" "duplex" "state" "address" "portstate" )
    
    	vlan_properties=( "link" "vid" "over" "flags" )
    
    	wifi_connect_properties=( "link" "essid" "bssid" "sec" "mode" "strength" "speed" "bsstype" )
    	wifi_properties=( $wifi_connect_properties "status" "auth" )
    
    	ether_properties=( "link" "ptype" "state" "auto" "speed-duplex" "pause" "rem_fault" )
    
    	linkprop_properties=( "link" "property" "value" "default" "possible" )
    
    	secobj_properties=( "object" "class" )
    
    	vnic_properties=( "link" "over" "speed" "macaddr" "macaddrtype" )
    
    	case $service in
    	("show-link")
    		_arguments -A "-*" \
    			'(-P --persistent)'{-P,--persistent}'[display persistent link configuration]' \
    			'(-p --parseable)'{-p,--parseable}'[parseable output]' \
    			- set1 \
    			'(-o --output)'{-o,--output}'[properties to display]:property:_values -s , "property" $link_properties' \
    			- set2 \
    			'(-s --statistics)'{-s,--statistics}'[display link statistics]' \
    			'(-i --interval)'{-i,--interval}'[specify an interval]:interval:' \
    			'(-o --output)'{-o,--output}'[properties to display]:property:_values -s , "property" $link_stats_properties' \
    			':link name:_dladm_links' \
    		;;
    
    	("rename-link")
    		_arguments -A "-*" \
    			'-R[root directory]:directory:_path_files -/' \
    			':old link name:_dladm_links' \
    			':new link name:' \
    		;;
    
    	("show-phys")
    		_arguments -A "-*" \
    			'(-P --persistent)'{-P,--persistent}'[display persistent link configuration]' \
    			'(-p --parseable)'{-p,--parseable}'[parseable output]' \
    			'(-s --statistics)'{-s,--statistics}'[display link statistics]' \
    			'(-i --interval)'{-i,--interval}'[specify an interval]:interval:' \
    			'(-o --output)'{-o,--output}'[properties to display]:property:_values -s , "property" link media state speed duplex device' \
    			':physical link name:_dladm_devs'
    		;;
    
    	("delete-phys")
    		_arguments -A "-*" \
    			':physical link name:_dladm_devs'
    		;;
    
    	("create-aggr")
    		_arguments -A "-*" \
    			'(-t --temporary)'{-t,--temporary}'[aggregation should be temporary]' \
    			'(-R --root)'{-R,--root}'[root directory]:directory:_path_files -/' \
    			'(-l --link)'{-l,--link}'[component link]:link:_dladm_links' \
    			'(-P --policy)'{-P,--policy}'[port selection policy]:policy:_values -s , "policy" L2 L3 L4' \
    			'(-L --lacp-mode)'{-L,--lacp-mode}'[LACP mode]:lacp mode:(off active passive)' \
    			'(-T --lacp-timer)'{-T,--lacp-timer}'[LACP timer]:lacp timer:(short long)' \
    			'(-u --unicast)'{-u,--unicast}'[unicast address]:unicast address:' \
    			':aggregate link name:'
    		;;
    
    	("modify-aggr")
    		_arguments -A "-*" \
    			'(-t --temporary)'{-t,--temporary}'[aggregation should be temporary]' \
    			'(-R --root)'{-R,--root}'[root directory]:directory:_path_files -/' \
    			'(-l --link)'{-l,--link}'[component link]:link:_dladm_links' \
    			'(-P --policy)'{-P,--policy}'[port selection policy]:policy:_values -s , "policy" L2 L3 L4' \
    			'(-L --lacp-mode)'{-L,--lacp-mode}'[LACP mode]:lacp mode:(off active passive)' \
    			'(-T --lacp-timer)'{-T,--lacp-timer}'[LACP timer]:lacp timer:(short long)' \
    			'(-u --unicast)'{-u,--unicast}'[unicast address]:unicast address:' \
    			':aggregate link name:_dladm_aggrs'
    		;;
    
    	("delete-aggr")
    		_arguments -A "-*" \
    			'(-t --temporary)'{-t,--temporary}'[deletion should be temporary]' \
    			'(-R --root)'{-R,--root}'[root directory]:directory:_path_files -/' \
    			':aggregate link name:_dladm_aggrs'
    		;;
    
    	("add-aggr")
    		_arguments -A "-*" \
    			'(-t --temporary)'{-t,--temporary}'[aggregation should be temporary]' \
    			'(-R --root)'{-R,--root}'[root directory]:directory:_path_files -/' \
    			'(-l --link)'{-l,--link}'[component link]:link:_dladm_links' \
    			':aggregate link name:_dladm_aggrs'
    		;;
    
    	("remove-aggr")
    		_arguments -A "-*" \
    			'(-t --temporary)'{-t,--temporary}'[aggregation should be temporary]' \
    			'(-R --root)'{-R,--root}'[root directory]:directory:_path_files -/' \
    			'(-l --link)'{-l,--link}'[component link]:link:_dladm_aggr_ports' \
    			':aggregate link name:_dladm_aggrs'
    		;;
    
    	("show-aggr")
    		_arguments -A "-*" \
    			'(-P --persistent)'{-P,--persistent}'[display persistent link configuration]' \
    			'(-p --parseable)'{-p,--parseable}'[parseable output]' \
    			'(-s --statistics)'{-s,--statistics}'[display link statistics]' \
    			'(-i --interval)'{-i,--interval}'[specify an interval]:interval:' \
    			':aggregate link name:_dladm_links' \
    			- set1 \
    			'(-o --output)'{-o,--output}'[properties to display]:property:_values -s , "property" $aggr_properties' \
    			- lacp \
    			'(-L --lacp)'{-L,--lacp}'[LACP information]' \
    			'(-o --output)'{-o,--output}'[properties to display]:property:_values -s , "property" $aggr_lacp_properties' \
    			- extended \
    			'(-x --extended)'{-x,--extended}'[extended information]' \
    			'(-o --output)'{-o,--output}'[properties to display]:property:_values -s , "property" $aggr_ext_properties' \
    		;;
    
    	("create-vlan")
    		_arguments -A "-*" \
    			'(-t --temporary)'{-t,--temporary}'[VLAN should be temporary]' \
    			'(-f --force)'{-f,--force}'[force VLAN creation]' \
    			'(-R --root)'{-R,--root}'[root directory]:directory:_path_files -/' \
    			'(-l --link)'{-l,--link}'[component link]:link:_dladm_links' \
    			'-v[VLAN ID]:id:' \
    			':VLAN link name:'
    		;;
    
    	("delete-vlan")
    		_arguments -A "-*" \
    			'(-t --temporary)'{-t,--temporary}'[deletion should be temporary]' \
    			'(-R --root)'{-R,--root}'[root directory]:directory:_path_files -/' \
    			':VLAN link name:_dladm_vlans'
    		;;
    
    	("show-vlan")
    		_arguments -A "-*" \
    			'(-P --persistent)'{-P,--persistent}'[display persistent link configuration]' \
    			'(-p --parseable)'{-p,--parseable}'[parseable output]' \
    			'(-o --output)'{-o,--output}'[properties to display]:property:_values -s , "property" $vlan_properties' \
    			':VLAN link name:_dladm_vlans'
    		;;
    
    	("scan-wifi")
    		_arguments -A "-*" \
    			'(-p --parseable)'{-p,--parseable}'[parseable output]' \
    			'(-o --output)'{-o,--output}'[properties to display]:property:_values -s , "property" $wifi_connect_properties' \
    			':wireless link name:_dladm_wifi_links'
    		;;
    
    	("connect-wifi")
    		_arguments -A "-*" \
    			'(-e --essid)'{-e,--essid}'[ESSID name]:network:_dladm_wifi_nets' \
    			'(-b --bsstype)'{-b,--bsstype}'[BSS type]:' \
    			'(-m --mode)'{-m,--mode}'[802.11 mode]:mode:(a b g)' \
    			'(-k --key)'{-k,--key}'[key name]:key:_dladm_secobjs' \
    			'(-s --sec)'{-s,--sec}'[security mode]:(none wep wpa)' \
    			'(-a --auth)'{-a,--auth}'[authentication mode]:mode:(open shared)' \
    			'(-c --create-ibss)'{-c,--create-ibss}'[create an ad-hoc network]' \
    			'(-T --timeout)'{-T,--timeout}'[association timeout]:(forever)' \
    			':wireless link name:_dladm_wifi_links'
    		;;
    
    	("disconnect-wifi")
    		_arguments -A "-*" \
    			- set1 \
    			'(-a --all-links)'{-a,--all-links}'[all links]' \
    			- set2 \
    			':wireless link name:_dladm_wifi_links'
    		;;
    
    	("show-wifi")
    		_arguments -A "-*" \
    			'(-p --parseable)'{-p,--parseable}'[parseable output]' \
    			'(-o --output)'{-o,--output}'[properties to display]:property:_values -s , "property" $wifi_properties' \
    			':wireless link name:_dladm_wifi_links'
    		;;
    
    	("show-ether")
    		_arguments -A "-*" \
    			'(-p --parseable)'{-p,--parseable}'[parseable output]' \
    			'(-x --extended)'{-x,--extended}'[extended output]' \
    			'(-o --output)'{-o,--output}'[properties to display]:property:_values -s , "property" $ether_properties' \
    			':ethernet link name:_dladm_ethers'
    		;;
    
    	("set-linkprop")
    		_arguments -A "-*" \
    			'(-t --temporary)'{-t,--temporary}'[change should be temporary]' \
    			'(-R --root)'{-R,--root}'[root directory]:directory:_path_files -/' \
    			'(-p --prop)'{-p,--prop}'[properties]:property:_dladm_linkprops' \
    			':link name:_dladm_links'
    		;;
    
    	("reset-linkprop")
    		_arguments -A "-*" \
    			'(-t --temporary)'{-t,--temporary}'[change should be temporary]' \
    			'(-R --root)'{-R,--root}'[root directory]:directory:_path_files -/' \
    			'(-p --prop)'{-p,--prop}'[properties]:property:_dladm_linkprops' \
    			':link name:_dladm_links'
    		;;
    
    	("show-linkprop")
    		_arguments -A "-*" \
    			'(-P --persistent)'{-P,--persistent}'[display persistent link properties]' \
    			'(-c --parseable)'{-c,--parseable}'[parseable output]' \
    			'(-o --output)'{-o,--output}'[properties to display]:property:_values -s , "property" $linkprop_properties' \
    			'(-p --prop)'{-p,--prop}'[properties]:property:_dladm_linkprops' \
    			':link name:_dladm_links'
    		;;
    
    	("create-secobj")
    		_arguments -A "-*" \
    			'(-t --temporary)'{-t,--temporary}'[creation should be temporary]' \
    			'(-R --root)'{-R,--root}'[root directory]:directory:_path_files -/' \
    			'(-c --class)'{-c,--class}'[class]:class:(wep wpa)' \
    			'(-f --file)'{-f,--file}'[file containing object value]:file:_path_files' \
    			':object name:'
    		;;
    
    	("delete-secobj")
    		_arguments -A "-*" \
    			'(-t --temporary)'{-t,--temporary}'[deletion should be temporary]' \
    			'(-R --root)'{-R,--root}'[root directory]:directory:_path_files -/' \
    			':object name:_dladm_secobjs'
    		;;
    
    	("show-secobj")
    		_arguments -A "-*" \
    			'(-P --persistent)'{-P,--persistent}'[display persistent object information]' \
    			'(-p --parseable)'{-p,--parseable}'[parseable output]' \
    			'(-o --output)'{-o,--output}'[properties to display]:property:_values -s , "property" $secobj_properties' \
    			':object name:_dladm_secobjs'
    		;;
    
    	("create-vnic")
    		# TODO: MAC address completion could be richer
    		_arguments -A "-*" \
    			'(-t --temporary)'{-t,--temporary}'[creation should be temporary]' \
    			'(-R --root)'{-R,--root}'[root directory]:directory:_path_files -/' \
    			'(-l --link)'{-l,--link}'[component link]:link:_dladm_links' \
    			'(-m --mac-address)'{-m,--mac-address}'[MAC address]:address:(factory random auto)' \
    			'-v[VLAN ID]:id:' \
    			'(-p --prop)'{-p,--prop}'[property values]:value:' \
    			':VNIC name:'
    		;;
    
    	("delete-vnic")
    		_arguments -A "-*" \
    			'(-t --temporary)'{-t,--temporary}'[deletion should be temporary]' \
    			'(-R --root)'{-R,--root}'[root directory]:directory:_path_files -/' \
    			':VNIC name:_dladm_vnics'
    		;;
    
    	("show-vnic")
    		_arguments -A "-*" \
    			'(-P --persistent)'{-P,--persistent}'[display persistent object information]' \
    			'(-p --parseable)'{-p,--parseable}'[parseable output]' \
    			'(-o --output)'{-o,--output}'[properties to display]:property:_values -s , "property" $vnic_properties' \
    			'(-l --link)'{-l,--link}'[limit to VNICs on link]:link:_dladm_links' \
    			'(-s --statistics)'{-s,--statistics}'[display VNIC statistics]' \
    			'(-i --interval)'{-i,--interval}'[specify an interval]:interval:' \
    			':VNIC name:_dladm_vnics'
    		;;
    
    	("create-etherstub")
    		_arguments -A "-*" \
    			'(-t --temporary)'{-t,--temporary}'[creation should be temporary]' \
    			'(-R --root)'{-R,--root}'[root directory]:directory:_path_files -/' \
    			':etherstub name:'
    		;;
    
    	("delete-etherstub")
    		_arguments -A "-*" \
    			'(-t --temporary)'{-t,--temporary}'[deletion should be temporary]' \
    			'(-R --root)'{-R,--root}'[root directory]:directory:_path_files -/' \
    			':etherstub name:_dladm_etherstubs'
    		;;
    
    	("show-etherstub")
    		_arguments -A "-*" \
    			':etherstub name:_dladm_etherstubs'
    		;;
    
    	("show-usage")
    		_arguments -A "-*" \
    			'(-f --file)'{-f,--file}'[read records from file]:_path_files' \
    			'(-F --format)'{-f,--format}'[plotfile format]:(gnuplot)' \
    			'(-p --plot)'{-p,--plot}'[write plot to file]:' \
    			'(-e --start)'{-e,--start}'[start time]:date/time (MM/DD/YYYY,hh\:mm\:ss)' \
    			'(-s --stop)'{-s,--stop}'[stop time]:date/time (MM/DD/YYYY,hh\:mm\:ss)' \
    			':link name:_dladm_links'
    		;;
    
    	(*)
    		_message "unknown dladm subcommand: $service"
    		;;
    	esac
    }
    
    _dladm "$@"
    PK[˂,wfunctions/_optionsnuW+A#autoload
    
    # This should be used to complete all option names.
    
    local expl
    
    _wanted zsh-options expl 'zsh option' \
        compadd "$@" -M 'B:[nN][oO]= M:_= M:{A-Z}={a-z}' -k - options
    PK[CІ++
    functions/zmvnuW+A# function zmv {
    # zmv, zcp, zln:
    #
    # This is a multiple move based on zsh pattern matching.  To get the full
    # power of it, you need a postgraduate degree in zsh.  However, simple
    # tasks work OK, so if that's all you need, here are some basic examples:
    #   zmv '(*).txt' '$1.lis'
    # Rename foo.txt to foo.lis, etc.  The parenthesis is the thing that
    # gets replaced by the $1 (not the `*', as happens in mmv, and note the
    # `$', not `=', so that you need to quote both words).
    #   zmv '(**/)(*).txt '$1$2.lis'
    # The same, but scanning through subdirectories.  The $1 becomes the full
    # path.  Note that you need to write it like this; you can't get away with
    # '(**/*).txt'.
    #   zmv -w '**/*.txt' '$1$2.lis'
    #   noglob zmv -W **/*.txt **/*.lis
    # These are the lazy version of the one above; with -w, zsh inserts the
    # parentheses for you in the search pattern, and with -W it also inserts
    # the numbered variables for you in the replacement pattern.  The catch
    # in the first version is that you don't need the / in the replacement
    # pattern.  (It's not really a catch, since $1 can be empty.)  Note that
    # -W actually inserts ${1}, ${2}, etc., so it works even if you put a
    # number after a wildcard (such as zmv -W '*1.txt' '*2.txt').
    #   zmv -C '**/(*).txt' ~/save/'$1'.lis
    # Copy, instead of move, all .txt files in subdirectories to .lis files
    # in the single directory `~/save'.  Note that the ~ was not quoted.
    # You can test things safely by using the `-n' (no, not now) option.
    # Clashes, where multiple files are renamed or copied to the same one, are
    # picked up.
    #
    # Here's a more detailed description.
    #
    # Use zsh pattern matching to move, copy or link files, depending on
    # the last two characters of the function name.  The general syntax is
    #   zmv '' ''
    #  is a globbing pattern, so it should be quoted to prevent it from
    # immediate expansion, while  is a string that will be
    # re-evaluated and hence may contain parameter substitutions, which should
    # also be quoted.  Each set of parentheses in  (apart from those
    # around glob qualifiers, if you use the -Q option, and globbing flags) may
    # be referred to by a positional parameter in , i.e. the first
    # (...) matched is given by $1, and so on.  For example,
    #   zmv '([a-z])(*).txt' '${(C)1}$2.txt'
    # renames algernon.txt to Algernon.txt, boris.txt to Boris.txt and so on.
    # The original file matched can be referred to as $f in the second
    # argument; accidental or deliberate use of other parameters is at owner's
    # risk and is not covered by the (non-existent) guarantee.
    #
    # As usual in zsh, /'s don't work inside parentheses.  There is a special
    # case for (**/) and (***/):  these have the expected effect that the
    # entire relevant path will be substituted by the appropriate positional
    # parameter.
    #
    # There is a shortcut avoiding the use of parenthesis with the option -w
    # (with wildcards), which picks out any expressions `*', `?', `'
    # (<->, <1-10>, etc.), `[...]', possibly followed by `#'s, `**/', `***/', and
    # automatically parenthesises them. (You should quote any ['s or ]'s which
    # appear inside [...] and which do not come from ranges of the form
    # `[:alpha:]'.)  So for example, in
    #    zmv -w '[[:upper:]]*' '${(L)1}$2'
    # the $1 refers to the expression `[[:upper:]]' and the $2 refers to
    # `*'. Thus this finds any file with an upper case first character and
    # renames it to one with a lowercase first character.  Note that any
    # existing parentheses are active, too, so you must count accordingly.
    # Furthermore, an expression like '(?)' will be rewritten as '((?))' --- in
    # other words, parenthesising of wildcards is independent of any existing
    # parentheses.
    #
    # Any file whose name is not changed by the substitution is simply ignored.
    # Any error --- a substitution resulted in an empty string, two
    # substitutions gave the same result, the destination was an existing
    # regular file and -f was not given --- causes the entire function to abort
    # without doing anything.
    #
    # Options:
    #  -f  force overwriting of destination files.  Not currently passed
    #      down to the mv/cp/ln command due to vagaries of implementations
    #      (but you can use -o-f to do that).
    #  -i  interactive: show each line to be executed and ask the user whether
    #      to execute it.  Y or y will execute it, anything else will skip it.
    #      Note that you just need to type one character.
    #  -n  no execution: print what would happen, but don't do it.
    #  -q  Turn bare glob qualifiers off:  now assumed by default, so this
    #      has no effect.
    #  -Q  Force bare glob qualifiers on.  Don't turn this on unless you are
    #      actually using glob qualifiers in a pattern (see below).
    #  -s  symbolic, passed down to ln; only works with zln or z?? -L.
    #  -v  verbose: print line as it's being executed.
    #  -o 
    #       will be split into words and passed down verbatim
    #      to the cp, ln or mv called to perform the work.  It will probably
    #      begin with a `-'.
    #  -p 
    #      Call  instead of cp, ln or mv.  Whatever it does, it should
    #      at least understand the form ' --  ',
    #      where  and  are filenames generated.
    #  -w  Pick out wildcard parts of the pattern, as described above, and
    #      implicitly add parentheses for referring to them.
    #  -W  Just like -w, with the addition of turning wildcards in the
    #      replacement pattern into sequential ${1} .. ${N} references.
    #  -C
    #  -L
    #  -M  Force cp, ln or mv, respectively, regardless of the name of the
    #      function.
    #
    # Bugs:
    #   Parenthesised expressions can be confused with glob qualifiers, for
    #   example a trailing '(*)' would be treated as a glob qualifier in
    #   ordinary globbing.  This has proved so annoying that glob qualifiers
    #   are now turned off by default.  To force the use of glob qualifiers,
    #   give the flag -Q.
    #
    #   The pattern is always treated as an extendedglob pattern.  This
    #   can also be interpreted as a feature.
    #
    # Unbugs:
    #   You don't need braces around the 1 in expressions like '$1t' as
    #   non-positional parameters may not start with a number, although
    #   paranoiacs like the author will probably put them there anyway.
    
    emulate -RL zsh
    setopt extendedglob
    
    local f g args match mbegin mend files action myname tmpf opt exec
    local opt_f opt_i opt_n opt_q opt_Q opt_s opt_M opt_C opt_L 
    local opt_o opt_p opt_v opt_w opt_W MATCH MBEGIN MEND
    local pat repl errstr fpat hasglobqual opat
    typeset -A from to
    integer stat
    
    myname=${(%):-%N}
    
    while getopts ":o:p:MCLfinqQsvwW" opt; do
      if [[ $opt = "?" ]]; then
        print -r -- "$myname: unrecognized option: -$OPTARG" >&2
        return 1
      fi
      eval "opt_$opt=\${OPTARG:--\$opt}"
    done
    (( OPTIND > 1 )) && shift $(( OPTIND - 1 ))
    
    [[ -z $opt_Q ]] && setopt nobareglobqual
    [[ -n $opt_M ]] && action=mv
    [[ -n $opt_C ]] && action=cp
    [[ -n $opt_L ]] && action=ln
    [[ -n $opt_p ]] && action=$opt_p
    
    if [[ -z $action ]]; then
      action=$myname[-2,-1]
    
      if [[ $action != (cp|mv|ln) ]]; then
        print -r "$myname: action $action not recognised: must be cp, mv or ln." >&2
        return 1
      fi
    fi
    
    if (( $# != 2 )); then
      print -P "Usage:
      %N [OPTIONS] oldpattern newpattern
    where oldpattern contains parenthesis surrounding patterns which will
    be replaced in turn by \$1, \$2, ... in newpattern.  For example,
      %N '(*).lis' '\$1.txt'
    renames 'foo.lis' to 'foo.txt', 'my.old.stuff.lis' to 'my.old.stuff.txt',
    and so on.  Something simpler (for basic commands) is the -W option:
      %N -W '*.lis' '*.txt'
    This does the same thing as the first command, but with automatic conversion
    of the wildcards into the appropriate syntax.  If you combine this with
    noglob, you don't even need to quote the arguments.  For example,
      alias mmv='noglob zmv -W'
      mmv *.c.orig orig/*.c" >&2
      return 1
    fi
    
    pat=$1
    repl=$2
    shift 2
    
    if [[ -n $opt_s && $action != ln ]]; then
      print -r -- "$myname: invalid option: -s" >&2
      return 1
    fi
    
    if [[ -n $opt_w || -n $opt_W ]]; then
      # Parenthesise all wildcards.
      local tmp find
      integer cnt=0
      # Well, this seems to work.
      # The tricky bit is getting all forms of [...] correct, but as long
      # as we require inactive bits to be backslashed its not so bad.
      find='(#m)((\*\*##/|[*?]|<[0-9]#-[0-9]#>|\[(^|)(\]|)(\[:[a-z]##:\]|\\?|[^\]])##\])\##|?\###)'
      tmp="${pat//${~find}/$[++cnt]}"
      if [[ $cnt = 0 ]]; then
        print -r -- "$myname: warning: no wildcards were found in search pattern" >&2
      else
        pat="${pat//${~find}/($MATCH)}"
      fi
      if [[ -n $opt_W ]]; then
        # Turn wildcards into ${1} .. ${N} references.
        local open='${' close='}'
        integer N=0
        repl="${repl//${~find}/$open$[++N]$close}"
        if [[ $N != $cnt ]]; then
          print -P "%N: error: number of wildcards in each pattern must match" >&2
          return 1
        fi
        if [[ $N = 0 ]]; then
          print -P "%N: warning: no wildcards were found in replacement pattern" >&2
        fi
      fi
    fi
    
    if [[ -n $opt_Q && $pat = (#b)(*)\([^\)\|\~]##\) ]]; then
      hasglobqual=q
      # strip off qualifiers for use as ordinary pattern
      opat=$match[1]
    fi
    
    if [[ $pat = (#b)(*)\((\*\*##/)\)(*) ]]; then
      fpat="$match[1]$match[2]$match[3]"
      # Now make sure we do depth-first searching.
      # This is so that the names of any files are altered before the
      # names of the directories they are in.
      if [[ -n $opt_Q && -n $hasglobqual ]]; then
        fpat[-1]="odon)"
      else
        setopt bareglobqual
        fpat="${fpat}(odon)"
      fi
    else
      fpat=$pat
    fi
    files=(${~fpat})
    
    [[ -n $hasglobqual ]] && pat=$opat
    
    errs=()
    
    for f in $files; do
      if [[ $pat = (#b)(*)\(\*\*##/\)(*) ]]; then
        # This looks like a recursive glob.  This isn't good enough,
        # because we should really enforce that $match[1] and $match[2]
        # don't match slashes unless they were explicitly given.  But
        # it's a start.  It's fine for the classic case where (**/) is
        # at the start of the pattern.
        pat="$match[1](*/|)$match[2]"
      fi
      [[ -e $f && $f = (#b)${~pat} ]] || continue
      set -- "$match[@]"
      { {
        g=${(Xe)repl}
      } 2> /dev/null } always {
        if (( TRY_BLOCK_ERROR )); then
          print -r -- "$myname: syntax error in replacement" >&2
          return 1
        fi
      }
      if [[ -z $g ]]; then
        errs+=("\`$f' expanded to an empty string")
      elif [[ $f = $g ]]; then
        # don't cause error: more useful just to skip
        #   errs=($errs "$f not altered by substitution")
        [[ -n $opt_v ]] && print -r -- "$f not altered, ignored"
        continue
      elif [[ -n $from[$g] && ! -d $g ]]; then
        errs+=("$f and $from[$g] both map to $g")
      elif [[ -f $g && -z $opt_f && ! ($f -ef $g && $action = mv) ]]; then
        errs+=("file exists: $g")
      fi
      from[$g]=$f
      to[$f]=$g
    done
    
    if (( $#errs )); then
      print -r -- "$myname: error(s) in substitution:" >&2
      print -lr -- $errs >&2
      return 1
    fi
    
    for f in $files; do
      [[ -z $to[$f] ]] && continue
      exec=($action ${=opt_o} $opt_s -- $f $to[$f])
      [[ -n $opt_i$opt_n$opt_v ]] && print -r -- ${(q)exec}
      if [[ -n $opt_i ]]; then
        read -q 'opt?Execute? ' || continue
      fi
      if [[ -z $opt_n ]]; then
        $exec || stat=1
      fi
    done
    
    return $stat
    # }
    PK[hCfunctions/_zipnuW+A#compdef zip unzip zipinfo
    
    local suffixes suf zipfile uzi testfile
    local expl curcontext="$curcontext" state line ret=1
    typeset -A opt_args
    
    case $service in
      zip)
        _arguments -C -s \
          '-f[freshen: only changed files]' \
          '-d[delete entries in zipfile]' \
          '-r[recurse into directories]' \
          '-R[PKZIP recursion]' \
          '-q[quiet operation]' \
          '-c[add one-line comments]' \
          '-b[use "path" for temp file]:path for temporary archive:_files -/' \
          '-@[read names from stdin]' \
          '-F[fix zipfile]' \
          '-FF[try harder to fix zipfile]' \
          '-A[adjust self-extracting exe]' \
          '-T[test zipfile integrity]' \
          '-y[store symbolic links as the link instead of the referenced file]' \
          '-e[encrypt]' \
          '-h[show help]' \
          '-u[update: only changed or new files]' \
          '-m[move into zipfile (delete files)]' \
          '-g[allow growing existing zipfile]' \
          '-j[junk: do not record directory names]' \
          '-l[convert LF to CR LF]' \
          '-ll[convert CR LF to LF]' \
          '-L[display license]' \
          '-v[verbose operation/print version info]' \
          '-z[add zipfile comment]' \
          '-t[only do files after or at "mmddyyyy"]:mmddyyyy' \
          '-tt[only do files before "mmddyyyy"]:mmddyyyy' \
          '-o[make zipfile as old as latest entry]' \
          '-D[do not add directory entries]' \
          '-J[junk zip file prefix (unzipsfx)]' \
          '-X[eXclude eXtra file attributes]' \
          '-n[specify suffixes of files not to be compressed]:suffixes:->suffixes' \
          '(   -1 -2 -3 -4 -5 -6 -7 -8 -9)-0[store only]' \
          '(-0    -2 -3 -4 -5 -6 -7 -8 -9)-1[compress faster]' \
          '(-0 -1    -3 -4 -5 -6 -7 -8 -9)-2' \
          '(-0 -1 -2    -4 -5 -6 -7 -8 -9)-3' \
          '(-0 -1 -2 -3    -5 -6 -7 -8 -9)-4' \
          '(-0 -1 -2 -3 -4    -6 -7 -8 -9)-5' \
          '(-0 -1 -2 -3 -4 -5    -7 -8 -9)-6' \
          '(-0 -1 -2 -3 -4 -5 -6    -8 -9)-7' \
          '(-0 -1 -2 -3 -4 -5 -6 -7    -9)-8' \
          '(-0 -1 -2 -3 -4 -5 -6 -7 -8   )-9[compress better]' \
          '-x[exclude the following names]' \
          '-i[include only the following names]' \
          "(-f -d -R -q -c -b -@ -F -FF -A -T -y -e -h -u -m -g -j -l -ll -L -v -z -t -tt -o -D -J -X -n -0 -1 -2 -3 -4 -5 -6 -7 -8 -9):zip file:_files -g '(#i)*.(zip|xpi|[ejw]ar)(-.)'" \
          '*:file:->files' && ret=0
      ;;
      unzip)
        _arguments -C -s \
          '(-f -u -l -t -z -d)-p[extract files to pipe]' \
          '(-p -u -l -t -z)-f[freshen existing files; create none]' \
          '(-p -f -l -t -z)-u[update files; create if necessary]' \
          '(-p -f -u -t -z -d)-l[list files]' \
          '(-p -f -u -l -z -d)-t[test compressed archive data]' \
          '(-p -f -u -l -t -d)-z[display archive comment]' \
          '(-p -l -t -z)-d+[specify directory to extract files to]:directory:_files -/' \
          '(-p -l -t -z -o)-n[never overwrite existing files]' \
          '(-p -l -t -z -n)-o[overwrite files without prompting]' \
          "(-p -l -t -z)-j[junk paths (don't make directories)]" \
          '-C[match filenames case-insensitively]' \
          '(-p -l -t -z)-X[restore UID/GID info]' \
          '-q[quiet]' '-qq[quieter]' \
          '(-l -t -z)-a[auto-convert any text files]' \
          '(-l -t -z)-aa[treat all files as text]' \
          '-v[verbose/display version info]' \
          '(-p -z)-L[lowercase (some) filenames]' \
          '-M[page output]' \
          '-x[exclude the following names]' \
          '-Z[zipinfo mode]:zipinfomode:->zipinfo' \
          "(-p -f -u -l -t -z -n -o -j -C -X -q -qq -a -aa -v -L -M)1:zip file:_files -g '(#i)*.(zip|xpi|[ejw]ar)(-.)'" \
          '*:file:->files' && ret=0
      ;;
    esac
    
    [[ $state == zipinfo ]] && uzi="-Z[zipinfo mode]"
    
    if [[ $service == zipinfo ]] || [[ -n $uzi ]]; then
        _arguments -C -s \
          $uzi \
          '(-2 -s -m -l -v -h -t -T -z)-1[filenames only]' \
          '(-1 -s -m -l -v -T)-2[just filenames but allow -h/-t/-z]' \
          '(-1 -2 -m -l -v -h -t)-s[short format]' \
          '(-1 -2 -s -l -v -h -t)-m[medium format]' \
          '(-1 -2 -s -m -v -h -t)-l[long format]' \
          '(-1 -2 -s -m -l -h -z)-v[verbose, multi-page format]' \
          '(-1 -s -m -l -v)-h[print header line]' \
          '(-1 -v)-z[print zipfile comment]' \
          '-C[match filenames case-insensitively]' \
          '(-1 -s -m -l)-t[print totals]' \
          '(-1 -2)-T[use sortable decimal format for file times]' \
          '-M[page output]' \
          '-x[exclude the following names]' \
          "(-1 -2 -s -m -l -v -h -z -C -t -T -M)1:zip file:_files -g '(#i)*.(zip|xpi|[ejw]ar)(-.)'" \
          '*:file:->files' && ret=0
    fi
    
    case $state in
      suffixes)
        compset -P '*:'
        compset -S ':*' || suf=":."
        suffixes=( *.*(N:e) )
        _wanted suffixes expl suffixes \
    	compadd -S "$suf" -r ": \t" .$^suffixes && return
      ;;
      files)
        if [[ $service = zip ]] && (( ! ${+opt_args[-d]} )); then
          _wanted files expl zfile _files -g '^(#i)*.(zip|xpi|[ejw]ar)(-.)' && return
        else
          testfile=${~${(Q)line[1]}}
          if [[ -f $testfile ]]; then
    	zipfile=$testfile
          elif [[ -f $testfile.zip ]]; then
    	zipfile=$testfile.zip
          elif [[ -f $testfile.ZIP ]]; then
    	zipfile=$testfile.ZIP
          else
    	return 1
          fi
          if [[ $zipfile !=  $_zip_cache_name ]]; then
    	_zip_cache_name="$zipfile"
    	_zip_cache_list=( ${(f)"$(zipinfo -1 $_zip_cache_name)"} )
          fi
         _wanted files expl 'file from archive' \
    	 _multi_parts / _zip_cache_list && return
        fi
      ;;
    esac
    
    return ret
    PK[m||functions/_physical_volumesnuW+A#autoload
    
    local expl
    
    _wanted physicalvolumes expl 'physical volume' \
        compadd "$@" - $(lsdev -C -c disk -S a -F name)
    PK[*Աfunctions/_bsd_pkgnuW+A#compdef pkg_add pkg_create pkg_delete pkg_info
    
    (( $+functions[_bsd_pkg_pkgfiles] )) ||
    _bsd_pkg_pkgfiles() {
      local ret=1 paths portsdir pkgsdir
    
      case $OSTYPE in
      netbsd*)
        portsdir=/usr/pkgsrc
        ;;
      *)
        portsdir=${PORTSDIR:-/usr/ports}
        ;;
      esac
    
      pkgsdir=${PACKAGES:-$portsdir/packages}/All
    
      paths=( "${(@)${(@s.:.)PKG_PATH}:#}" )
      _files "$@" -g '*.t[bg]z(-.)' && ret=0
      (( $#path )) && _files "$@" -W paths -g '*.t[bg]z(-.)' && ret=0
      compadd "$@" - $pkgsdir/*.t[bg]z(-.) && ret=0
    
      return ret
    }
    
    (( $+functions[_bsd_pkg_pkgs] )) ||
    _bsd_pkg_pkgs() {
      compadd "$@" - ${PKG_DBDIR:-/var/db/pkg}/*(/:t)
    }
    
    (( $+functions[_bsd_pkg_pkgs_and_files] )) ||
    _bsd_pkg_pkgs_and_files() {
      local ret=1
    
      if (( $words[(I)-*F*] )); then
        _files "$@" && ret=0
      else
        _bsd_pkg_pkgs "$@" && ret=0
      fi
    
      return ret
    }
    
    _bsd_pkg() {
      local flags
    
      case "$service" in
      pkg_add)
        flags=(
          '-f[force installation]'
          '-I[don'\''t execute installation scripts]'
          '-M[run in master mode]'
          '-n[don'\''t really install packages]'
          '-p[specify prefix]:prefix directory:_files -/'
          '-R[don'\''t record]'
          '-S[run in slave mode]'
          '-t[specify mktemp template]:mktemp template:_files -/'
          '-v[be verbose]'
        )
    
        case "$OSTYPE" in
        freebsd*)
          flags=(
            $flags[@]
            '-r[fetch from remote site]'
          )
          ;;
        netbsd*)
          flags=(
    	$flags[@]
    	'-u[update]'
    	'-V[show version and exit]'
          )
          ;;
        esac
    
        _arguments -s \
          $flags[@] \
          '*:package to install:_bsd_pkg_pkgfiles'
        ;;
    
      pkg_create)
        case "$OSTYPE" in
        freebsd*)
          flags=(
    	'-f[specify plist file]:plist file:_files'
    	'(-b)-c[specify comment file]:comment file:_files'
    	'(-b)-d[specify descr file]:descr file:_files'
    	'-Y[assume YES for any questions asked]'
    	'-N[assume NO for any questions asked]'
    	'(-b)-O[packing list only mode]'
    	'-v[be verbose]'
    	'-h[force tar to follow symlinks]'
    	'(-b)-i[specify pre-install script]:pre-install script:_files'
    	'(-b)-I[specify post-install script]:post-install script:_files'
    	'(-b)-P[specify initial dependencies]:dependencies:_bsd_pkg_pkgs'
    	'(-b)-p[specify prefix]:prefix directory:_files -/'
    	'(-b)-k[specify deinstall script]:deinstall script:_files'
    	'(-b)-K[specify post-deinstall script]:post-deinstall script:_files'
    	'(-b)-r[specify req script]:req script:_files'
    	'(-b)-s[specify source directory]:source directory:_files -/'
    	'(-b)-t[specify mktemp template]:mktemp template:_files'
    	'(-b)-X[specify exclude file]:exclude file for tar:_files'
    	'(-b)-D[specify message file]:message file:_files'
    	'(-b)-m[specify mtree file]:mtree file:_files'
    	'(-b)-o[specify origin]:origin:_files -W ${PORTSDIR\:-/usr/ports} -/'
    	'-j[use bzip2]'
    	'-z[use gzip]'
    	'(-c -d -O -i -I -P -p -k -K -r -s -t -X -D -m -o)-b[specify pkgname]:pkgname:_bsd_pkg_pkgs'
    	'*:package file name:_files'
          )
          ;;
        netbsd*)
          # NetBSD users, improve me!
          flags=(
    	'*:package name:_bsd_pkg_pkgs'
          )
          ;;
        esac
    
        _arguments -s \
          $flags[@]
          ;;
    
      pkg_delete)
        flags=(
          '-D[don'\''t execute deinstallation scripts]'
          '-d[remove empty directories]'
          '-f[force deinstallation]'
          '-n[don'\''t really deinstall packages]'
          '-p[specify prefix]:prefix directory:_files -/'
          '-v[be verbose]'
        )
    
        case "$OSTYPE" in
        freebsd*)
          flags=(
            $flags[@]
    	'(:)-a[delete all installed packages]'
            '-G[do not expand glob patterns]'
    	'-i[be interactive]'
            '-r[delete recursively]'
            '-x[use regular expression]'
          )
          ;;
        netbsd*)
          flags=(
    	$flags[@]
    	'(:)-a[delete all installed packages]'
    	'-F[specify each package by an installed file]'
    	'-i[be interactive]'
    	'-O[only delete the package'\''s entries]'
            '-R[delete upward recursively]'
            '-r[delete recursively]'
    	'-V[show version and exit]'
          )
          ;;
        esac
    
        _arguments -s \
          $flags[@] \
          '(-a)*:package name:_bsd_pkg_pkgs_and_files'
        ;;
    
      pkg_info)
        flags=(
          '(:)-a[show all installed packages]'
          '-c[show comment fields]'
          '-D[show install-message files]'
          '-d[show long descriptions]'
          '-e[test if package is installed]:package name:_bsd_pkg_pkgs'
          '-f[show packing list instructions]'
          '-I[show index lines]'
          '-i[show install scripts]'
          '-k[show deinstall scripts]'
          '-L[show full pathnames of files]'
          '-l[specify prefix string]:prefix string:'
          '-m[show mtree files]'
          '-p[show installation prefixes]'
          '-q[be quiet]'
          '-R[show list list of installed requiring packages]'
          '-r[show requirements scripts]'
          '-v[be verbose]'
        )
    
        case "$OSTYPE" in
        freebsd*)
          flags=(
            $flags[@]
            '-G[do not expand glob patterns]'
    	'-g[show files that'\''s modified]'
    	'-o[show origin]'
    	'-s[show total size occupied by each package]'
    	'-t[specify mktemp template]:mktemp template:_files -/'
    	'*-W[show which package the file belongs to]:file:_files'
    	'-x[use regular expression]'
          )
          ;;
        netbsd*)
          flags=(
    	$flags[@]
    	'-B[show build information]'
    	'-b[show RCS Id strings]'
    	'-F[specify each package by an installed file]'
    	'-S[show total size occupied by each package and its dependents]'
    	'-s[show total size occupied by each package]'
    	'-V[show version and exit]'
          )
          ;;
        esac
    
        _arguments -s \
          $flags[@] \
          '(-a)*:package name:_bsd_pkg_pkgs_and_files'
        ;;
      esac
    }
    
    _bsd_pkg "$@"
    PK[W/functions/_svcsnuW+A#compdef svcs
    
    _svcs() {
    	local -a cols
    
    	cols=(
    		ctid\:"Contract ID" desc\:"Description" fmri\:"FMRI"
    		inst\:"Instance name" nsta\:"Next state (abbr)" nstate\:"Next state"
    		scope\:"Scope name" svc\:"Service name" sta\:"State (abbr)"
    		state\:"State" stime\:"Start time"
    	)
    
    	_arguments -s \
    		'(-l -x -d -D)-a[list all instances]' \
    		'(-l -x -D -a -R)-d[list dependencies]' \
    		'(-l -x -d -a -R)-D[list dependents]' \
    		'(-l -x)-H[suppress header line]' \
    		'(-x -d -D -a -R -s)-l[print detailed status about services and instances]' \
    		'(-l -x)-o[display specific columns]:column:_values -s , "column" ${^cols/\:/[}\]' \
    		'(-l -x)-p[list processes]' \
    		'(-l -x -d -D)-R[list services with the given restarter]:instance FMRI:_svcs_fmri -i' \
    		'(-l -x)-s[sort by a column]:column:(($cols))' \
    		'(-l -x)-S[reverse sort by a column]:column:(($cols))' \
    		'-v[verbose columns]' \
    		'(-l)-x[display explanation for service states]' \
    		'(-l -x)-\?[print help]' \
    		'*:FMRI or pattern:_svcs_fmri -i'
    }
    
    _svcs "$@"
    
    # vi:tw=0
    PK[Ժfunctions/chpwd_recent_addnuW+A# Helper for chpwd_recent_dirs.
    # Add a directory to the reply array unless we're skipping it.
    # If skipping, return non-zero status.
    
    local pat
    local add=$1
    local -a prune patterns
    
    zstyle -a ':chpwd:' recent-dirs-prune prune
    if (( ${#prune} )); then
      patterns=(${${prune:#^pattern:*}##pattern:})
    fi
    
    for pat in $patterns; do
      if [[ $add =~ ${~pat} ]]; then
        return 1
      fi
    done
    
    if [[ ${prune[(I)parent]} -ne 0 && $add = $reply[1]/* ]]; then
      # replace
      reply=($reply[2,-1])
    fi
    reply=($add $reply)
    PK[1OOfunctions/kill-word-matchnuW+Aemulate -L zsh
    setopt extendedglob
    
    autoload -Uz match-words-by-style
    
    local curcontext=":zle:$WIDGET" word done
    local -a matched_words
    integer count=${NUMERIC:-1}
    
    if (( count < 0 )); then
      (( NUMERIC = -count ))
      zle backward-$WIDGET
      return
    fi
    
    while (( count-- )); do
      match-words-by-style
    
      word="${(j..)matched_words[4,5]}"
    
      if [[ -n $word ]]; then
        if [[ -n $done || $LASTWIDGET = *kill* ]]; then
          CUTBUFFER="$CUTBUFFER$word"
        else
          zle copy-region-as-kill -- $word
        fi
        RBUFFER=${(j..)matched_words[6,7]}
      else
        return 1
      fi
      done=1
    done
    
    return 0
    PK[ccfunctions/_kldnuW+A#compdef kldload kldunload
    
    (( $+functions[_kld_module] )) ||
    _kld_module() {
      local ret=1
    
      compadd "$@" - /boot/kernel/*.ko(-.:t) /modules/*.ko(-.:t) && ret=0
      _files "$@" -g '*.ko(-.)' && ret=0
    
      return ret
    }
    
    (( $+functions[_kld_unload] )) ||
    _kld_unload() {
      compadd "$@" - $( /sbin/kldstat | awk '($1 ~ /^[0-9]/) { print $5 }' )
    }
    
    (( $+functions[_kld_unload_id] )) ||
    _kld_unload_id() {
      compadd "$@" - $( /sbin/kldstat | awk '($1 ~ /^[0-9]/) { print $1 }' )
    }
    
    _kld() {
      unset _cache_sysctlvars
    
      case "$service" in
      kldload)
        _arguments -s \
            '-v[be verbose]' \
            '*:module to load:_kld_module'
        ;;
    
      kldunload)
        _arguments -s \
            '-v[be verbose]' \
            '(-n)-i:module id to unload:_kld_unload_id' \
            '(-i)-n:module to unload:_kld_unload' \
            '*:module to unload:_kld_unload'
        ;;
      esac
    }
    
    _kld "$@"
    PK[hfunctions/_portmasternuW+A#compdef portmaster
    
    _portmaster_pkgs() {
      compadd "$@" - ${PKG_DBDIR:-/var/db/pkg}/*(/:t)
    }
    
    _portmaster_ports() {
      local ret=1 _fbsd_ports _fbsd_cat
       _fbsd_cat=(${PORTSDIR:-/usr/ports}/[a-z]*(/:t))
       if [[ $PREFIX != */* ]] ; then
         _wanted cat_packages expl 'category/ports' compadd -S '/' $_fbsd_cat
       else
         compset -P '*/'
         _fbsd_ports=(${PORTSDIR:-/usr/ports}/$IPREFIX/*(/:t))
         _wanted cat_packages expl 'category/ports' compadd $_fbsd_ports
       fi
      return ret
    }
    
    _portmaster_pkgs_and_ports() {
      local ret=1
      _portmaster_pkgs && ret=0
      _portmaster_ports && ret=0
    
      return ret
    }
    
    _portmaster() {
      local specific_args common_args expunge_args standalone_args kid
      standalone_args=(
      '--clean-distfiles[delete distfiles not associated with an installed ports: interactive]'
      '--clean-distfiles-all[delete distfiles not associated with an installed ports]'
      '--check-depends[cross-check and update dependency information for all ports]'
      '--check-port-dbdir[check for stale entries in /var/db/ports]'
      '--list-origins[list directories from /usr/ports for root and leaf ports]'
      '-l[list all installed ports by category]'
      '-L[list all installed ports by category, and search for updates]'
      {'(-help)-h','(-h)--help'}'[display help message]:'
        '--version[display the version only]:'
        )
        specific_args=(
        '(-s -r -o)-e[expunge port using pkg_delete, and remove all distfiles]:name of port:_portmaster_pkgs'
        '(-e -r -o)-s[clean out stale ports that used to be depended on]'
        '(-e -s -o)-r[rebuild the specified port, and all ports that depend on it]:name/glob of port:_portmaster_pkgs'
        '(-e -s -r)-o[replace the installed port with a port from a different origin]:new port dir:_portmaster_ports'
        )
        expunge_args=(
        '(-b)-B[prevents creation of the backup package for the installed port]'
        '(-d)-D[no cleaning of distfiles]'
        '(-D)-d[always clean distfiles]'
        )
        common_args=(
        "(-G)--force-config[run 'make config' for all ports]" 
        "-C[prevents 'make clean' from being run before building]"
        '-H[hide details of the port build and install in a log file]'
        "-K[prevents 'make clean' from being run after building]"
        '(-B)-b[create and keep a backup package of an installed port]'
        '-g[create a package of the new port]'
        '-n[run through configure, but do not make or install any ports]'
        '-t[recurse dependencies thoroughly, using all-depends-list]'
        '-v[verbose output]'
        '-w[save old shared libraries before deinstall]'
        '-u[unattended mode]'
        '(-i)-f[always rebuild ports]'
        '(-f)-i[interactive update mode]'
        '-m[any arguments to supply to make]:arguments for make:'
        '-x[avoid building or updating ports that match this pattern]:glob pattern to exclude from building:'
        '-p[specify the full path to a port directory]:a port directory:'
        '--show-work[show what dependent ports are, and are not installed]'
        '-R[restart an update, skipping ports already up to date]' 
        '-a[check all ports, update as necessary]'
        '-F[fetch distfiles only]'
        $expunge_args
        $specific_args
        )
        if (( CURRENT == 2 ));then
          _arguments -s \
          $standalone_args \
          $common_args \
          '*:packages and ports:_portmaster_pkgs_and_ports'
        else 
          case "$words[2]" in
    	--clean-distfiles|--clean-distfiles-all|--check-depends|--check-port-dbdir|--version|-help|-h)
    	return 0
    	;;
    	*)
    	if (( $words[(I)-(e|r)] ));then
    	  _arguments -s \
    	  '*:packages:_portmaster_pkgs'
    	elif (( kid=$words[(I)-o] ));then
    	  if (( CURRENT == $kid + 1 ));then
    	    _arguments -s \
    	    '*:ports replacing:_portmaster_ports'
    	  elif (( CURRENT == $kid + 2 )); then
    	    _arguments -s \
    	    '*:package to replace:_portmaster_pkgs'
    	  else 
    	    return 0
    	  fi
    	elif (( $words[(I)-s] ));then
    	  return 0
    	else
    	  _arguments -s \
    	  $common_args \
    	  '*:packages and ports:_portmaster_pkgs_and_ports'
    	fi
    	;;
          esac
        fi
      }
    
      _portmaster "$@"
    PK[ٞfunctions/_alternativenuW+A#autoload
    
    local tags def expl descr action mesgs nm="$compstate[nmatches]" subopts
    local opt ws curcontext="$curcontext"
    
    subopts=()
    while getopts 'O:C:' opt; do
      case "$opt" in
      O) subopts=( "${(@P)OPTARG}" ) ;;
      C) curcontext="${curcontext%:*}:$OPTARG" ;;
      esac
    done
    
    shift OPTIND-1
    
    [[ "$1" = -(|-) ]] && shift
    
    mesgs=()
    
    _tags "${(@)argv%%:*}"
    
    while _tags; do
      for def; do
        if _requested "${def%%:*}"; then
          descr="${${def#*:}%%:*}"
          action="${def#*:*:}"
    
          _description "${def%%:*}" expl "$descr"
    
          if [[ "$action" = \ # ]]; then
    
            # An empty action means that we should just display a message.
    
            mesgs=( "$mesgs[@]" "${def%%:*}:$descr")
          elif [[ "$action" = \(\(*\)\) ]]; then
    
            # ((...)) contains literal strings with descriptions.
    
            eval ws\=\( "${action[3,-3]}" \)
    
            _describe -t "${def%%:*}" "$descr" ws -M 'r:|[_-]=* r:|=*' "$subopts[@]"
          elif [[ "$action" = \(*\) ]]; then
    
            # Anything inside `(...)' is added directly.
    
            _all_labels "${def%%:*}" expl "$descr" \
                compadd "$subopts[@]" - ${=action[2,-2]}
          elif [[ "$action" = \{*\} ]]; then
    
            # A string in braces is evaluated.
    
            while _next_label "${def%%:*}" expl "$descr"; do
              eval "$action[2,-2]"
            done
          elif [[ "$action" = \ * ]]; then
    
            # If the action starts with a space, we just call it.
    
            eval "action=( $action )"
            while _next_label "${def%%:*}" expl "$descr"; do
              "$action[@]"
            done
          else
    
            # Otherwise we call it with the description-arguments built above.
    
            eval "action=( $action )"
    	while _next_label "${def%%:*}" expl "$descr"; do
              "$action[1]" "$subopts[@]" "$expl[@]" "${(@)action[2,-1]}"
            done
          fi
        fi
      done
      [[ nm -ne compstate[nmatches] ]] && return 0
    done
    
    for descr in "$mesgs[@]"; do
      _message -e "${descr%%:*}" "${descr#*:}"
    done
    
    return 1
    PK[O%((functions/_promptnuW+A#compdef prompt
    
    _arguments -s \
      '-l[list themes]:*:' \
      '-c[show selected theme]:*:' \
      "-h[help]::prompt theme:($prompt_themes):*:" \
      "-p[preview theme(s)]:*:prompt theme:($prompt_themes)" \
      "-s[set and save theme]:prompt theme:($prompt_themes):*:" \
      ":prompt theme:($prompt_themes)"
    PK[HPmmfunctions/select-word-stylenuW+Aemulate -L zsh
    setopt extendedglob
    
    local -a word_functions
    
    word_functions=(backward-kill-word backward-word
        capitalize-word down-case-word
        forward-word kill-word
        transpose-words up-case-word)
    
    [[ -z $1 ]] && autoload -Uz read-from-minibuffer
    
    local REPLY detail f wordstyle
    
    if ! zle -l $word_functions[1]; then
        for f in $word_functions; do
    	autoload -Uz $f-match
    	zle -N $f $f-match
        done
    fi
    
    
    while true; do
    
        if [[ -n $WIDGET && -z $1 ]]; then
    	read-from-minibuffer -k1 "Word styles (hit return for more detail):
    (b)ash (n)ormal (s)hell (w)hitespace (d)efault (q)uit
    (B), (N), (S), (W) as above with subword matching
    ${detail}? " || return 1
        else
    	REPLY=$1
        fi
    
        detail=
    
        case $REPLY in
    	([bB]*)
    	# bash style
    	wordstyle=standard
    	zstyle ':zle:*' word-chars ''
    	;;
    
    	([nN]*)
    	# normal zsh style
    	wordstyle=standard
    	zstyle ':zle:*' word-chars "$WORDCHARS"
    	;;
    
    	([sS]*)
    	# shell command arguments or special tokens
    	wordstyle=shell
    	;;
    
    	([wW]*)
    	# whitespace-delimited
    	wordstyle=space
    	;;
    
    	(d*)
    	# default: could also return widgets to builtins here
    	wordstyle=
    	zstyle -d ':zle:*' word-chars
    	;;
    
    	(q*)
    	# quit without setting
    	return 1
    	;;
    
    	(*)
    	detail="\
    (b)ash:       Word characters are alphanumerics only
    (n)ormal:     Word characters are alphanumerics plus \$WORDCHARS
    (s)hell:      Words are command arguments using shell syntax
    (w)hitespace: Words are whitespace-delimited
    (d)efault:    Use default, no special handling (usually same as \`n')
    (q)uit:       Quit without setting a new style
    "
    	if [[ -z $WIDGET || -n $1 ]]; then
    	    print "Usage: $0 word-style
    where word-style is one of the characters in parentheses:
    $detail" >&2
    	    return 1
    	fi
    	continue
    	;;
        esac
    
        if [[ -n $wordstyle ]]; then
          if [[ $REPLY = [[:upper:]]* ]]; then
    	wordstyle+=-subword
          fi
          zstyle ':zle:*' word-style $wordstyle
        fi
        return
    done
    PK[6
    functions/_shnuW+A#compdef sh ksh bash zsh csh tcsh rc
    
    if [[ $service == zsh ]]; then
      # try a bit harder
      if [[ ${words[CURRENT-1]} == -o ]]; then
        _options
        # no other possibilities
        return
      fi
    fi
    
    if (( CURRENT == ${words[(i)-c]} + 1 )); then
      compset -q
      _normal
    else
      local n=${words[(b:2:i)[^-]*]}
      if (( n <= CURRENT )); then
        compset -n $n
        _alternative \
          'files:file:_files' \
          'commands:command:_normal' && return 0
      fi
      _default
    fi
    PK[[Lfunctions/VCS_INFO_get_data_bzrnuW+A## vim:ft=zsh
    ## bazaar support by: Frank Terbeck 
    ## Distributed under the same BSD-ish license as zsh itself.
    
    setopt localoptions noksharrays extendedglob NO_shwordsplit
    local bzrbase bzrbr
    local -a bzrinfo
    local -xA hook_com
    
    if zstyle -t ":vcs_info:${vcs}:${usercontext}:${rrn}" "use-simple" ; then
        bzrbase=${vcs_comm[basedir]}
        bzrinfo[2]=${bzrbase:t}
        if [[ -f ${bzrbase}/.bzr/branch/last-revision ]] ; then
            bzrinfo[1]=$(< ${bzrbase}/.bzr/branch/last-revision)
            bzrinfo[1]=${${bzrinfo[1]}%% *}
        fi
    else
        bzrbase=${${(M)${(f)"$( ${vcs_comm[cmd]} info )"}:# ##branch\ root:*}/*: ##/}
        bzrinfo=( ${${${(M)${(f)"$( ${vcs_comm[cmd]} version-info )"}:#(#s)(revno|branch-nick)*}/*: /}/*\//} )
        bzrbase="$(VCS_INFO_realpath ${bzrbase})"
    fi
    
    rrn=${bzrbase:t}
    zstyle -s ":vcs_info:${vcs}:${usercontext}:${rrn}" branchformat bzrbr || bzrbr="%b:%r"
    hook_com=( branch "${bzrinfo[2]}" revision "${bzrinfo[1]}" )
    if VCS_INFO_hook 'set-branch-format' "${bzrbr}"; then
        zformat -f bzrbr "${bzrbr}" "b:${hook_com[branch]}" "r:${hook_com[revision]}"
    else
        bzrbr=${hook_com[branch-replace]}
    fi
    hook_com=()
    VCS_INFO_formats '' "${bzrbr}" "${bzrbase}" '' '' "${bzrinfo[1]}" ''
    return 0
    PK[4QنYYfunctions/_fortunenuW+A#compdef fortune
    
    _arguments \
      '-a[choose from all lists of maxims, both offensive and not]' \
      '-c[show the cookie file from which the fortune came]' \
      '-e[consider all fortune files to be of equal size]' \
      '-f[print out the list of files which would be searched]' \
      '-l[long dictums only]' \
      '-m[print all matches to regex]:BRE' \
      '-n[set longest length to be short]:length' \
      '-o[choose only from potentially offensive aphorisms]' \
      '-s[short apothegms only]' \
      '-i[ignore case for -m patterns]' \
      '-w[wait before termination for a time based on msg length]' \
      '*:databases'
    PK[$functions/_wanna-buildnuW+A#compdef wanna-build
    
    _arguments \
      '(-v --verbose)'{-v,--verbose}'[verbose]' \
      '--take[take package for building]' \
      '(-f --failed)'{-f,--failed}'[record as failed]' \
      '(-u --uploaded)'{-u,--uploaded}'[record as uploaded]' \
      '(-n --no-build)'{-n,--no-build}'[record as undesired]' \
      '--dep-wait[record as waiting for source dependencies]' \
      '--merge-quinn[merge quinn-diff output into database]' \
      '--merge-partial-quinn[merge partial quinn-diff output into database]' \
      '--merge-packages[merge Packages files into database]' \
      '--merge-sources[merge Sources files into database]' \
      '--merge-all' \
      '--pretend-avail[pretend that given packages are available now]' \
      '(-i --info)'{-i,--info=}':source package:_deb_packages avail' \
      '(-l --list)'{-l,--list=}':state:(needs-build building uploaded failed installed dep-wait not-for-us all failed-removed dep-wait-removed install-wait reupload-wait)' \
      '(-m --message)'{-m,--message=}':message:' \
      '(-o --override)'{-o,--override}"[override another user's lock]" \
      '(-U --user)'{-U,--user=}':user name:' \
      '--import:ASCII file:_files' \
      '--export:ASCII file:_files' \
      '--create-db[create database]' \
      '--correct-compare' \
      '(-N --no-propagation)'{-N,--no-propagation} \
      '(-D --no-down-propagation)'{-D,--no-down-propagation} \
      '--give-back[give package back]' \
      '--forget' \
      '--forget-user' \
      '--binNMU:version:' \
      '--perm-build-priority:priority:' \
      '--build-priority:priority:' \
      '(-d --dist)'{-d,--dist=}':distribution:(stable testing unstable all)' \
      '(-O --order)'{-O,--order=}':ordering:(P S p s n c b)' \
      '(-b --database)'{-b,--database=}':database:' \
      '(-A --arch)'{-A,--arch=}':architecture:' \
      '(-c --category)'{-c,--category=}':category:(uploaded-fixed-pkg fix-expected reminder-sent nmu-offered easy medium hard compiler-error none)' \
      '(-a --min-age)'{-a,--min-age=}':minimum age:' \
      '--max-age:maximum age:' \
      '--manual-edit' \
      '--maintlock-create' \
      '--maintlock-remove' \
      '--clean-db' \
      ':package_version:_deb_packages avail'
    PK[
    qqfunctions/calendar_scandatenuW+A# Scan a line for various common date and time formats.
    # Set REPLY to the number of seconds since the epoch at which that
    # time occurs.  The time does not need to be matched; this will
    # produce midnight at the start of the date.
    #
    # Absolute times
    #
    # The rules below are fairly complicated, to allow any natural (and
    # some highly unnatural but nonetheless common) combination of
    # time and date used by English speakers.  It is recommended that,
    # rather than exploring the intricacies of the system, users find
    # a date format that is natural to them and stick to it.  This
    # will avoid unexpected effects.  Various key facts should be noted,
    # explained in more detail below:
    #
    # - In particular, note the confusion between month/day/year and
    #   day/month/year when the month is numeric; this format should be
    #   avoided if at all possible.  Many alternatives are available.
    # - However, there is currently no localization support, so month
    #   names must be English (though only the first three letters are required).
    #   The same applies to days of the week if they occur (they are not useful).
    # - The year must be given in full to avoid confusion, and only years
    #   from 1900 to 2099 inclusive are matched.
    # - Although timezones are parsed (complicated formats may not be recognized),
    #   they are then ignored; no time adjustment is made.
    # - Embedding of times within dates (e.g. "Wed Jun 16 09:30:00 BST 2010")
    #   causes horrific problems because of the combination of the many
    #   possible date and time formats to match.  The approach taken
    #   here is to match the time, remove it, and see if the nearby text
    #   looks like a date.  The problem is that the time matched may not
    #   be that associated with the date, in which case the time will be
    #   ignored.  To minimise this, when the argument "-a" is given to
    #   anchor the date/time to the start of the line, we never look
    #   beyond a newline.  So if any date/time strings in the text
    #   are on separate lines the problem is avoided.
    # - If you feel sophisticated enough and wish to avoid any ambiguity,
    #   you can use RFC 2445 date/time strings, for example 20100601T170000.
    #   These are parsed in one go.
    #
    # The following give some obvious examples; users finding here
    # a format they like and not subject to vagaries of style may skip
    # the full description.  As dates and times are matched separately
    # (even though the time may be embedded in the date), any date format
    # may be mixed with any format for the time of day provide the
    # separators are clear (whitespace, colons, commas).
    #   2007/04/03 13:13
    #   2007/04/03:13:13
    #   2007/04/03 1:13 pm
    #   3rd April 2007, 13:13
    #   April 3rd 2007 1:13 p.m.
    #   Apr 3, 2007 13:13
    #   Tue Apr 03 13:13:00 2007
    #   13:13 2007/apr/3
    #
    # Times are parsed and extracted before dates.  They must use colons
    # to separate hours and minutes, though a dot is allowed before seconds
    # if they are present.  This limits time formats to
    #   HH:MM[:SS[.FFFFF]] [am|pm|a.m.|p.m.]
    #   HH:MM.SS[.FFFFF] [am|pm|a.m.|p.m.]
    # in which square brackets indicate optional elements, possibly with
    # alternatives.  Fractions of a second are recognised but ignored.
    # Unless -r or -R are given (see below), a date is mandatory but a time of day is
    # not; the time returned is at the start of the date.
    #
    # Time zones are not handled, though if one is matched following a time
    # specification it will be removed to allow a surrounding date to be
    # parsed.  This only happens if the format of the timezone is not too
    # wacky:
    #   +0100
    #   GMT
    #   GMT-7
    #   CET+1CDT
    # etc. are all understood, but any part of the timezone that is not numeric
    # must have exactly three capital letters in the name.
    #
    # Dates suffer from the ambiguity between DD/MM/YYYY and MM/DD/YYYY.  It is
    # recommended this form is avoided with purely numeric dates, but use of
    # ordinals, eg. 3rd/04/2007, will resolve the ambiguity as the ordinal is
    # always parsed as the day of the month.  Years must be four digits (and
    # the first two must be 19 or 20); 03/04/08 is not recognised.  Other
    # numbers may have leading zeroes, but they are not required.  The
    # following are handled:
    #   YYYY/MM/DD
    #   YYYY-MM-DD
    #   YYYY/MNM/DD
    #   YYYY-MNM-DD
    #   DD[th|st|rd] MNM[,] YYYY
    #   DD[th|st|rd] MNM[,]            current year assumed
    #   MNM DD[th|st|rd][,] YYYY
    #   MNM DD[th|st|rd][,]            current year assumed
    #   DD[th|st|rd]/MM[,] YYYY
    #   DD[th|st|rd]/MM/YYYY
    #   MM/DD[th|st|rd][,] YYYY
    #   MM/DD[th|st|rd]/YYYY
    # Here, MNM is at least the first three letters of a month name,
    # matched case-insensitively.  The remainder of the month name may appear but
    # its contents are irrelevant, so janissary, febrile, martial, apricot,
    # etc. are happily handled.
    #
    # Note there are only two cases that assume the current year, the
    # form "Jun 20" or "14 September" (the only two commonly occurring
    # forms, apart from a "the" in some forms of English, which isn't
    # currently supported).  Such dates will of course become ambiguous
    # in the future, so should ideally be avoided.
    #
    # Times may follow dates with a colon, e.g. 1965/07/12:09:45; this
    # is in order to provide a format with no whitespace.  A comma
    # and whitespace are allowed, e.g. "1965/07/12, 09:45".
    # Currently the order of these separators is not checked, so
    # illogical formats such as "1965/07/12, : ,09:45" will also
    # be matched.  Otherwise, a time is only recognised as being associated
    # with a date if there is only whitespace in between, or if the time
    # was embedded in the date.
    #
    # Days of the week are not scanned, but will be ignored if they occur
    # at the start of the date pattern only.
    #
    # For example, the standard date format:
    #   Fri Aug 18 17:00:48 BST 2006
    # is handled by matching HH:MM:SS and removing it together with the
    # matched (but unused) time zone.  This leaves the following:
    #   Fri Aug 18 2006
    # "Fri" is ignored and the rest is matched according to the sixth of
    # the standard rules.
    #
    # Relative times
    # ==============
    #
    # The option -r allows a relative time.  Years (or ys, yrs, or without s),
    # months (or mths, mons, mnths, months, or without s --- "m", "ms" and
    # "mns" are ambiguous and are not handled), weeks (or ws, wks, or without
    # s) and days (or ds, dys, days, or without s), hours (or hs, hrs, with or
    # without s), minutes (or mins, with or without s) and seconds (or ss,
    # secs, with or without s) are understood.  Spaces between the numbers
    # are optional, but are required between items, although a comma
    # may be used (with or without spaces).
    #
    # Note that a year here is 365.25 days and a month is 30 days.
    #
    # With -R start_time, a relative time is parsed and start_time is treated
    # as the start of the period.  This allows months and years to be calculated
    # accurately.  If the option -m (minus) is also given the relative time is
    # taken backwards from the start time.
    #
    # This allows forms like:
    #   30 years 3 months 4 days 3:42:41
    #   14 days 5 hours
    #   4d,10hr
    # In this case absolute dates are ignored.
    
    emulate -L zsh
    setopt extendedglob # xtrace
    
    zmodload -i zsh/datetime || return 1
    
    # separator characters before time or between time and date
    # allow , - or : before the time: this allows spaceless but still
    # relatively logical dates like 2006/09/19:14:27
    # don't allow / before time !  the above
    # is not 19 hours 14 mins and 27 seconds after anything.
    local tschars="[-,:[:blank:]]"
    # start pattern for time when anchored
    local tspat_anchor="(${tschars}#)"
    # ... when not anchored
    local tspat_noanchor="(|*${tschars})"
    # separator characters between elements.  comma is fairly
    # natural punctuation; otherwise only allow whitespace.
    local schars="[.,[:space:]]"
    local -a dayarr
    dayarr=(sun mon tue wed thu fri sat)
    local daypat="${schars}#((#B)(${(j.|.)dayarr})[a-z]#~month*)"
    # Start pattern for date: treat , as space for simplicity.  This
    # is illogical at the start but saves lots of minor fiddling later.
    # Date start pattern when anchored at the start.
    # We need to be able to ignore the day here, although (for consistency
    # with the unanchored case) we don't remove it until later.
    # (The problem in the other case is that matching anything before
    # the day of the week is greedy, so the day of the week gets ignored
    # if it's optional.)
    local dspat_anchor="(|(#B)(${daypat}|)(#b)${schars}#)"
    local dspat_anchor_noday="(|${schars}#)"
    # Date start pattern when not anchored at the start.
    local dspat_noanchor="(|*${schars})"
    # end pattern for relative times: similar remark about use of $schars.
    local repat="(|s)(|${schars}*)"
    # not locale-dependent!  I don't know how to get the months out
    # of the system for the purpose of finding out where they occur.
    # We may need some completely different heuristic.
    local monthpat="(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)[a-z]#"
    integer daysecs=$(( 24 * 60 * 60 ))
    local d="[[:digit:]]"
    
    integer year year2 month month2 day day2 hour minute second then nth wday wday2
    local opt line orig_line mname MATCH MBEGIN MEND tz test rest_line
    local -a match mbegin mend
    # Flags that we found a date or a time (maybe a relative time)
    integer date_found time_found
    # Flag that it's OK to have a time only
    integer time_ok
    # Indices of positions of start and end of time and dates found.
    # These are actual character indices as zsh would normally use, i.e.
    # line[time_start,time_end] is the string for the time.
    integer time_start time_end date_start date_end
    integer anchor anchor_end debug setvar
    integer relative relative_start reladd reldate relsign=1 newadd h1 h2 hd
    
    while getopts "aAdmrR:st" opt; do
      case $opt in
        (a)
        # anchor
        (( anchor = 1 ))
        ;;
    
        (A)
        # anchor at end, too
        (( anchor = 1, anchor_end = 1 ))
        ;;
    
        (d)
        # enable debug output
        (( debug = 1 ))
        ;;
    
        (m)
        # relative with negative offsets
        (( relsign = -1 ))
        ;;
    
        (r)
        # relative with no fixed start
        (( relative = 1 ))
        ;;
    
        (R)
        # relative with fixed start supplied
        (( relative_start = OPTARG, relative = 2 ))
        ;;
    
        (s)
        (( setvar = 1 ))
        ;;
    
        (t)
        (( time_ok = 1 ))
        ;;
    
        (*)
        return 1
        ;;
      esac
    done
    shift $(( OPTIND - 1 ))
    
    line=$1
    
    local dspat dspat_noday tspat
    if (( anchor )); then
      # Anchored at the start.
      dspat=$dspat_anchor
      dspat_noday=$dspat_anchor_noday
      if (( relative )); then
        tspat=$tspat_anchor
      else
        # We'll test later if the time is associated with the date.
        tspat=$tspat_noanchor
      fi
      # We can save a huge amount of grief (I've discovered) if when
      # we're anchored to the start we ignore anything after a newline.
      # However, don't do this if we're anchored to the end.  The
      # match should fail if there are extra lines in that case.
      if [[ anchor_end -eq 0 && $line = (#b)([^$'\n']##)($'\n'*) ]]; then
        line=$match[1]
        rest_line=$match[2]
      fi
    else
      dspat=$dspat_noanchor
      dspat_noday=$dspat_noanchor
      tspat=$tspat_noanchor
    fi
    orig_line=$line
    
    # Look for a time separately; we need colons for this.
    # We want to look for the first time to ensure it's associated
    # with a date at the start of the line.  Of course there may be
    # a time followed by some other text followed by a date, but
    # in that case the whole thing is too ambiguous to worry about
    # (and we don't need to worry about this for a calendar entry where
    # the date must be at the start).
    #
    # We do this by minimal matching at the head, i.e. ${...#...}.
    # To use a case statement we'd need to be able to request non-greedy
    # matching for a pattern.
    local rest
    # HH:MM:SECONDS am/pm with optional decimal seconds
    rest=${line#(#ibm)${~tspat}(<0-12>):(<0-59>)[.:]((<0-59>)(.<->|))[[:space:]]#([ap])(|.)[[:space:]]#m(.|[[:space:]]|(#e))}
    if [[ $rest != $line ]]; then
      hour=$match[2]
      minute=$match[3]
      second=$match[5]
      [[ $match[7] = (#i)p ]] && (( hour <= 12 )) && (( hour += 12 ))
      time_found=1
    fi
    if (( time_found == 0 )); then
      # no seconds, am/pm
      rest=${line#(#ibm)${~tspat}(<0-12>):(<0-59>)[[:space:]]#([ap])(|.)[[:space:]]#m(.|[[:space:]]|(#e))}
      if [[ $rest != $line ]]; then
        hour=$match[2]
        minute=$match[3]
        [[ $match[4] = (#i)p ]] && (( hour <= 12 )) && (( hour += 12 ))
        time_found=1
      fi
    fi
    if (( time_found == 0 )); then
      # no colon, even, but a.m./p.m. indicator
      rest=${line#(#ibm)${~tspat}(<0-12>)[[:space:]]#([ap])(|.)[[:space:]]#m(.|[[:space:]]|(#e))}
      if [[ $rest != $line ]]; then
        hour=$match[2]
        minute=0
        [[ $match[3] = (#i)p ]] && (( hour <= 12 )) && (( hour += 12 ))
        time_found=1
      fi
    fi
    if (( time_found == 0 )); then
      # 24 hour clock, with seconds
      rest=${line#(#ibm)${~tspat}(<0-24>):(<0-59>)[.:]((<0-59>)(.<->|))(.|[[:space:]]|(#e))}
      if [[ $rest != $line ]]; then
        hour=$match[2]
        minute=$match[3]
        second=$match[5]
        time_found=1
      fi
    fi
    if (( time_found == 0 )); then
      rest=${line#(#ibm)${~tspat}(<0-24>):(<0-59>)(.|[[:space:]]|(#e))}
      if [[ $rest != $line ]]; then
        hour=$match[2]
        minute=$match[3]
        time_found=1
      fi
    fi
    if (( time_found == 0 )); then
      # Combined date and time formats:  here we can use an anchor because
      # we know the complete format.
      (( anchor )) && tspat=$tspat_anchor
      # RFC 2445
      rest=${line#(#ibm)${~tspat}(|\"[^\"]##\":)($~d$~d$~d$~d)($~d$~d)($~d$~d)T($~d$~d)($~d$~d)($~d$~d)([[:space:]]#|(#e))}
      if [[ $rest != $line ]]; then
        year=$match[3]
        month=$match[4]
        day=$match[5]
        hour=$match[6]
        minute=$match[7]
        second=$match[8]
        # signal don't need to take account of time in date...
        time_found=2
        date_found=1
        date_start=$mbegin[3]
        date_end=$mend[-1]
      fi
    fi
    (( hour == 24 )) && hour=0
    
    if (( time_found && ! date_found )); then
      # time was found; if data also found already, process below.
      time_start=$mbegin[2]
      time_end=$mend[-1]
      # Remove the timespec because it may be in the middle of
      # the date (as in the output of "date".
      # There may be a time zone, too, which we don't yet handle.
      # (It's not in POSIX strptime() and libraries don't support it well.)
      # This attempts to remove some of the weirder forms.
      if [[ $line[$time_end+1,-1] = (#b)[[:space:]]#([A-Z][A-Z][A-Z]|[-+][0-9][0-9][0-9][0-9])([[:space:]]|(#e))* || \
            $line[$time_end+1,-1] = (#b)[[:space:]]#([A-Z][A-Z][A-Z](|[-+])<0-12>)([[:space:]]|(#e))*  || \
            $line[$time_end+1,-1] = (#b)[[:space:]]#([A-Z][A-Z][A-Z](|[-+])<0-12>[A-Z][A-Z][A-Z])([[:space:]]|(#e))* ]]; then
         (( time_end += ${mend[-1]} ))
         tz=$match[1]
      fi
      line=$line[1,time_start-1]$line[time_end+1,-1]
      (( debug )) && print "line after time: $line"
    fi
    
    if (( relative == 0 && date_found == 0 )); then
      # Date.
      case $line in
      # Look for YEAR[-/.]MONTH[-/.]DAY
      ((#bi)${~dspat}((19|20)[0-9][0-9])[-/](<1-12>)[-/](<1-31>)*)
      year=$match[2]
      month=$match[4]
      day=$match[5]
      date_start=$mbegin[2] date_end=$mend[5]
      date_found=1
      ;;
    
      # Same with month name
      ((#bi)${~dspat}((19|20)[0-9][0-9])[-/]${~monthpat}[-/](<1-31>)*)
      year=$match[2]
      mname=$match[4]
      day=$match[5]
      date_start=$mbegin[2] date_end=$mend[5]
      date_found=1
      ;;
    
      # Look for DAY[th/st/nd/rd] MNAME[,] YEAR
      ((#bi)${~dspat}(<1-31>)(|th|st|nd|rd)[[:space:]]##${~monthpat}(|,)[[:space:]]##((19|20)[0-9][0-9])*)
      day=$match[2]
      mname=$match[4]
      year=$match[6]
      date_start=$mbegin[2] date_end=$mend[6]
      date_found=1
      ;;
    
      # Look for MNAME DAY[th/st/nd/rd][,] YEAR
      ((#bi)${~dspat}${~monthpat}[[:space:]]##(<1-31>)(|th|st|nd|rd)(|,)[[:space:]]##((19|20)[0-9][0-9])*)
      mname=$match[2]
      day=$match[3]
      year=$match[6]
      date_start=$mbegin[2] date_end=$mend[6]
      date_found=1
      ;;
    
      # Look for DAY[th/st/nd/rd] MNAME; assume current year
      ((#bi)${~dspat}(<1-31>)(|th|st|nd|rd)[[:space:]]##${~monthpat}(|,)([[:space:]]##*|))
      day=$match[2]
      mname=$match[4]
      strftime -s year "%Y" $EPOCHSECONDS
      date_start=$mbegin[2] date_end=$mend[5]
      date_found=1
      ;;
    
      # Look for MNAME DAY[th/st/nd/rd]; assume current year
      ((#bi)${~dspat}${~monthpat}[[:space:]]##(<1-31>)(|th|st|nd|rd)(|,)([[:space:]]##*|))
      mname=$match[2]
      day=$match[3]
      strftime -s year "%Y" $EPOCHSECONDS
      date_start=$mbegin[2] date_end=$mend[5]
      date_found=1
      ;;
    
      # Now it gets a bit ambiguous.
      # Look for DAY[th/st/nd/rd][/]MONTH[/ ,]YEAR
      ((#bi)${~dspat}(<1-31>)(|th|st|nd|rd)/(<1-12>)((|,)[[:space:]]##|/)((19|20)[0-9][0-9])*)
      day=$match[2]
      month=$match[4]
      year=$match[7]
      date_start=$mbegin[2] date_end=$mend[7]
      date_found=1
      ;;
    
      # Look for MONTH[/]DAY[th/st/nd/rd][/ ,]YEAR
      ((#bi)${~dspat}(<1-12>)/(<1-31>)(|th|st|nd|rd)((|,)[[:space:]]##|/)((19|20)[0-9][0-9])*)
      month=$match[2]
      day=$match[3]
      year=$match[7]
      date_start=$mbegin[2] date_end=$mend[7]
      date_found=1
      ;;
    
      # Look for WEEKDAY
      ((#bi)${~dspat_noday}(${~daypat})(|${~schars})*)
      integer wday_now wday
      local wdaystr=${(L)match[3]}
      date_start=$mbegin[2] date_end=$mend[2]
    
      # Find the day number.
      local -a wdays
      # This is the ordering of %w in strtfime (zero-offset).
      wdays=(sun mon tue wed thu fri sat sun)
      (( wday = ${wdays[(i)$wdaystr]} - 1 ))
    
      # Find the date for that day.
      (( then = EPOCHSECONDS ))
      strftime -s wday_now "%w" $then
      # Day is either today or in the past.
      (( wday_now < wday )) && (( wday_now += 7 ))
      (( then -= (wday_now - wday) * 24 * 60 * 60 ))
      strftime -s year "%Y" $then
      strftime -s month "%m" $then
      strftime -s day "%d" $then
      date_found=1
      ;;
    
      # Look for "today", "yesterday", "tomorrow"
      ((#bi)${~dspat_noday}(yesterday|today|tomorrow|now)(|${~schars})*)
      (( then = EPOCHSECONDS ))
      case ${(L)match[2]} in
        (yesterday)
        (( then -= daysecs ))
        ;;
    
        (tomorrow)
        (( then += daysecs ))
        ;;
    
        (now)
        time_found=1 time_end=0 time_start=1
        strftime -s hour "%H" $then
        strftime -s minute "%M" $then
        strftime -s second "%S" $then
        ;;
      esac
      strftime -s year "%Y" $then
      strftime -s month "%m" $then
      strftime -s day "%d" $then
      date_start=$mbegin[2] date_end=$mend[2]
      date_found=1
      ;;
      esac
    fi
    
    if (( date_found || (time_ok && time_found) )); then
      # date found
      # see if there's a day at the start
      if (( date_found )); then
        if [[ ${line[1,$date_start-1]} = (#bi)${~daypat}${~schars}# ]]; then
    	    date_start=$mbegin[1]
        fi
        line=${line[1,$date_start-1]}${line[$date_end+1,-1]}
      fi
      if (( time_found == 1 )); then
        if (( date_found )); then
          # If we found a time, it must be associated with the date,
          # or we can't use it.  Since we removed the time from the
          # string to find the date, however, it's complicated to
          # know where both were found.  Reconstruct the date indices of
          # the original string.
          if (( time_start <= date_start )); then
    	# Time came before start of date; add length in.
    	(( date_start += time_end - time_start + 1 ))
          fi
          if (( time_start <= date_end )); then
    	(( date_end += time_end - time_start + 1 ))
          fi
    
          if (( time_end + 1 < date_start )); then
    	# If time wholly before date, OK if only separator characters
    	# in between.  (This allows some illogical stuff with commas
    	# but that's probably not important.)
    	if [[ ${orig_line[time_end+1,date_start-1]} != ${~schars}# ]]; then
    	  # Clearly this can't work if anchor is set.  In principle,
    	  # we could match the date and ignore the time if it wasn't.
    	  # However, that seems dodgy.
    	  return 1
    	else
    	  # Form massaged line by removing the entire date/time chunk.
    	  line="${orig_line[1,time_start-1]}${orig_line[date_end+1,-1]}"
    	fi
          elif (( date_end + 1 < time_start )); then
    	# If date wholly before time, OK if only time separator characters
    	# in between.  This allows 2006/10/12:13:43 etc.
    	if [[ ${orig_line[date_end+1,time_start-1]} != ${~tschars}# ]]; then
    	  # Here, we assume the time is associated with something later
    	  # in the line.  This is pretty much inevitable for the sort
    	  # of use we are expecting.  For example,
    	  #   2006/10/24  Meeting from early, may go on till 12:00.
    	  # or with some uses of the calendar system,
    	  #   2006/10/24 MR 1 Another pointless meeting WARN 01:00
    	  # The 01:00 says warn an hour before, not that the meeting starts
    	  # at 1 am.  About the only safe way round would be to force
    	  # a time to be present, but that's not how the traditional
    	  # calendar programme works.
    	  #
    	  # Hence we need to reconstruct.
    	  (( time_found = 0, hour = 0, minute = 0, second = 0 ))
    	  line="${orig_line[1,date_start-1]}${orig_line[date_end+1,-1]}"
    	else
    	  # As above.
    	  line="${orig_line[1,date_start-1]}${orig_line[time_end+1,-1]}"
    	fi
          fi
        else
          # Time only.
          # We didn't test anchors for time originally, since it
          # might have been embedded in the date.  If there's no date,
          # we need to test specially.
          if (( anchor )) &&
    	[[ ${orig_line[1,time_start-1]} != ${~tschars}# ]]; then
    	# Anchor at start failed.
    	return 1
          fi
          strftime -s year "%Y" $EPOCHSECONDS
          strftime -s month "%m" $EPOCHSECONDS
          strftime -s day "%d" $EPOCHSECONDS
          # Date now handled.
          (( date_found = 1 ))
        fi
        if (( debug )); then
          print "Time string: $time_start,$time_end:" \
    	"'$orig_line[time_start,time_end]'"
          (( date_ok )) && print "Date string: $date_start,$date_end:" \
    	"'$orig_line[date_start,date_end]'"
          print "Remaining line: '$line$rest_line'"
        fi
      fi
    fi
    
    if (( relative )); then
      if (( relative == 2 )); then
        # Relative years and months are variable, and we may need to
        # be careful about days.
        strftime -s year "%Y" $relative_start
        strftime -s month "%m" $relative_start
        strftime -s day "%d" $relative_start
        strftime -rs then "%Y:%m:%d" "${year}:${month}:${day}"
      fi
      if [[ $line = (#bi)${~dspat}(<->|)[[:space:]]#(y|yr|year|yearly)${~repat} ]]; then
        [[ -z $match[2] ]] && match[2]=1
        if (( relative == 2 )); then
          # We need the difference between relative_start & the
          # time ${match[2]} years later.  This means keeping the month and
          # day the same and changing the year.
          (( year2 = year + relsign * ${match[2]} ))
          strftime -rs reldate "%Y:%m:%d" "${year2}:${month}:${day}"
    
          # If we've gone from a leap year to a non-leap year, go back a day.
          strftime -s month2 "%m" $reldate
          (( month2 != month )) && (( reldate -= daysecs ))
    
          # Keep this as a difference for now since we may need to add in other stuff.
          (( reladd += reldate - then ))
        else
          (( reladd += relsign * ((365*4+1) * daysecs * ${match[2]} + 1) / 4 ))
        fi
        line=${line[1,$mbegin[2]-1]}${line[$mend[4]+1,-1]}
        time_found=1
      fi
      if [[ $line = (#bi)${~dspat}(<->|)[[:space:]]#(mth|mon|mnth|month|monthly)${~repat} ]]; then
         [[ -z $match[2] ]] && match[2]=1
         if (( relative == 2 )); then
           # Need to add on ${match[2]} months as above.
           (( month2 = month + relsign * ${match[2]} ))
           if (( month2 <= 0 )); then
    	 # going backwards beyond start of given year
    	 (( year2 = year + month2 / 12 - 1, month2 = month2 + (year-year2)*12 ))
           else
    	 (( year2 = year + (month2 - 1)/ 12, month2 = (month2 - 1) % 12 + 1 ))
           fi
           strftime -rs reldate "%Y:%m:%d" "${year2}:${month2}:${day}"
    
           # If we've gone past the end of the month because it was too short,
           # we have two options (i) get the damn calendar fixed (ii) wind
           # back to the end of the previous month.  (ii) is easier for now.
           if (( day > 28 )); then
    	 while true; do
    	   strftime -s day2 "%d" $reldate
    	   # There are only up to 3 days in it, so just wind back one at a
               # time.  Saves counting.
    	   (( day2 >= 28 )) && break
    	   (( reldate -= daysecs ))
    	 done
           fi
    
           (( reladd += reldate - then ))
         else
           (( reladd += relsign * 30 * daysecs * ${match[2]} ))
         fi
         line=${line[1,$mbegin[2]-1]}${line[$mend[4]+1,-1]}
         time_found=1
      fi
      # For the next three items we accumulate adjustments in "newadd".
      # See note below for why they are special.
      if [[ $relative = 2 && $line = (#bi)${~dspat_noday}(<->)(th|rd|nd|st)(${~daypat})(|${~schars}*) ]]; then
         nth=$match[2]
         test=${(L)${${match[4]##${~schars}#}%%${~schars}#}[1,3]}
         wday=${dayarr[(I)$test]}
         if (( wday )); then
           line=${line[1,$mbegin[2]-1]}${line[$mend[4]+1,-1]}
           time_found=1
           # We want weekday 0 to 6
           (( wday-- ))
           (( reldate = relative_start + reladd ))
           strftime -s year2 "%Y" $reldate
           strftime -s month2 "%m" $reldate
           # Find day of week of the first of the month we've landed on.
           strftime -rs then "%Y:%m:%d" "${year2}:${month2}:1"
           strftime -s wday2 "%w" $then
           # Calculate day of month
           (( day = 1 + (wday - wday2) + (nth - 1) * 7 ))
           (( wday < wday2 )) && (( day += 7 ))
           # whereas the day of the month calculated so far is...
           strftime -s day2 "%d" $reldate
           # so we need to compensate by...
           (( newadd += (day - day2) * daysecs ))
         fi
      fi
      if [[ $line = (#bi)${~dspat}(<->|)[[:space:]]#(w|wk|week|weekly)${~repat} ]]; then
         [[ -z $match[2] ]] && match[2]=1
         (( newadd += relsign * 7 * daysecs * ${match[2]} ))
         line=${line[1,$mbegin[2]-1]}${line[$mend[4]+1,-1]}
         time_found=1
      fi
      if [[ $line = (#bi)${~dspat}(<->|)[[:space:]]#(d|dy|day|daily)${~repat} ]]; then
         [[ -z $match[2] ]] && match[2]=1
         (( newadd += relsign * daysecs * ${match[2]} ))
         line=${line[1,$mbegin[2]-1]}${line[$mend[4]+1,-1]}
         time_found=1
      fi
      if (( relative == 2 && newadd )); then
        # You thought a day was always the same time?  Ho, ho, ho.
        # If the clocks go forward or back, we can gain or lose
        # an hour.  Check this by seeing what the hour is before
        # and after adding the number of days.  If it changes,
        # remove the difference.
        #
        # We need this correction for days (including days of a given
        # month) and weeks.
        # We don't need it for years and months because we calculated
        # those by actually looking at the calendar for a given
        # time of day, so the adjustment came out in the wash.
        # We don't need it for hours or smaller periods because
        # presumably if a user asks for something in 3 hours time
        # they don't mean 4 hours if the clocks went back and
        # 2 hours if they went forward.  At least, I think so.
        # Consider:
        #   % calendar_showdate +2d,1hr
        #   Sun Mar 25 00:37:00 GMT 2007
        #   % calendar_showdate +2d,2hr
        #   Sun Mar 25 02:37:09 BST 2007
        # At first sight that looks wrong because the clock appears
        # to jump two hours.  (Yes, it took me all of 9 seconds to
        # edit the line.)  But actually it's only jumped the hour
        # you asked for, because one is in GMT and the other in BST.
        # In principle you could say the same thing about days:
        # Sun Mar 25 00:00:00 GMT 2007  and  Mon Mar 26 01:00:00 BST 2007
        # are a day apart.  But usually if you say "same time next Tuesday"
        # you mean "when the clock says the same time, even if someone
        # has nipped in and adjusted it in the mean time", although
        # for some reason you don't usually bother saying that.
        #
        # Hope that's clear.
        strftime -s h1 "%H" $(( relative_start + reladd ))
        strftime -s h2 "%H" $(( relative_start + reladd + newadd ))
        (( hd = h2 - h1 ))
        # and of course we might go past midnight...
        if (( hd > 12 )); then
          (( hd -= 24 ))
        elif (( hd < -12 )); then
          (( hd += 24 ))
        fi
        (( newadd -= hd * 3600 ))
      fi
      (( reladd += newadd ))
      if [[ $line = (#bi)${~dspat}(<->|)[[:space:]]#(h|hr|hour|hourly)${~repat} ]]; then
         [[ -z $match[2] ]] && match[2]=1
         (( reladd += relsign * 60 * 60 * ${match[2]} ))
         line=${line[1,$mbegin[2]-1]}${line[$mend[4]+1,-1]}
         time_found=1
      fi
      if [[ $line = (#bi)${~dspat}(<->)[[:space:]]#(min|minute)${~repat} ]]; then
         (( reladd += relsign * 60 * ${match[2]} ))
         line=${line[1,$mbegin[2]-1]}${line[$mend[4]+1,-1]}
         time_found=1
      fi
      if [[ $line = (#bi)${~dspat}(<->)[[:space:]]#(s|sec|second)${~repat} ]]; then
         (( reladd += relsign * ${match[2]} ))
         line=${line[1,$mbegin[2]-1]}${line[$mend[4]+1,-1]}
         time_found=1
      fi
    fi
    
    if (( relative )); then
      # If no date was found, we're in trouble unless we found a time.
      if (( time_found )); then
        if (( anchor_end )); then
          # must be left with only separator characters
          if [[ $line != ${~schars}# ]]; then
    	return 1
          fi
        fi
        # relative_start is zero if we're not using it
        (( reladd += (hour * 60 + minute) * 60 + second ))
        typeset -g REPLY
        (( REPLY = relative_start + reladd  ))
        [[ -n $setvar ]] && typeset -g REPLY2="$line$rest_line"
        return 0
      fi
      return 1
    elif (( date_found == 0 )); then
      return 1
    fi
    
    if (( anchor_end )); then
      # must be left with only separator characters
      if [[ $line != ${~schars}# ]]; then
        return 1
      fi
    fi
    
    local fmt nums
    if [[ -n $mname ]]; then
      fmt="%Y %b %d %H %M %S"
      nums="$year $mname $day $hour $minute $second"
    else
      fmt="%Y %m %d %H %M %S"
      nums="$year $month $day $hour $minute $second"
    fi
    
    strftime -s REPLY -r $fmt $nums
    
    [[ -n $setvar ]] && typeset -g REPLY2="$line$rest_line"
    
    return 0
    PK[2Bժ""functions/zargsnuW+A# function zargs {
    #
    # This function works like GNU xargs, except that instead of reading lines
    # of arguments from the standard input, it takes them from the command
    # line.  This is possible/useful because, especially with recursive glob
    # operators, zsh often can construct a command line for a shell function
    # that is longer than can be accepted by an external command.
    #
    # Like xargs, zargs exits with the following status:
    #   0 if it succeeds
    #   123 if any invocation of the command exited with status 1-125
    #   124 if the command exited with status 255
    #   125 if the command is killed by a signal
    #   126 if the command cannot be run
    #   127 if the command is not found
    #   1 if some other error occurred.
    #
    # The full set of GNU xargs options is supported (see help text below);
    # although --eof and --max-lines therefore have odd names, they have
    # analogous meanings to their xargs counterparts.  Also zargs --help is
    # a lot more helpful than xargs --help, at least as of xargs 4.1.
    #
    # Note that "--" is used both to end the options and to begin the command,
    # so to specify some options along with an empty set of input-args, one
    # must repeat the "--" as TWO consecutive arguments, e.g.:
    #   zargs --verbose -- -- print There are no input-args
    # If there is at least one input-arg, the first "--" may be omitted:
    #   zargs -p -i one -- print There is just {} input-arg
    # Obviously, if there is no command, the second "--" may be omitted:
    #   zargs -n2 These words will be echoed in five lines of two
    #
    # BUGS:
    #
    # In the interests of expediency, numeric options (max-procs, max-lines,
    # etc.) are range-checked only when their values make a difference to the
    # end result.  Because of the way zsh handles variables in math context,
    # it's possible to pass the name of a variable as the value of a numeric
    # option, and the value of that variable becomes the value of the option.
    #
    # "Killed by a signal" is determined by the usual shell rule that $? is
    # the signal number plus 128, so zargs can be fooled by a command that
    # explicitly exits with 129+.  Also, zsh prior to 4.1.x returns 1 rather
    # than 127 for "command not found" so this function incorrectly returns
    # 123 in that case if used with zsh 4.0.x.
    #
    # With the --max-procs option, zargs may not correctly capture the exit
    # status of the backgrounded jobs, because of limitations of the "wait"
    # builtin.  If the zsh/parameter module is not available, the status is
    # NEVER correctly returned, otherwise the status of the longest-running
    # job in each batch is captured.
    #
    # Also because of "wait" limitations, --max-procs spawns max-procs jobs,
    # then waits for all of those, then spawns another batch, etc.
    #
    # Differences from POSIX xargs:
    #
    # * POSIX requires a space between -I/-L/-n/-s and their numeric argument;
    #   zargs uses zparseopts, which does not require the space.
    #
    # * POSIX -L and -n are mutually exclusive and effectively synonymous;
    #   zargs accepts both and considers -n to be a limit on the total number
    #   of arguments per command line, that is, including the initial-args.
    #   Thus the following fails with "argument list too long":
    #     zargs -n 3 -- echo Here are four words
    #   The smallest limit implied by the combination of -L and -n is used.
    #
    # * POSIX implies the last of -n/-i/-I/-l/-L on the command line is meant
    #   to cancel any of those that precede it.  (This is unspecified for
    #   -I/-L and implementations reportedly differ.)  In zargs, -i/-I have
    #   this behavior, as do -l/-L, but when -i/-I appear anywhere then -l/-L
    #   are ignored (forced to 1).
    
    emulate -L zsh || return 1
    local -a opts eof n s l P i
    
    local ZARGS_VERSION="1.4"
    
    if zparseopts -a opts -D -- \
    	-eof::=eof e::=eof \
    	-exit x \
    	-help \
    	-interactive p \
    	-max-args:=n n:=n \
    	-max-chars:=s s:=s \
    	-max-lines::=l l::=l L:=l \
    	-max-procs:=P P:=P \
    	-no-run-if-empty r \
    	-null 0 \
    	-replace::=i i::=i I:=i \
    	-verbose t \
    	-version
    then
        if (( $opts[(I)--version] ))
        then
    	print -u2 zargs version $ZARGS_VERSION zsh $ZSH_VERSION
        fi
        if (( $opts[(I)--help] ))
        then
    	>&2 <<-\HELP
    	Usage: zargs [options --] [input-args] [-- command [initial-args]]
    
    	If command and initial-args are omitted, "print -r --" is used.
    
    	Options:
    	--eof[=eof-str], -e[eof-str]
    	    Change the end-of-input-args string from "--" to eof-str.  If
    	    given as --eof=, an empty argument is the end; as --eof or -e,
    	    with no (or an empty) eof-str, all arguments are input-args.
    	--exit, -x
    	    Exit if the size (see --max-chars) is exceeded.
    	--help
    	    Print this summary and exit.
    	--interactive, -p
    	    Prompt before executing each command line.
    	--max-args=max-args, -n max-args
    	    Use at most max-args arguments per command line.
    	--max-chars=max-chars, -s max-chars
    	    Use at most max-chars characters per command line.
    	--max-lines[=max-lines], -l[max-lines]
    	    Use at most max-lines of the input-args per command line.
    	    This option is misnamed for xargs compatibility.
    	--max-procs=max-procs, -P max-procs
    	    Run up to max-procs command lines in the background at once.
    	--no-run-if-empty, -r
    	    Do nothing if there are no input arguments before the eof-str.
    	--null, -0
    	    Split each input-arg at null bytes, for xargs compatibility.
    	--replace[=replace-str], -i[replace-str]
    	    Substitute replace-str in the initial-args by each initial-arg.
    	    Implies --exit --max-lines=1.
    	--verbose, -t
    	    Print each command line to stderr before executing it.
    	--version
    	    Print the version number of zargs and exit.
    HELP
    	return 0
        fi
        if (( $opts[(I)--version] ))
        then
    	return 0
        fi
        if (( $#i ))
        then
    	l=1
    	i=${${${i##-(i|I|-replace(=|))}[-1]}:-\{\}}
    	opts[(r)-x]=-x
    	# The following is not how xargs is documented,
    	# but GNU xargs does behave as if -i implies -r.
    	opts[(r)-r]=-r
        fi
        if (( $#P ))
        then
    	P=${${P##-(P|-max-procs(=|))}:-1}
    	if [[ x${P} != x$[P] ]]
    	then
    	    print -u2 zargs: invalid number for -P option
    	    return 1
    	fi
        else P=1
        fi
    else
        return 1
    fi
    
    local -i end c=0
    if [[ $eof == -(e|-eof) ]]; then ((end=ARGC+1))
    elif (( $#eof )); then end=$argv[(i)${eof##-(e|-eof=)}]
    else end=$argv[(i)--]
    fi
    local -a args call command; command=( ${argv[end+1,-1]} )
    
    if (( $opts[(I)-(null|0)] ))
    then set -- ${(ps:\000:)argv[1,end-1]}
    else set -- $argv[1,end-1]
    fi
    
    if [[ -n $command ]]
    then (( c = $#command - 1 ))
    else command=( print -r -- )
    fi
    
    local wait bg
    local execute='
        if (( $opts[(I)-(-interactive|p)] ))
        then read -q "?$call?..." || continue
        elif (( $opts[(I)-(-verbose|t)] ))
        then print -u2 -r -- "$call"
        fi
        eval "{
    	\$call
        } $bg"'
    local ret=0 analyze='
        case $? in
        (0) ;;
        (<1-125>|128)  ret=123;;
        (255)       return 124;;
        (<129-254>) return 125;;
        (126)       return 126;;
        (127)       return 127;;
        (*)         return 1;;
        esac'
    
    if (( ARGC == 0 ))
    then
        if (( $opts[(I)-(-no-run-if-empty|r)] ))
        then return 0
        else
    	call=($command)
    	# Use "repeat" here so "continue" won't complain.
    	repeat 1 eval "$execute ; $analyze"
    	return $ret
        fi
    fi
    
    n=${${n##-(n|-max-args(=|))}:-$[ARGC+c]}
    if (( n <= 0 ))
    then
        print -u2 'zargs: value for max-args must be >= 1'
        return 1
    fi
    
    if (( n > c ))
    then (( n -= c ))
    else
        print -u2 zargs: argument list too long
        return 1
    fi
    
    s=${${s##-(s|-max-chars(=|))}:-20480}
    if (( s <= 0 ))
    then
        print -u2 'zargs: value for max-chars must be >= 1'
        return 1
    fi
    
    l=${${${l##*-(l|L|-max-lines(=|))}[-1]}:-${${l[1]:+1}:-$ARGC}}
    if (( l <= 0 ))
    then
        print -u2 'zargs: value for max-lines must be >= 1'
        return 1
    fi
    
    P=${${P##-(P|-max-procs(=|))}:-1}
    if (( P < 0 ))
    then
        print -u2 'zargs: value for max-procs must be >= 0'
        return 1
    fi
    
    if (( P != 1 && ARGC > 1 ))
    then
        # These setopts are necessary for "wait" on multiple jobs to work.
        setopt nonotify nomonitor
        bg='&'
        if zmodload -i zsh/parameter 2>/dev/null
        then
    	wait='wait %${(k)^jobstates[(R)running:*]}'
        else
    	wait='wait'
        fi
    fi
    
    # Everything has to be in a subshell just in case of backgrounding jobs,
    # so that we don't unintentionally "wait" for jobs of the parent shell.
    (
    
    while ((ARGC))
    do
        if (( P == 0 || P > ARGC ))
        then (( P = ARGC ))
        fi
    
        repeat $P
        do
    	((ARGC)) || break
    	for (( end=l; end && ${(c)#argv[1,end]} > s; end/=2 )) :
    	(( end > n && ( end = n ) ))
    	args=( $argv[1,end] )
    	shift $((end > ARGC ? ARGC : end))
    	if (( $#i ))
    	then call=( ${command/$i/$args} )
    	else call=( $command $args )
    	fi
    	if (( ${(c)#call} > s ))
    	then
    	    print -u2 zargs: cannot fit single argument within size limit
    	    # GNU xargs exits here whether or not -x,
    	    # but that just makes the option useless.
    	    (( $opts[(I)-(-exit|x)] )) && return 1
    	    continue
    	else
    	    eval "$execute"
    	fi
        done
    
        eval "$wait
    	$analyze"
    done
    return $ret
    
    )
    
    # }
    PK[ϲggfunctions/_x_keysymnuW+A#autoload
    
    local expl
    
    _tags keysyms || return 1
    
    if (( ! $+_keysym_cache )); then
      local file
    
      file=( /usr/{include,{{X11R6,openwin},local{,/X11{,R6}}}/include}/X11/keysymdef.h(N) )
    
      if (( $#file )); then
        _keysym_cache=( "${(@)${(@)${(M@)${(@f)$(< $file[1])}:#\#define[ 	]##XK_*}#\#define[ 	]##XK_}%%[ 	]*}" )
      else
        _keysym_cache=( BackSpace Tab Linefeed Clear Return Pause Escape 
                        Delete Left Right Up Down Space Home Begin End
    		    F{1,2,3,4,5,6,7,8,9,10,11,12} )
      fi
    fi
    
    _wanted keysyms expl 'key symbol' \
        compadd "$@" -M 'm:{a-z}={A-Z} r:|-=* r:|=*' -a - _keysym_cache
    PK[j2<functions/read-from-minibuffernuW+Aemulate -L zsh
    setopt extendedglob
    
    local opt keys
    integer stat
    
    while getopts "k:" opt; do
      case $opt in
        # Read the given number of keys.  This is a bit
        # ropey for more than a single key.
        (k)
        keys=$OPTARG
        ;;
    
        (*)
        return 1
        ;;
      esac
    done
    (( OPTIND > 1 )) && shift $(( OPTIND - 1 ))
    
      local pretext="$PREDISPLAY$LBUFFER$RBUFFER$POSTDISPLAY
    "
    # We could use the local variables mechanism to save these
    # values, but if read-from-minibuffer is called as a widget
    # (which isn't actually all that useful) the values won't be
    # restored because the variables are already local at the current
    # level and don't get restored when they go out of scope.
    # We could do it with an additional function level.
      local save_lbuffer=$LBUFFER
      local save_rbuffer=$RBUFFER
      local save_predisplay=$PREDISPLAY
      local save_postdisplay=$POSTDISPLAY
      local -a save_region_highlight
      save_region_highlight=("${region_highlight[@]}")
    
    {
      LBUFFER="$2"
      RBUFFER="$3"
      PREDISPLAY="$pretext${1:-? }"
      POSTDISPLAY=
      region_highlight=("P${#pretext} ${#PREDISPLAY} bold")
    
      if [[ -n $keys ]]; then
        zle -R
        read -k $keys
        stat=$?
      else
        zle recursive-edit -K main
        stat=$?
        (( stat )) || REPLY=$BUFFER
      fi
    } always {
      LBUFFER=$save_lbuffer
      RBUFFER=$save_rbuffer
      PREDISPLAY=$save_predisplay
      POSTDISPLAY=$save_postdisplay
      region_highlight=("${save_region_highlight[@]}")
    }
    
    return $stat
    PK[!99functions/chpwd_recent_dirsnuW+A# Save the current directory in the stack of most recently used directories.
    
    emulate -L zsh
    setopt extendedglob
    
    local -aU reply
    integer changed
    
    autoload -Uz chpwd_recent_filehandler chpwd_recent_add
    
    # Don't save if this is not interactive, or is in a subshell.
    # Don't save if this is not being called directly from the top level
    # of the shell via a straightforward sequence of shell functions.
    # So this is called
    #  - on any straightforward cd or pushd (including AUTO_CD)
    #  - any time cd or pushd is called from a function invoked directly
    #    or indirectly from the command line, e.g. if pushd is a function
    #    fixing the order of directories that got broken years ago
    # but it is not called any time
    #  - the shell is not interactive
    #  - we forked
    #  - we are being eval'd, including for some special purpose such
    #    as a style
    #  - we are not called from the top-level command loop, for example
    #    we are in a completion function (which is called from zle
    #    when the main top-level command interpreter isn't running)
    #  - obviously, when cd -q is in use (that's what the option is for).
    #
    # For compatibility with older shells, skip this test if $ZSH_EVAL_CONTEXT
    # isn't set.  This will never be the case inside a shell function when
    # the variable is implemented.
    if [[ ! -o interactive  || $ZSH_SUBSHELL -ne 0 || \
      ( -n $ZSH_EVAL_CONTEXT && \
      $ZSH_EVAL_CONTEXT != toplevel(:[a-z]#func|)# ) ]]; then
      return
    fi
    
    chpwd_recent_filehandler
    
    if [[ $reply[1] != $PWD ]]; then
      chpwd_recent_add $PWD && changed=1
    
      (( changed )) && chpwd_recent_filehandler $reply
    fi
    PK[HLfunctions/_tardynuW+A#compdef tardy
    
    _arguments \
      '-Block_Size:number:' \
      '-Clean_Meta' \
      '-Clean_Print' \
      '-Clean_Space' \
      '-Clean' \
      '-DownCase' \
      '-Group:group:_groups' \
      '-Group_NAme:group:_groups' \
      '-Group_NUmber:group:_groups' \
      '-Help' \
      '-Input_ForMaT:input format:(tar list)' \
      '-List' \
      '-No_Directories' \
      '-Mode_Clear:bits:' \
      '-Mode_Set:bits:' \
      '-Now' \
      '-Old_Type' \
      '-Output_ForMaT:output format:(ustar tar-bsd cpio cpio-old-ascii v7)' \
      '-Prefix:string:' \
      '-PROgress' \
      '-Remove_Prefix:number or string:' \
      '-UpCase' \
      '-User:user:_users' \
      '-User_NAme:user:_users' \
      '-User_NUmber:user:_users' \
      '-VERSion' \
      '*:file:_files'
    PK[adfunctions/_coreadmnuW+A#compdef coreadm
    
    _coreadm() {
    	local -a content option
    
    	content=(
    		"anon[anonymous private mappings]"
    		"ctf[CTF type information]"
    		"data[writable private file mappings]"
    		"dism[DISM mappings]"
    		"heap[process heap]"
    		"ism[ISM mappings]"
    		"rodata[read-only private file mappings]"
    		"shanon[anonymous shared mappings]"
    		"shfile[file-backed shared mappings]"
    		"shm[System V shared memory]"
    		"stack[process stack]"
    		"symtab[symbol table sections for loaded files]"
    		"text[readable and executable private file mappings]"
    	)
    
    	option=(
    		"global"\:"Allow global core dumps"
    		"global-setid"\:"Allow set-id global core dumps"
    		"log"\:"Generate a syslog message on global core dump"
    		"process"\:"Allow per-process core dumps"
    		"proc-setid"\:"Allow set-id per-process core dumps"
    	)
    
    	# _values doesn't quite work for us here -- the separator can be either
    	# "+" or "-"
    	_arguments -s \
    		- set1 \
    		'-g[global core file name pattern]:' \
    		'-G[global core file content]:content:_values -s + "content" $content' \
    		'-i[per-process core file name pattern]:' \
    		'-I[per-process core file content]:content:_values -s + "content" $content' \
    		'*-d[disable core option]:option:(($option))' \
    		'*-e[enable core option]:option:(($option))' \
    		- set2 \
    		'-p[PID-specific per-process core file name pattern]:' \
    		'-P[PID-specific per-process core file content]:content:_values -s + "content" $content' \
    		'*:pids:_pids' \
    		- set3 \
    		'-u[update options from coreadm.conf]'
    }
    
    _coreadm "$@"
    PK['``functions/hardennuW+A#!/bin/sh
    # harden a link (convert it to a singly linked file)
    cp $1 $1.foo
    rm $1
    mv $1.foo $1
    
    PK[l8	8	functions/VCS_INFO_detect_p4nuW+A## vim:ft=zsh
    ## perforce support by: Phil Pennock
    ## Distributed under the same BSD-ish license as zsh itself.
    
    # If user-server is true in the :vcs_info:p4:... context, contact the
    # server to decide whether the directory is handled by Perforce.  This can
    # cause a delay if the network times out, in particular if looking up the
    # server name failed.  Hence this is not the default.  If a timeout
    # occurred, the server:port pair is added to the associative array
    # vcs_info_p4_dead_servers and the server is never contacted again.  The
    # array must be edited by hand to remove it.
    #
    # If user-server is false or not set, the function looks to see if there is
    # a file $P4CONFIG somewhere above in the hierarchy.  This is far from
    # foolproof; in fact it relies on you using the particular working practice
    # of having such files in all client root directories and nowhere above.
    
    
    VCS_INFO_p4_get_server() {
      emulate -L zsh
      setopt extendedglob
    
      local -a settings
      settings=(${(f)"$(${vcs_comm[cmd]} set)"})
      serverport=${${settings[(r)P4PORT=*]##P4PORT=}%% *}
      case $serverport in
        (''|:)
        serverport=perforce:1666
        ;;
    
        (:*)
        serverport=perforce${serverport}
        ;;
    
        (*:)
        serverport=${serverport}1666
        ;;
    
        (<->)
        serverport=perforce:${serverport}
        ;;
      esac
    }
    
    
    VCS_INFO_detect_p4() {
      local serverport p4where
    
      if zstyle -t ":vcs_info:p4:${usercontext}:${rrn}" use-server; then
        # Use "p4 where" to decide whether the path is under the
        # client workspace.
        if (( ${#vcs_info_p4_dead_servers} )); then
          # See if the server is in the list of defunct servers
          VCS_INFO_p4_get_server
          [[ -n $vcs_info_p4_dead_servers[$serverport] ]] && return 1
        fi
        if p4where="$(${vcs_comm[cmd]} where 2>&1)"; then
          return 0
        fi
        if [[ $p4where = *"Connect to server failed"* ]]; then
          # If the connection failed, mark the server as defunct.
          # Otherwise it worked but we weren't within a client.
          typeset -gA vcs_info_p4_dead_servers
          [[ -z $serverport ]] && VCS_INFO_p4_get_server
          vcs_info_p4_dead_servers[$serverport]=1
        fi
        return 1
      else
        [[ -n ${P4CONFIG} ]] || return 1
        VCS_INFO_check_com ${vcs_comm[cmd]} || return 1
        vcs_comm[detect_need_file]="${P4CONFIG}"
        VCS_INFO_bydir_detect .
        return $?
      fi
    }
    
    VCS_INFO_detect_p4 "$@"
    PK[ۗfunctions/_joenuW+A#compdef joe
    
    _arguments \
      '-asis[characters with codes >127 will be displayed non-inverted]' \
      '-backpath[backup file directory]:backup file directory:_files -/' \
      '-baud[inserts delays for baud rates below 19200]:baud rate:(57600 38400 19200 9600 4800 2400 1200 300)' \
      '-beep[beep on command errors or when cursor goes past extremes]' \
      '-columns[sets the number of screen columns]:num of columns' \
      '-csmode[continued search mode]' \
      '-dopadding[catch up after long terminal commands]' \
      '-exask[^KX verify the file name that it is about to write]' \
      '-force[make sure that last line of the file has a line-feed]' \
      '-help[start editor with help screen on]' \
      '-keepup[update column number and control-key prefix after each keystroke]' \
      '-lightoff[make block highlighting go away after any block command]' \
      '-lines[set the number of screen lines]:num of screen lines' \
      '-marking[text between ^KB and the cursor is highlighted]' \
      '-mid[scroll window and make cursor go to center after]' \
      '-nobackups[prevents making backup files]' \
      '-nonotice[prevents displaying copyright notice on startup]' \
      '-nosta[eliminate top-most status line]' \
      '-noxon[turn off ^S/^Q processing]' \
      '-orphan[extra files get placed in orphaned buffers instead of new windows]' \
      '-pg[specify the number of lines to keep after PgUp/PgDn]:num of lines to keep' \
      '-skiptop[prevents use of top n screen lines]:num of top lines to skip' \
      '+-[number of lines]:number of lines' \
      '-crlf[use CR+LF as end of line sequence, instead of just LF]' \
      '-wordwrap[wrap the previous word when you type past the right margin]' \
      '-autoindent[indentation is duplicated onto the next line]' \
      '-overwrite[typing overwrites existing characters]' \
      '-lmargin[set the left margin]:left margin' \
      '-rmargin[set the right margin]:right margin' \
      '-tab[set the TAB character width]:tab width' \
      '-indentc[set the indentation character for ^K, and ^K.]:indent char for ^K, and ^K.' \
      '-istep[set the indentation step for ^K, and ^K.]:indent step for ^K, and ^K.' \
      '-linums[display line numbers before each line]' \
      '-rdonly[make file read-only]' \
      '-keymap[use an alternate section of joerc for keybindings]:keymap name' \
      '*:files:_files'
    PK[fo##functions/_descriptionnuW+A#autoload
    
    local name gropt nopt xopt format gname hidden hide match opts tag sort
    
    opts=()
    
    gropt=(-J)
    xopt=(-X)
    nopt=()
    zparseopts -K -D -a nopt 1 2 V=gropt J=gropt x=xopt
    
    3="${${3##[[:blank:]]#}%%[[:blank:]]#}"
    [[ -n "$3" ]] && _lastdescr=( "$_lastdescr[@]" "$3" )
    
    zstyle -s ":completion:${curcontext}:$1" group-name gname &&
        [[ -z "$gname" ]] && gname="$1"
    
    _setup "$1" "${gname:--default-}"
    
    name="$2"
    
    zstyle -s ":completion:${curcontext}:$1" format format ||
        zstyle -s ":completion:${curcontext}:descriptions" format format
    
    if zstyle -s ":completion:${curcontext}:$1" hidden hidden &&
       [[ "$hidden" = (all|yes|true|1|on) ]]; then
      [[ "$hidden" = all ]] && format=''
      opts=(-n)
    fi
    zstyle -s ":completion:${curcontext}:$1" matcher match &&
        opts=($opts -M "$match")
    [[ -n "$_matcher" ]] && opts=($opts -M "$_matcher")
    
    # Use sort style, but ignore `menu' value to help _expand.
    # Also don't override explicit use of -V.
    if { zstyle -s ":completion:${curcontext}:$1" sort sort ||
         zstyle -s ":completion:${curcontext}:" sort sort; } &&
        [[ "$gropt" = -J && $sort != menu ]]; then
        if [[ "$sort" = (yes|true|1|on) ]]; then
    	gropt=(-J)
        else
    	gropt=(-V)
        fi
    fi
    
    if [[ -z "$_comp_no_ignore" ]]; then
      zstyle -a ":completion:${curcontext}:$1" ignored-patterns _comp_ignore ||
        _comp_ignore=()
    
      zstyle -s ":completion:${curcontext}:$1" ignore-line hidden &&
        case "$hidden" in
        true|yes|on|1) _comp_ignore=( "$_comp_ignore[@]" ${(q)"${words[@]}"} );;
        current)       _comp_ignore=( "$_comp_ignore[@]" "${(q)words[CURRENT]}" );;
        current-shown)
    	    [[ "$compstate[old_list]" = *shown* ]] &&
                _comp_ignore=( "$_comp_ignore[@]" "${(q)words[CURRENT]}" );;
        other)         _comp_ignore=( "$_comp_ignore[@]"
                                      "${(@q)words[1,CURRENT-1]}"
    				  "${(@q)words[CURRENT+1,-1]}" );;
        esac
    
      # Ensure the ignore option is first so we can override it
      # for fake-always.
      (( $#_comp_ignore )) && opts=( -F _comp_ignore $opts )
    else
      _comp_ignore=()
    fi
    
    tag="$1"
    
    shift 2
    if [[ -z "$1" && $# -eq 1 ]]; then
      format=
    elif [[ -n "$format" ]]; then
      zformat -f format "$format" "d:$1" "${(@)argv[2,-1]}"
    fi
    
    if [[ -n "$gname" ]]; then
      if [[ -n "$format" ]]; then
        set -A "$name" "$opts[@]" "$nopt[@]" "$gropt" "$gname" "$xopt" "$format"
      else
        set -A "$name" "$opts[@]" "$nopt[@]" "$gropt" "$gname"
      fi
    else
      if [[ -n "$format" ]]; then
        set -A "$name" "$opts[@]" "$nopt[@]" "$gropt" -default- "$xopt" "$format"
      else
        set -A "$name" "$opts[@]" "$nopt[@]" "$gropt" -default-
      fi
    fi
    
    if ! (( ${funcstack[2,-1][(I)_description]} )); then
      local fakestyle descr
      for fakestyle in fake fake-always; do
        zstyle -a ":completion:${curcontext}:$tag" $fakestyle match ||
        continue
    
        descr=( "${(@M)match:#*[^\\]:*}" )
    
        opts=("${(@P)name}")
        if [[ $fakestyle = fake-always && $opts[1,2] = "-F _comp_ignore" ]]; then
          shift 2 opts
        fi
        compadd "${(@)opts}" - "${(@)${(@)match:#*[^\\]:*}:s/\\:/:/}"
        (( $#descr )) && _describe -t "$tag" '' descr "${(@)opts}"
      done
    fi
    
    return 0
    PK[%3functions/_mac_applicationsnuW+A#autoload
    
    _retrieve_mac_apps
    
    local expl
    _wanted commands expl 'Mac OS X application' \
        compadd "$@" - "${(@)${_mac_apps[@]:t}%.app}"
    PK[܆2]]functions/_lsusbnuW+A#compdef lsusb
    
    local context state line usbidsline vendorid pair
    typeset -A opt_args
    
    _arguments \
      '(-v --verbose)'{-v,--verbose}'[be verbose]' \
      '-s:bus and/or devnum to show:' \
      '-d:vendor and product to show:->vendorproduct' \
      '-D:device to show:_files' \
      '-t[dump the physical USB device hierarchy as a tree]' \
      '(-V --version)'{-V,--version}'[print version info and exit]' && return 0
    
      if [[ ${+_lsusb_vendors} -eq 0 ]]; then
        typeset -A _lsusb_vendors _lsusb_devices
      while IFS="" read usbidsline
      do
        case "$usbidsline" in
          ((#b)([0-9a-f]##) ##(*))
            vendorid="$match[1]"
            _lsusb_vendors[$vendorid]="$match[2]"
          ;;
          (	(#b)([0-9a-f]##) ##(*)))
            pair="$vendorid:$match[1]"
            _lsusb_devices[${pair}]="$match[2]"
          ;;
        esac
      done < /usr/share/misc/usb.ids
    fi
    
    compadd -k _lsusb_devices
    PK[r
    Ufunctions/incargnuW+A# Shell function to increment an integer either under the cursor or just
    # to the left of it.  Use
    #   autoload -Uz incarg
    #   zle -N incarg
    #   bindkey "..." incarg
    # to define it.  For example,
    #   echo 41
    #        ^^^ cursor anywhere here
    # with incarg gives
    #   echo 42
    # with the cursor in the same place.
    #
    # A numeric argument gives a number other than 1 to add (may be negative).
    # If you're going to do it a lot with one particular number, you can set
    # the parameter incarg to that number (a numeric argument still takes
    # precedence).
    
    emulate -L zsh
    setopt extendedglob
    
    local rrest lrest num
    
    rrest=${RBUFFER##[0-9]#}
    if [[ $RBUFFER = [0-9]* ]]; then
      if [[ -z $rrest ]]; then
        num=$RBUFFER
      else
        num=${RBUFFER[1,-$#rrest-1]}
      fi
    fi
    
    lrest=${LBUFFER%%[0-9]#}
    if [[ $LBUFFER = *[0-9] ]]; then
      if [[ -z $lrest ]]; then
        num="$LBUFFER$num"
      else
        num="${LBUFFER[$#lrest+1,-1]}$num"
      fi
    fi
    
    [[ -n $num ]] && (( num += ${NUMERIC:-${incarg:-1}} ))
    
    BUFFER="$lrest$num$rrest"
    PK[0;;functions/vcs_info_setsysnuW+A## vim:ft=zsh
    ## Written by Frank Terbeck 
    ## Distributed under the same BSD-ish license as zsh itself.
    
    emulate -L zsh
    setopt extendedglob typeset_silent
    
    local sys
    typeset -ga VCS_INFO_backends
    
    VCS_INFO_backends=()
    
    for file in ${^fpath}/VCS_INFO_get_data_*~*(\~|.zwc)(N) ; do
        file=${file:t}
        : ${file:#(#b)VCS_INFO_get_data_(*)}
        sys=${match[1]}
    
        [[ -n ${(M)VCS_INFO_backends:#${sys}} ]] && continue
        VCS_INFO_backends+=(${sys})
        autoload -Uz VCS_INFO_detect_${sys}
        autoload -Uz VCS_INFO_get_data_${sys}
    done
    
    return 0
    PK[jfunctions/_pythonnuW+A#compdef python
    
    # Python 2.6
    # Python 3.0
    
    local curcontext="$curcontext" state line expl
    typeset -A opt_args
    
    local -a args
    
    if _pick_variant python3=Python\ 3 python2 --version; then
      args=(
        '(-bb)-b[issue warnings about str(bytes_instance), str(bytearray_instance) and comparing bytes/bytearray with str]'
        '(-b)-bb[issue errors about str(bytes_instance), str(bytearray_instance) and comparing bytes/bytearray with str]'
      )
    else
      args=(
        '-Q+[division options]:division option:(old warn warnall new)'
        '(-tt)-t[issue warnings about inconsistent tab usage]'
        '(-t)-tt[issue errors about inconsistent tab usage]'
        '-3[warn about Python 3.x incompatibilities]'
      )
    fi
    
    _arguments -C -s -S "$args[@]" \
      "-B[don't write .py\[co\] files on import]" \
      '(1 -)-c+[program passed in as string (terminates option list)]:python command:' \
      '-d[debug output from parser]' \
      '-E[ignore PYTHON* environment variables (such as PYTHONPATH)]' \
      '(1 * -)-h[display help information]' \
      '-i[inspect interactively after running script]' \
      '(1 * -)-m[run library module as a script (terminates option list)]:module:->modules' \
      '-O[optimize generated bytecode slightly]' \
      '-OO[remove doc-strings in addition to the -O optimizations]' \
      "-s[don't add user site directory to sys.path]" \
      "-S[don't imply 'import site' on initialization]" \
      '-u[unbuffered binary stdout and stderr]' \
      '-v[verbose (trace import statements)]' \
      '(1 * -)-V[display version information]' \
      '-W+[warning control]:warning filter (action\:message\:category\:module\:lineno):(default always ignore module once error)' \
      '-x[skip first line of source, allowing use of non-Unix forms of #!cmd]' \
      '(-)1:script file:_files -g "*.py(|c|o)(-.)"' \
      '*::script argument: _normal' && return
    
    if [[ "$state" = modules ]]; then
      local -a modules
      modules=(
        ${${=${(f)"$(_call_program modules $words[1] -c \
          'from\ pydoc\ import\ help\;\ help\(\"modules\"\)')"}[2,-3]}:#\(package\)}
      )
      _wanted modules expl module compadd -a modules && return
    fi
    
    return 1
    PK[E//functions/_module-assistantnuW+A#compdef module-assistant m-a
    
    typeset -a _module_assistant_commands
    
    _module_assistant_commands=(
      'update[synchronize version index files]'
      'prepare[install required kernel headers package]'
      'fakesource[install required kernel source package]'
      'list[a print a list of details about available packages]'
      'list-available[b print a list of details about available packages]'
      'la[c print a list of details about available packages]'
      'list-installed[ print a list of details about installed packages]'
      'li[print a list of details about installed packages]'
      'search[search for packages]'
      'get[install specified source package]'
      'build[build specified packages]'
      'install[install specified packages]'
      'auto-install[do all necessary steps to install specified packages]'
      'clean[clear build directories of the kernel packages]'
      'purge[clear cache and remove all binary packages of source package]'
    )
    
    _arguments -A \
      '(-h --help)'{-h,--help}'[print help screen]' \
      '(-v --verbose)'{-v,--verbose}'[be verbose, show full paths, etc.]' \
      '(-q --quiet)'{-q,--quiet}'[the opposite of verbose]' \
      '(-n --no-rebuild)'{-n,--no-rebuild}'[do not rebuild when package exists]' \
      '(-i --ignore-failures)'{-i,--ignore-failures}'[do not stop on build failures]' \
      '(-s --apt-search)'{-s,--apt-search}'[search for installation candidates in the Debian archive]' \
      '(-f --force)'{-f,--force}'[force using new versions even when old ones exist]' \
      '(-u --userdir)'{-u,--userdir}'[specify a (writable) replacement directory for /var&/usr]:dir:_files -/' \
      '(-l --kvers-list)'{-l,--kvers-list}'[list of kernel versions to work on (default: current version)]:kernel version list:' \
      '(-k --kernel-dir)'{-k,--kernel-dir}'[list of kernel headers/source directories, comma separated]:list of dirs:_files -/' \
      '(-t --text-mode)'{-t,--text-mode}'[no progress bars]' \
      '1:list of commands:_values -s , subcommands "${_module_assistant_commands[@]}"' \
      '*:packages: compadd /usr/src/modass/var_cache_modass/*.avail_version(N:t:r) /var/cache/modass/*.avail_version(N:t:r)'
    
    PK[{??functions/_historynuW+A#autoload
    
    # Hm, this *can* sensibly be used as a completer. But it could also be used
    # as a utility function, so maybe it should be moved into another directory.
    # Or maybe not. Hm.
    #
    #
    # Complete words from the history
    #
    # Code taken from _history_complete_words.
    #
    # Available styles:
    #
    #   sort --  sort matches lexically (default is to sort by age)
    #   remove-all-dups --
    #            remove /all/ duplicate matches rather than just consecutives
    #   range -- range of history words to complete
    
    local opt expl max slice hmax=$#historywords beg=2
    
    if zstyle -t ":completion:${curcontext}:" remove-all-dups; then
      opt=-
    else
      opt=-1
    fi
    
    if zstyle -t ":completion:${curcontext}:" sort; then
      opt="${opt}J"
    else
      opt="${opt}V"
    fi
    
    if zstyle -s ":completion:${curcontext}:" range max; then
      if [[ $max = *:* ]]; then
        slice=${max#*:}
        max=${max%:*}
      else
        slice=$max
      fi
      [[ max -gt hmax ]] && max=$hmax
    else
      max=$hmax
      slice=$max
    fi
    
    PREFIX="$IPREFIX$PREFIX"
    IPREFIX=
    SUFFIX="$SUFFIX$ISUFFIX"
    ISUFFIX=
    
    # We skip the first element of historywords so the current word doesn't
    # interfere with the completion
    
    while [[ $compstate[nmatches] -eq 0 && beg -lt max ]]; do
      _wanted "$opt" history-words expl 'history word' \
          compadd -Q -a 'historywords[beg,beg+slice]'
      (( beg+=slice ))
    done
    
    (( $compstate[nmatches] ))
    PK[=9TT
    functions/_fcnuW+A#compdef fc history r
    
    local fc_common fc_hist fc_r
    
    fc_common=(
      '(-A -R -W -I)-r[reverse order of the commands]'
      '(-A -R -W -I -e)-n[suppress line numbers]'
      '(-A -R -W -I)*::commands:_command_names -e' )
    
    fc_hist=(
      '(-A -R -W -I)-m[treat first argument as a pattern]'
      '(-A -R -W -I -e -f -E -i)-d[print time-stamps]'
      '(-A -R -W -I -e -d -E -i)-f[mm/dd/yyyy format time-stamps]'
      '(-A -R -W -I -e -d -f -i)-E[dd.mm.yyyy format time-stamps]'
      '(-A -R -W -I -e -d -f -E)-i[yyyy-mm-dd format time-stamps]'
      '(-A -R -W -I -e)-D[print elapsed times]' )
    
    fc_r='(-A -R -W -I -e)-l[list resulting commands on stdout]'
    
    case $service in
      history)
        _arguments -s -S "$fc_common[@]" "$fc_hist[@]" && return 0
      ;;
      r)
        _arguments -s -S "$fc_common[@]" "$fc_r" && return 0
      ;;
      *)
      _arguments -s -S \
        '(-A -R -W -I -l -n -d -f -E -i -D)-e[specify editor to invoke]:editor to invoke:_command_names -e' \
        '(-l -m -e -r -n -d -f -E -i -D -A -W *)-R[read history from file]:history file:_files' \
        '(-l -m -e -r -n -d -f -E -i -D -R -W *)-A[append history to file]:history file:_files' \
        '(-l -m -e -r -n -d -f -E -i -D -R -A *)-W[write history to file]:history file:_files' \
        '(-l -m -e -r -n -d -f -E -i -D -A -W *)-I[read/write new events only]:history file:_files' \
        "$fc_common[@]" "$fc_hist[@]" "$fc_r" && return 0
      ;;
    esac
    PK[,functions/regexp-replacenuW+A# Replace all occurrences of a regular expression in a variable.  The
    # variable is modified directly.  Respects the setting of the
    # option RE_MATCH_PCRE.
    #
    # First argument: *name* (not contents) of variable.
    # Second argument: regular expression
    # Third argument: replacement string.  This can contain all forms of
    # $ and backtick substitutions; in particular, $MATCH will be replaced
    # by the portion of the string matched by the regular expression.
    
    integer pcre
    
    [[ -o re_match_pcre ]] && pcre=1
    
    emulate -L zsh
    (( pcre )) && setopt re_match_pcre
    
    # $4 is the string to be matched
    4=${(P)1}
    # $5 is the final string
    5=
    # 6 indicates if we made a change
    6=
    local MATCH MBEGIN MEND
    local -a match mbegin mend
    
    while [[ -n $4 ]]; do
      if [[ $4 =~ $2 ]]; then
        # append initial part and subsituted match
        5+=${4[1,MBEGIN-1]}${(e)3}
        # truncate remaining string
        4=${4[MEND+1,-1]}
        # indicate we did something
        6=1
      else
        break
      fi
    done
    5+=$4
    
    eval ${1}=${(q)5}
    # status 0 if we did something, else 1.
    [[ -n $6 ]]
    PK[WOfunctions/_call_functionnuW+A#autoload
    
    # Utility function to call a function if it exists.
    #
    # Usage: _call_function   [  ... ]
    #
    # If a function named  is defined (or defined to be autoloaded),
    # it is called. If  is given not the string `-' or empty, it is
    # taken as the name of a parameter and the return status of the function
    # called is stored in this parameter. All other arguments are given
    # to the function called.
    # The return value of this function is zero if the function was
    # called and non-zero otherwise.
    
    local _name _ret
    
    [[ "$1" != (|-) ]] && _name="$1"
    
    shift
    
    if (( $+functions[$1] )); then
      "$@"
      _ret="$?"
    
      [[ -n "$_name" ]] && eval "${_name}=${_ret}"
    
      compstate[restore]=''
    
      return 0
    fi
    
    return 1
    PK[+@functions/_cvsupnuW+A#compdef cvsup
    
    _arguments -s \
        '-1[disable automatic retries]' \
        '-a[server must authenticate itself]' \
        '-A:local address:_hosts' \
        '-b:base directory:_files -/' \
        '-c:collections directory:_files -/' \
        '-d:maximum number of deleted files:' \
        '-D[perform only deletions]' \
        '(-E)-e[enable execution of commands from server]' \
        '(-e)-E[disable execution of commands from server]' \
        '-g[disable use of GUI]' \
        '-h:server host:_hosts' \
        '-i:file pattern:' \
        '-k[keep temporary copies of failed updates]' \
        '-l:lock file:_files' \
        '-L:verbosity level:(0 1 2)' \
        '-p:port:_ports' \
        '-P:connection mode:(m a port lo-hi -)' \
        '-r:maximum number of retries:' \
        '-s[suppress status checks]' \
        '-v[print version information]' \
        '(-Z)-z[enable compression]' \
        '(-z)-Z[disable compression]' \
        ':cvsup file:_files' \
        ':destination directory:_files -/'
    PK[`c1functions/tcp_closenuW+A# Usage:
    #   tcp_close [-q] [ -a | session ... ]
    # -a means all sessions.
    # -n means don't close a fake session's fd.
    # -q means quiet.
    #
    # Accepts the -s and -l arguments for consistency with other functions,
    # but there is no particular gain in using them
    emulate -L zsh
    setopt extendedglob cbases
    
    local all quiet opt alias noclose
    local -a sessnames
    
    while getopts "aql:ns:" opt; do
        case $opt in
    	(a) all=1
    	    ;;
    	(q) quiet=1
    	    ;;
    	(l) sessnames+=(${(s.,.)OPTARG})
    	    ;;
    	(n) noclose=1
    	    ;;
    	(s) sessnames+=($OPTARG)
    	    ;;
    	(*) return 1
    	    ;;
        esac
    done
    
    (( OPTIND > 1 )) && shift $(( OPTIND - 1))
    
    if [[ -n $all ]]; then
        if (( $# )); then
    	print "Usage: $0 [ -q ] [ -a | [ session ... ] ]" >&2
    	return 1
        fi
        sessnames=(${(k)tcp_by_name})
        if (( ! ${#sessnames} )); then
    	[[ -z $quiet ]] && print "No TCP sessions open." >&2
    	return 1
        fi
    fi
    
    sessnames+=($*)
    
    if (( ! ${#sessnames} )); then
        sessnames+=($TCP_SESS)
    fi
    
    if (( ! ${#sessnames} )); then
        [[ -z $quiet ]] && print "No current TCP session." >&2
        return 1
    fi
    
    local tcp_sess fd
    integer stat curstat
    
    # Check to see if the fd is opened for a TCP session, or was opened
    # to a pre-existing fd.  We could remember this from tcp_open.
    local -A ztcp_fds
    local line match mbegin mend
    
    if zmodload -e zsh/net/tcp; then
        ztcp | while read line; do
            if [[ $line = (#b)*fd\ ([0-9]##) ]]; then
    	    ztcp_fds[$match[1]]=1
    	fi
        done
    fi
    
    for tcp_sess in $sessnames; do
        curstat=0
        fd=${tcp_by_name[$tcp_sess]}
        if [[ -z $fd ]]; then
    	print "No TCP session $tcp_sess!" >&2
    	stat=1
    	continue
        fi
        # We need the base name if this is an alias.
        tcp_sess=${tcp_by_fd[$fd]}
        if [[ -z $tcp_sess ]]; then
    	if [[ -z $quiet ]]; then
    	    print "Aaargh!  Session for fd $fd has disappeared!" >&2
    	fi
    	stat=1
    	continue
        fi
    
        if [[ ${+tcp_aliases} -ne 0 && -n ${tcp_aliases[$fd]} ]]; then
    	for alias in ${=tcp_aliases[$fd]}; do
    	    if (( ${+functions[tcp_on_unalias]} )); then
    		tcp_on_unalias $alias $fd
    	    fi
    	    unset "tcp_by_name[$alias]"
    	done
    	unset "tcp_aliases[$fd]"
        fi
    
        # Don't return just because the zle handler couldn't be uninstalled...
        if [[ -o zle ]]; then
    	zle -F $fd || print "[Ignoring...]" >&2
        fi
    
        if [[ -n $ztcp_fds[$fd] ]]; then
            # It's a ztcp session.
    	if ! ztcp -c $fd; then
    	    stat=1
    	    curstat=1
    	fi
        elif [[ -z $noclose ]]; then
            # It's not, just close it normally.
            # Careful: syntax for closing fd's is quite strict.
    	if [[ ${#fd} -gt 1 ]]; then
    	    [[ -z $quiet ]] && print "Can't close fd $fd; will leave open." >&2
    	else
    	    eval "exec $fd>&-"
    	fi
        fi
    
        unset "tcp_by_name[$tcp_sess]"
        unset "tcp_by_fd[$fd]"
        if [[ -z $quiet && $curstat -eq 0 ]]; then
    	print "Session $tcp_sess successfully closed."
        fi
        [[ $tcp_sess = $TCP_SESS ]] && unset TCP_SESS
    
        if (( ${+functions[tcp_on_close]} )); then
    	tcp_on_close $tcp_sess $fd
        fi
    done
    
    return $stat
    PK[[functions/zfpcpnuW+A# function zfpcp {
    # ZFTP put as copy:  i.e. first arguments are remote, last is local.
    # Currently only supports
    #  zfcp lfile rfile
    # if there are two arguments, or the second one is . or .., or ends
    # with a slash
    # or
    #  zfcp lfile1 lfile2 lfile3 ... rdir
    # if there are more than two (because otherwise it doesn't
    # know if the last argument is a directory on the remote machine).
    # However, if the remote machine plays ball by telling us `Is a directory'
    # when we try to copy to a directory, zfpcp will then try to do the correct
    # thing.
    
    emulate -L zsh
    
    [[ $curcontext = :zf* ]] || local curcontext=:zfpcp
    local rem loc
    integer stat do_close
    
    zfautocheck || return 1
    
    if [[ $# -gt 2 || $2 = (.|..) || $2 = */ ]]; then
      local dir=$argv[-1]
      argv[-1]=
      # zfcd directory hack to put the front back to ~
      if [[ $dir = $HOME || $dir = $HOME/* ]]; then
        dir="~${dir#$HOME}"
      fi
      [[ -n $dir && $dir != */ ]] || dir="$dir/"
      for loc in $*; do
        rem=$dir${loc:t}
        zftp put $rem <$loc || stat=1
      done
    else
      if [[ $2 = $HOME || $2 = $HOME/* ]]; then
        2="~${2#$HOME}"
      fi
      zftp put $2 <$1
      stat=$?
      if [[ stat -ne 0 && $ZFTP_CODE = 553 && $ZFTP_REPLY = *'Is a directory'* ]]
      then
           zftp put $2/$1:t <$1
           stat=$?
      fi
    fi
    
    (( $do_close )) && zfclose
    
    return $stat
    # }
    PK[r##functions/_calnuW+A#compdef cal ncal
    
    local args
    
    case $service in
      cal)
        args=(
          '-3[three in a row]'
          '-m[Monday as first day of the week]'
        )
      ;;
      ncal)
        args=(
          '-J[display Julian calendar]'
          '-e[display date of western Easter]'
          '-o[display date of orthodox Easter]'
          '-p[assume as by ncal]'
          '-s[country code]'
          '-w[print number of the week below each column]'
        )
      ;;
    esac
    
    _arguments "${args[@]}" \
      '-j[display Julian days]' \
      '-y[display a calendar for the current year]' \
      '::month' \
      ':year'
    PK[
    ^^functions/bashcompinitnuW+A#autoload
    
    _bash_complete() {
      local ret=1
      local -a suf matches
      local COMP_POINT COMP_CWORD
      local -a COMP_WORDS COMPREPLY BASH_VERSINFO
      local COMP_LINE="$words"
      local -A savejobstates savejobtexts
    
      (( COMP_POINT = 1 + ${#${(j. .)words[1,CURRENT-1]}} + $#QIPREFIX + $#IPREFIX + $#PREFIX ))
      (( COMP_CWORD = CURRENT - 1))
      COMP_WORDS=( $words )
      BASH_VERSINFO=( 2 05b 0 1 release )
      
      savejobstates=( ${(kv)jobstates} )
      savejobtexts=( ${(kv)jobtexts} )
      
      [[ ${argv[${argv[(I)nospace]:-0}-1]} = -o ]] && suf=( -S '' )
     
      matches=( ${(f)"$(compgen $@)"} )
      
      if [[ -n $matches ]]; then
        if [[ ${argv[${argv[(I)filenames]:-0}-1]} = -o ]]; then
          compset -P '*/' && matches=( ${matches##*/} )
          compset -S '/*' && matches=( ${matches%%/*} )
          compadd -f "${suf[@]}" -a matches && ret=0
        else
          compadd "${suf[@]}" -a matches && ret=0
        fi
      fi
    
      if (( ret )); then
        if [[ ${argv[${argv[(I)default]:-0}-1]} = -o ]]; then
          _default "${suf[@]}" && ret=0
        elif [[ ${argv[${argv[(I)dirnames]:-0}-1]} = -o ]]; then
          _directories "${suf[@]}" && ret=0
        fi
      fi
    
      return ret
    }
    
    compgen() {
      local opts prefix suffix job OPTARG OPTIND ret=1 
      local -a name res results jids
      local -A shortopts
      
      emulate -L sh
      setopt kshglob noshglob braceexpand nokshautoload
    
      shortopts=(
        a alias b builtin c command d directory e export f file
        g group j job k keyword u user v variable
      )
    
      while getopts "o:A:G:C:F:P:S:W:X:abcdefgjkuv" name; do
        case $name in
          [abcdefgjkuv]) OPTARG="${shortopts[$name]}" ;&
          A)
            case $OPTARG in
    	  alias) results+=( "${(k)aliases[@]}" ) ;;
    	  arrayvar) results+=( "${(k@)parameters[(R)array*]}" ) ;;
    	  binding) results+=( "${(k)widgets[@]}" ) ;;
    	  builtin) results+=( "${(k)builtins[@]}" "${(k)dis_builtins[@]}" ) ;;
    	  command)
    	    results+=(
    	      "${(k)commands[@]}" "${(k)aliases[@]}" "${(k)builtins[@]}"
    	      "${(k)functions[@]}" "${(k)reswords[@]}"
    	    )
    	  ;;
    	  directory)
    	    setopt bareglobqual
    	    results+=( ${IPREFIX}${PREFIX}*${SUFFIX}${ISUFFIX}(N-/) )
    	    setopt nobareglobqual
    	  ;;
    	  disabled) results+=( "${(k)dis_builtins[@]}" ) ;;
    	  enabled) results+=( "${(k)builtins[@]}" ) ;;
    	  export) results+=( "${(k)parameters[(R)*export*]}" ) ;;
    	  file)
    	    setopt bareglobqual
    	    results+=( ${IPREFIX}${PREFIX}*${SUFFIX}${ISUFFIX}(N) )
    	    setopt nobareglobqual
    	  ;;
    	  function) results+=( "${(k)functions[@]}" ) ;;
    	  group)
    	    emulate zsh
    	    _groups -U -O res
    	    emulate sh
    	    setopt kshglob noshglob braceexpand
    	    results+=( "${res[@]}" )
    	  ;;
    	  hostname)
    	    emulate zsh
    	    _hosts -U -O res
    	    emulate sh
    	    setopt kshglob noshglob braceexpand
    	    results+=( "${res[@]}" )
    	  ;;
    	  job) results+=( "${savejobtexts[@]%% *}" );;
    	  keyword) results+=( "${(k)reswords[@]}" ) ;;
    	  running)
    	    jids=( "${(@k)savejobstates[(R)running*]}" )
    	    for job in "${jids[@]}"; do
    	      results+=( ${savejobtexts[$job]%% *} )
    	    done
    	  ;;
    	  stopped)
    	    jids=( "${(@k)savejobstates[(R)suspended*]}" )
    	    for job in "${jids[@]}"; do
    	      results+=( ${savejobtexts[$job]%% *} )
    	    done
    	  ;;
    	  setopt|shopt) results+=( "${(k)options[@]}" ) ;;
    	  signal) results+=( "SIG${^signals[@]}" ) ;;
    	  user) results+=( "${(k)userdirs[@]}" ) ;;
          	  variable) results+=( "${(k)parameters[@]}" ) ;;
    	  helptopic) ;;
    	esac
          ;;
          F)
            COMPREPLY=()
    	$OPTARG "${words[0]}" "${words[CURRENT-1]}" "${words[CURRENT-2]}"
    	results+=( "${COMPREPLY[@]}" )
          ;;
          G)
            setopt nullglob
            results+=( ${~OPTARG} )
    	unsetopt nullglob
          ;;
          W) eval "results+=( $OPTARG )" ;;
          C) results+=( $(eval $OPTARG) ) ;;
          P) prefix="$OPTARG" ;;
          S) suffix="$OPTARG" ;;
          X)
            if [[ ${OPTARG[0]} = '!' ]]; then
    	  results=( "${(M)results[@]:#${OPTARG#?}}" )
    	else
     	  results=( "${results[@]:#$OPTARG}" )
    	fi
          ;;
        esac
      done
      
      # support for the last, `word' option to compgen. Zsh's matching does a
      # better job but if you need to, comment this in and use compadd -U
      #shift $(( OPTIND - 1 ))
      #(( $# )) && results=( "${(M)results[@]:#$1*}" )
    
      print -l -- "$prefix${^results[@]}$suffix"
    }
    
    complete() {
      emulate -L zsh
      local args void cmd print remove
      args=( "$@" )
      zparseopts -D -a void o: A: G: W: C: F: P: S: X: a b c d e f g j k u v \
          p=print r=remove
      if [[ -n $print ]]; then
        printf 'complete %2$s %1$s\n' "${(@kv)_comps[(R)_bash*]#* }"
      elif [[ -n $remove ]]; then
        for cmd; do
          unset "_comps[$cmd]"
        done
      else
        compdef _bash_complete\ ${(j. .)${(q)args[1,-1-$#]}} "$@"
      fi
    }
    
    unfunction bashcompinit
    autoload -Uz bashcompinit
    return 0
    PK[ahhfunctions/_hashnuW+A#compdef hash rehash
    
    local state line expl common_args curcontext="$curcontext" ret=1
    typeset -A opt_args
    
    common_args=( \
      '-d[use named directory hash table]' \
      '(-r -m -v)-f[rebuild hash table]' )
    
    case ${service} in
      hash)
        _arguments -C -s -S \
          '(-f -m -v)-r[empty hash table]' \
          '(-f -r)-m[treat arguments as patterns]' \
          '(-f -r -m)-v[list entries as they are added]' \
          '(-f -r -v)-L[list in the form of calls to hash]' \
          "${common_args[@]}" \
          '(-d -f -r -m -v -L)*:hash:->hashval' && ret=0
      ;;
      rehash)
        _arguments -C -s ${common_args[@]} && return 0
      ;;
    esac
    
    if [[ $state = hashval ]]; then
      if (( $+opt_args[-d] )); then
        if compset -P 1 '*='; then
          _wanted -C value files expl directories _path_files -/ && ret=0
        else
          _wanted -C name named-directories expl 'named directory' \
              compadd -q -S '=' -k nameddirs && ret=0
        fi
      elif compset -P 1 '*='; then
        _wanted -C value values expl 'executable file' _files -g '*(-*)' && ret=0
      else
        curcontext="${curcontext%:*}:name"
        _path_commands -q -S '=' && ret=0
      fi
    fi
    
    return ret
    PK[А2functions/calendar_readnuW+A# Utility for "calendar" to read entries into the array calendar_entries.
    # This should be local to the caller.
    # The only argument is the file to read.  We expect options etc. to
    # be correct.
    #
    # This is based on Emacs calendar syntax, which has two implications:
    #  - Lines beginning with whitespace are continuation lines.
    #    Hence we have to read the entire file first to determine entries.
    #  - Lines beginning with "&" are inhibited from producing marks in
    #    Emacs calendar window.  This is irrelevant to us, so we
    #    we simply remove leading ampersands.  This is necessary since
    #    we expect the date to start at the beginning of the line.
    #
    # TODO: Emacs has some special handling for entries where the first line
    # has only the date and continuation lines indicate times.  Actually,
    # it doesn't parse the times as far as I can see, but if we want to
    # handle that format sensibly we would need to here.  It could
    # be tricky to get right.
    
    local calendar=$1 line
    local -a lines
    
    lines=(${(f)"$(<$calendar)"})
    
    calendar_entries=()
    # ignore blank lines
    for line in $lines; do
      if [[ $line = [[:space:]]* ]]; then
        if (( ${#calendar_entries} )); then
          calendar_entries[-1]+=$'\n'$line
        fi
      else
        calendar_entries+=(${line##\&})
      fi
    done
    PK[NKr<<functions/compinstallnuW+A# Configure the completion system.
    
    emulate -L zsh
    setopt extendedglob
    
    local key
    local compcontext=-default-
    
    __ci_tidyup() {
      unfunction -m __ci_\* 2>/dev/null
      unfunction compinstall
      autoload -Uz compinstall
    }
    
    __ci_newline() {
      read -k \
        key"?${1:---- Hit newline to continue or \`q' to exit without saving --- }"
      print
      if [[ $key = [qQ] ]]; then
        print "compinstall aborted."
        __ci_tidyup
        return 1
      else
        return 0
      fi
    }
    
    typeset startline='# The following lines were added by compinstall'
    typeset endline='# End of lines added by compinstall'
    typeset ifile line fpath_line compinit_args opt detect basic line2
    typeset -A styles
    typeset match mbegin mend warn_unknown warn_old warn_comment output
    integer lines_found
    
    while getopts "do" opt; do
      case $opt in
        (d)
        # Detect an existing compinstall setup.
        detect=1
        ;;
    
        (o)
        # Output basic setup information only.
        basic=1
        ;;
      esac
    done
    
    #
    # Check the user's .zshrc, if any.
    #
    # This relies on the stuff we find being only minimally edited from
    # the stuff we originally saved.  A better way of doing this would
    # almost certainly be to use the style mechanism directly:  save the
    # current styles in a variable, delete all styles, read in and evaluate
    # any styles found, manipulate styles directly using zstyle, write out
    # using zstyle -L, and if necessary restore the original styles.  One
    # day I may even do that.
    #
    
    __ci_test_ifile() {
      [[ -f $1 ]] && grep "$endline" $1 >/dev/null 2>&1
    }
    
    local foundold=false
    if zstyle -s :compinstall filename ifile &&
      __ci_test_ifile $ifile; then
      foundold=true
    else
      ifile=${ZDOTDIR:-~}/.zshrc
      if __ci_test_ifile ${ZDOTDIR:-~}/.compinstall; then
        ifile=${ZDOTDIR:-~}/.compinstall
        foundold=true
      elif __ci_test_ifile $ifile; then
        foundold=true
      fi
    fi
    
    
    if [[ -n $detect ]]; then
      __ci_tidyup
      [[ $foundold = true ]]
      return
    fi
    
    
    __ci_output() {
      print -r "$startline"
      [[ -n $output ]] && print -r "$output"
      if [[ -n $ifile ]]; then
        line="zstyle :compinstall filename ${(qq)ifile}"
        print -r "$line"
        eval "$line"
      fi
    
      [[ -n $fpath_line ]] && print -r "$fpath_line"
    
      print -r "
    autoload -Uz compinit
    compinit${compinit_args:+ $compinit_args}"
    
      print -r "$endline"
    }
    
    
    if [[ -n $basic ]]; then
      __ci_output
      __ci_tidyup
      return
    fi
    
    local newifile=$ifile
    if [[ $foundold = true ]]; then
      if [[ $newifile != [~/]* ]]; then
        newifile=${ZDOTDIR:-~}/$newifile
        print "[Existing completion definition file is not absolute path:
    updating to $newifile]"
      fi
      print "I have found completion definitions in $newifile.
    If you want me to read these, just hit return.  Otherwise, edit the file
    name to look for definitions somewhere else, or delete the whole line
    in order not to use existing definitions."
      vared -ch -p 'file> ' newifile
      if [[ -n $newifile && $newifile != [/~]* ]]; then
        newifile=$PWD/$newifile
        print "[Not absolute path: updating to $newifile]"
      fi
      [[ -z $newifile || ! -f $newifile ]] && foundold=false
    else
      print "I haven't found any existing completion definitions.
    If you have some already defined by compinstall, edit the name of the
    file where these can be found.  Note that this will only work if they
    are exactly the form in which compinstall inserted them.  If you leave
    the line as it is, or empty, I won't search."
      while true;  do
        vared -ch -p 'file> ' newifile || break
        if [[ -n $newifile && $newifile != [/~]* ]]; then
          newifile=$PWD/$newifile
          print "[Not absolute path: updating to $newifile]"
        fi
        if [[ -n $newifile && $ifile != $newifile ]]; then
          if __ci_test_ifile $newifile; then
            foundold=true
    	break
          fi
          print "I couldn't find any definitions there.  Edit a new filename, or
    leave the line blank to ignore it."
        else
          break
        fi
      done
    fi
    ifile=${~newifile}
    
    if [[ $foundold = true ]]; then
      sed -n "/^[ 	]*$startline/,/^[ 	]*$endline/p" $ifile |
      # We can't use the default read behaviour to handle continuation lines
      # since it messes up internal backslashes.
      while read -r line; do
        # detect real continuation backslashes by checking there are an
        # odd number together.  i think this is reliable since the only
        # other way of quoting a backslash involves following it with
        # a closing quote.
        while [[ $line = *\\ ]]; do
          line2=${(M)line%%\\##}
          (( ${#line2} & 1 )) || break
          read -r line2 || break
          line="${line[1,-2]}$line2"
        done
        (( lines_found++ ))
        if [[ $line = *'$fpath'* ]]; then
          fpath_line=$line
          if [[ $line != *\) ]]; then
            while read -r line; do
              fpath_line="$fpath_line
    $line"
              [[ $line = *\) ]] && break
            done
          fi
        elif [[ $line = (#b)[[:blank:]]#zstyle[[:blank:]]##(\'[^\']#\')\
    [[:blank:]]##([^[:blank:]]##)[[:blank:]]##(*) ]]; then
          styles[$match[2]]="${styles[$match[2]]:+${styles[$match[2]]}
    }${(Q)match[1]}
    ${match[3]}"
        elif [[ $line = [[:blank:]]#compconf* ]]; then
          warn_old=1
        elif [[ $line == $startline || $line == $endline ]]; then
          # no-op
        elif [[ $line = [[:blank:]]#\#* ]]; then
          warn_comment=1
        elif [[ $line = [[:blank:]]#compinit[[:blank:]]##(#b)([^[:blank:]]*) ]]
        then
          compinit_args=$match[1]
        elif [[ $line != [[:blank:]]# &&
          $line != [[:blank:]]#'autoload '*' compinit' &&
          $line != [[:blank:]]#compinit &&
          $line != [[:blank:]]#zstyle[[:blank:]]#:compinstall* ]]; then
          warn_unknown="${warn_unknown:+$warn_unknown
    }$line"
        fi
      done
    fi
    
    #
    # Print warnings about what we found in .zshrc.
    #
    
    if [[ -n $warn_old ]]; then
      print "\
    WARNING: your configuration appears to contain commands for the 3.1.6
    configuration system.  You will have to reconfigure from scratch and the
    existing configuration commands will be overwritten.  If you wish to preserve
    the old commands, you should quit, copy them somewhere else, then rerun
    compinstall.  Sorry."
    elif [[ -n $warn_unknown ]]; then
      print "\
    WARNING: your configuration contains bits not understood by compinstall,
    which will not be retained (shown below).  If you wish to retain these, you
    should quit, copy them somewhere else, and then rerun compinstall.
    
    $warn_unknown"
    elif [[ -n $warn_comment ]]; then
      print "All the comments in your configuration section will be lost.
    If you want to keep them, you should copy them somewhere else first."
    elif (( ! $lines_found )); then
      print "Starting a new completion configuration from scratch."
      if [[ -n $ifile && ! -d $ifile ]]; then
        print -n "This will be "
        if [[ ! -f $ifile ]]; then
          print "written to the new file $ifile."
        elif [[ ! -w $ifile ]]; then
          print "written to the file ~/.compinstall for copying to $ifile."
          ifile=$HOME/.compinstall
        else
          print "appended to the file $ifile.  It is up to you to ensure
    that these lines are actually executed.  They will not be if your .zshrc
    usually returns before the end."
        fi
      fi
    fi
    print "Note that you will be given a chance to save the new setup
    somewhere else at the end."
    
    
    __ci_newline || return 1
    
    
    typeset d compdir subdirs lines
    
    #
    # Make sure we have the completion functions in $fpath.
    #
    
    __ci_set_compdir() {
      for d in $*; do
        # If we find both the functions more than once, assume the later
        # one is the standard set.
        if [[ -f $d/compinit && -f $d/compdump ]]; then
          compdir=$d
        fi
      done
    }
    
    __ci_set_compdir $fpath
    
    if [[ -d $compdir/Base/Core ]]; then
      subdirs=2
    elif [[ -d $compdir/Base ]]; then
      subdirs=1
      ### compdir=${compdir:h}
    fi
    
    if [[ -z $compdir ]]; then
      # Start up a new zsh and get its default fpath.  If some swine has
      # tinkered with this in /etc/zshenv we're out of luck.
      lines=(${(f)"$(zsh -fc 'print -l $ZSH_VERSION $fpath')"})
      line=$lines[1]
      shift lines
      # If the zsh in that path isn't right, maybe the user's shell is elsewhere.
      if [[ $line != $ZSH_VERSION && -x $SHELL ]]; then
        lines=(${(f)"$($SHELL -fc 'print -l $ZSH_VERSION $fpath' 2>/dev/null)"})
        line=$lines[1]
        shift lines
      fi
      if [[ $line != $ZSH_VERSION ]]; then
        print "Hmmm, the zsh in your path is not what's running, nor is \$SHELL.
    That's bad.
    "
      fi
      __ci_set_compdir $lines
      if [[ -n $compdir ]]; then
        print "\
    I've found the completion directories and will add them to your \$fpath,
    but they should already be there at shell startup, so something (probably
    an unconditional assignment in a startup file) is taking them out.  You
    might want to check this, although what I'm doing should work."
        if [[ -n $fpath_line ]]; then
          print "\
    
    What's more, there is already an \$fpath assignment in your completion
    setup.  This gives me cause for concern.  I will override this, but don't
    be surprised if it doesn't go according to plan.  If you have not
    initialised completion in this shell, you should do so, then run
    compinstall again."
        fi
      fi
      if [[ $subdirs = 2 ]]; then
        fpath_line=($compdir/[A-Z]*/[A-Z]*)
        fpath_line="fpath=($fpath ${(F)fpath_line})"
      elif [[ -n $subdirs ]]; then
        fpath_line=($compdir/[A-Z]*)
        fpath_line="fpath=($fpath ${(F)fpath_line})"
      fi
    else
      if [[ $subdirs = 2 ]]; then
        print "Completion directories $compdir/*/*
    are already in your \$fpath, good."
      elif [[ -n $subdirs ]]; then
        print "Completion directories $compdir/*
    are already in your \$fpath, good."
      else
        print "Completion directory $compdir
    is already in your \$fpath, good."
      fi
      if [[ -n $fpath_line ]]; then
        print "I shall keep the existing \$fpath=( ... ) assignment."
      fi
    fi
    
    if [[ -z $compdir ]]; then
      print "\
    The zsh in your path doesn't seem to have completion directories in the
    function autoload path (\$fpath).  This suggests the shell wasn't installed
    for completion.  If you want to use it, you will need to locate all the
    completion functions yourself and install them in your \$fpath.  I will
    continue, but don't expect this to have much effect until you do.
    
    If you are planning to continue using the old compctl system for
    completion, compinstall won't do you any good anyway."
    fi
    
    __ci_newline || return 1
    
    
    #
    # Code for changing styles
    #
    
    typeset defcontext=":completion:*"
    typeset curcontext=$defcontext
    
    #
    # Utility functions
    #
    
    #
    # Get the style $1 for $curcontext into $2.
    #
    __ci_get_this_style() {
      typeset -A tassoc
      local style=$1 scalar=$2
    
      tassoc=(${(f)styles[$style]})
      eval "$scalar=\${tassoc[\$curcontext]}"
    }
    
    #
    # Set the style $1 for $curcontext using scalar $2 for the value for this
    # context.  If $2 is null, delete the context (this may not be correct for
    # all styles).  Don't do any extra quotation.
    # $2 gives the name of the scalar for symmetry with __ci_get_this_style.
    #
    __ci_set_this_style() {
      local style=$1 scalar=$2 k
      typeset -A tassoc
      tassoc=(${(f)styles[$style]})
    
      if [[ -n ${(P)scalar} ]]; then
        tassoc[$curcontext]=${(P)scalar}
      else
        unset "tassoc[$curcontext]"
      fi
    
      styles[$style]=
      for k in ${(ko)tassoc}; do
        styles[$style]="${styles[$style]:+$styles[$style]
    }$k
    ${tassoc[$k]}"
      done
    }
    
    #
    # Functions displaying menus
    #
    
    __ci_change_context() {
      clear
      print "\
                 *** compinstall: change context ***
    
    The context tells the completion system under what circumstances your
    value will be used.  It has this form:
      :completion:::::
    See the documentation for more detail on each of these components.  The
    default context \`$defcontext' matches everywhere in completion, unless you
    define a more specific pattern which matches the completion context being
    used. \`More specific' means either a string instead of a pattern, or a
    longer pattern instead of a shorter pattern.
    
    Edit a new context, or leave the line blank to reset the context to the
    default value.  Note that you do not require quotes around the context,
    which will automatically be added later.  Line editing and history are
    available.
    "
    
      vared -eh -p 'context> ' curcontext
      [[ -z $curcontext ]] && curcontext=$defcontext
    }
    
    
    __ci_toggle_completer() {
      # used locally within __ci_do_completers
      if [[ -n $completers[$1] ]]; then
        completers[$1]=
      else
        completers[$1]=1
      fi
    }
    
    __ci_do_minor_completer_options() {
      # Set the options for the minor completers.
      local key cond word olist omenu moriginal aspace tmparr
      __ci_get_this_style condition cond
      [[ -n $cond ]] && cond=${(Q)cond}
      __ci_get_this_style word word
      __ci_get_this_style old-list olist
      __ci_get_this_style old-menu omenu
      __ci_get_this_style match-original moriginal
      __ci_get_this_style add-space aspace
    
      while true; do
    
        # insert-unambiguous can be handled somewhere else.
        clear
        print "\
                  *** compinstall: minor completer options ***
    
    Current context: $curcontext
    
    l.     Set options for _list: condition for delay and comparison.
    o.     Set options for _oldlist: when to keep old list.
    m.     Set options for _match: whether to assume a \`*' at the cursor.
    p.     Set options for _prefix: whether to add a space before the suffix.
    
    q.     Return to the previous menu without saving.
    0.     Done setting completer options.
    "
    
        read -k key'?--- Hit selection --- '
        print
    
        [[ $key = 0 ]] && break
    
        case $key in
          [lL]) print "\
    You can set a condition under which the _list completer will delay completion
    until the second keypress.  It should evaluate to a number; a non-zero value
    turns this behaviour on.  It can include parameters, in particular NUMERIC
    to refer to a numeric argument.  For example, \`NUMERIC != 1' forces the
    delay unless you give an argument 1 to the command.  Leave it blank to
    assume the condition is true."
                vared -eh -c -p 'condition> ' cond
    	    print -n "
    _list will usually compare the contents of the entire line with its previous
    contents to decided if it has been changed since the last keypress.  You
    can instead perform this comparison on just the current word, ignoring
    the rest of the command line.  Do you want to do this? (y/n) [n] "
    	    word=
                read -q key && word=true
    	    print
    	    ;;
          [oO]) print "\
    _oldlist can keep a generated completion list for reshowing in the usual
    way, e.g. with ^D, even if the list was generated by some special completion
    command.  The default behaviour of _oldlist is to show this list if it was
    not already visible, otherwise to generate the standard completion listing,
    but you can force it always to be shown, or make it never shown.
    Alternatively, you can specify a list of completers for which _oldlist will
    be used.  Choose:
    
    d.    Default behaviour.
    a.    Always show old list.
    n.    Never show old list.
    s.    Specify a list of completers.
    "
    
                while true; do
    	      read -k key'?--- Hit selection --- '
    	      print
    	      case $key in
    		[dD]) olist=
    		   ;;
    		[aA]) olist=always
    		      ;;
    		[nN]) olist=never
    		      ;;
    		[sS]) olist=
    		      tmparr=(_complete _approximate _correct _match _expand)
    		      while true; do
    			clear
    			print "\
         *** compinstall:  choosing completers to have _oldlist behaviour ***
    
    Type any of:
    
    1.  _complete
    2.  _approximate
    3.  _correct
    4.  _match
    5.  _expand
    
    or 0 to end, or - to delete the last choice."
    			if [[ -n $olist ]]; then
    			  print "\
    Current choices:
      $olist"
    			fi
    			read -k key'?--- Hit selection --- '
    			print
    			case $key in
    			  0) break
    			     ;;
    			  -) olist=(${olist[1,-2]})
    			     ;;
    			  [1-5]) olist=($olist $tmparr[$key])
    			         ;;
    			esac
                          done
    		      ;;
    		*) print "Type one of d, a, n or s."
    		   continue
    		   ;;
    	      esac
    	      break
    	    done
    
    	    print -n "
    _oldlist can keep the old completion list for use in menu completion, e.g. by
    repeatedly hitting tab, even if the list was generated by some special
    completion command.  This is the default behaviour of _oldlist, but
    you can turn it off, so that hitting tab would use the standard completion
    list.
    
    Do you want to turn it off? (y/n) [n] "
                omenu=
    	    read -q key && omenu=false
    	    ;;
          [mM]) print "\
    The _match completer will usually assume there is a \`*' at the cursor
    position when trying pattern matches.  For example, \`f*ne' would
    be able to complete to \`filename', not just to patterns matching \`f*ne'.
    (Note that this assumes you have the option COMPLETE_IN_WORD set, else all
    completion takes place at the end of the word.)  You can tell _match not
    to assume there is a \`*', or to try first without the \`*', then with it.
    Type one of:
    
    a.     Always assume \`*' at cursor position.
    n.     Never assume \`*' at cursor position.
    w.     Try without the \`*', then with it if that fails."
                while true; do
    	      read -k key'?--- Hit selection --- '
    	      print
    	      case $key in
    		a) moriginal=
    		   ;;
    		n) moriginal=only
    		   ;;
    		w) moriginal=both
    		   ;;
    		*) print "Type one of a, n or w."
    		   continue
    		   ;;
    	      esac
    	      break
    	    done
                ;;
          [pP]) print -n "\
    The _prefix completer completes only what is behind the cursor, ignoring
    completely what is after, even if there is no space at the cursor position.
    However, you can force it to add a space between the resulting completion
    and the part ignored.  For example, \`fbar' might expand to \`filebar'
    without this, and to \`file bar' with it.  Do wish _prefix to add the
    space? (y/n) [n] "
                aspace=
                read -q key && aspace=true
    	    ;;
          [qQ]) return 1
    	    ;;
        esac
    
      done
    
      [[ -n $cond && $cond != [[:alnum:]]## ]] && cond=${(qq)cond}
      __ci_set_this_style condition cond
      __ci_set_this_style word word
      __ci_set_this_style old-list olist
      __ci_set_this_style old-menu omenu
      __ci_set_this_style match-original moriginal
      __ci_set_this_style add-space aspace
    
      return 0
    }
    
    __ci_do_minor_completers() {
      # Set the minor completers not handled by __ci_do_completers.
      # Called within __ci_do_completers, so inherits the environment.
      # It's only divided off to keep the menus short.
    
      local key
    
      while true; do
    
        clear
        print "\
                  *** compinstall: minor completer menu ***
    
    Current context: $curcontext
    
    The following completers are available.  Those marked \`(*)' are already
    set for the context shown above.  Note none of these are required for
    normal completion behaviour.
    
    1. ${${completers[_ignored]:+(*)}:-   } _ignored: $ckeys[_ignored]
    2. ${${completers[_list]:+(*)}:-   } _list:    $ckeys[_list]
    3. ${${completers[_oldlist]:+(*)}:-   } _oldlist: $ckeys[_oldlist]
    4. ${${completers[_match]:+(*)}:-   } _match:   $ckeys[_match]
    5. ${${completers[_prefix]:+(*)}:-   } _prefix:  $ckeys[_prefix]
    
    o.     Set options for the completers above.
    q.     Return without saving.
    0.     Done setting minor completers.
    "
        read -k key'?--- Hit selection --- '
        print
    
        [[ $key = 0 ]] && break
    
        case $key in
          1) __ci_toggle_completer _ignored
    	 if [[ -n $completers[_ignored] ]]; then
    	   print "\
    I am inserting the \`ignored' completer immediately after normal
    completion.  You can move it later in the list by hand, if you prefer, so
    that ignored completions are only used after, for example, approximations.
    To do this, edit $ifile, look for the zstyle ... completers line, and
    move \`_ignored' to where you want it.  This will be retained if you use
    compinstall again provided you don't go into the completers menu.
    "
    	   # TODO: we could be more careful about keeping the user's
    	   # order, particularly with multiple completers.
               read -k key'?--- Hit any key to continue --- '
    	   print
    	 fi
    	 ;;
          2) __ci_toggle_completer _list
    	 ;;
          3) __ci_toggle_completer _oldlist
    	 ;;
          4) __ci_toggle_completer _match
    	 ;;
          5) __ci_toggle_completer _prefix
    	 ;;
          o) __ci_do_minor_completer_options
    	 ;;
          q) return 1
    	 ;;
        esac
    
      done
    
      return 0
    }
    
    __ci_do_completer_options() {
      # Set options for the main completers; called from __ci_do_completers.
    
      local maxe errors prompt glob subst compl cond
    
      __ci_get_this_style max-errors errors
      __ci_get_this_style prompt prompt
      [[ -n $prompt ]] && prompt=${(Q)prompt}
      __ci_get_this_style glob glob
      [[ -n $glob ]] && glob=${(Q)glob}
      __ci_get_this_style substitute subst
      [[ -n $subst ]] && subst=${(Q)subst}
      __ci_get_this_style completions compl
      [[ -n $compl ]] && compl=${(Q)compl}
    
      while true; do
    
        clear
        print "\
                  *** compinstall: completer options ***
    
    Current context: $curcontext
    
    The following options are available.  Note that these require the relevant
    completers to be present, as set in the menu above this one.
    
    a.     Set options for approximation or correction.
    e.     Set options for expansion.
    q.     Return without saving.
    
    0.     Done setting options.
    "
    
        read -k key'?--- Hit selection --- '
        print
    
        # We handle approximation and correction together to avoid having
        # to be too particular about context.
        case $key in
          a) clear
             print "\
    Approximation and correction can correct the errors in what you have typed,
    up to a maximum number of errors which you can specify.  Each \`error'
    is the omission of a character, the addition of a superfluous character,
    the substitution of one character by an incorrect one, or transposition of
    two different characters.
    
    Current context: $curcontext
    
    To have different values for approximation and correction, you should
    change the context appropriately.  For approximation, use
    \`:completion:*:approximate:*' and for correction use
    \`:completion:*:correct:*'.
    
    Enter maximum number of errors allowed:
    "
             maxe=
    	 while true; do
    	   vared -eh -c -p "number> " maxe
    	   [[ $maxe = [[:digit:]]## ]] && break
    	   print "Please enter a number"
    	   maxe=
    	 done
    	 while true; do
    	   print "\nSelect behaviour of numeric prefix.
    
    1.     Numeric prefix is not used by approximation or completion.
    2.     Numeric prefix, if provided, gives max number of errors allowed,
           replacing the number you just typed for that one completion.
    3.     Numeric prefix, if provided, prevents approximation or completion
           from taking place at all for that one completion.
    "
               read -k -- key'?--- Hit selection --- '
    	   print
    	   [[ $key = [123] ]] || continue
    	   case $key in
                 2) maxe="$maxe numeric"
    		;;
    	     3) maxe="$maxe not-numeric"
    		;;
    	   esac
    	   print "
    You can edit a prompt which will appear above lists of corrections.  The
    string \`%e' inside the prompt will be replaced with the number of errors
    found.  Leave blank for no prompt.  Quotation marks will be added
    automatically."
    	   vared -eh -c -p "prompt> " prompt
    	   break
    	 done
    	 errors=$maxe
    	 ;;
          e) while true; do
               clear
               print "\
    The _expand completer can be tuned to perform any of globbing (filename
    generation), substitution (anything with a \`\$' or backquote), or
    normal completion (which is useful for inserting all possible completions
    into the command line).  For each feature, a 1 turns it on, while a 0 turns
    it off; if the feature is unset, that expansion will *not* be performed.
    
    You can also give more complicated mathematical expressions, which can use
    the parameter NUMERIC to refer to the numeric argument.  For example, the
    expression \`NUMERIC == 2' means that the expansion takes effect if you
    type ESC-2 (Emacs mode) or 2 (Vi command mode) before the expansion.
    Quotes will be added automatically as needed.
    
    g.     Set condition to perform globbing: ${glob:-unset}
    s.     Set condition to perform substitution: ${subst:-unset}
    c.     Set condition to perform completion: ${compl:-unset}
    0.     Done setting conditions (will not be saved until you leave options)
    "
               read -k key'?--- Enter selection --- '
    	   print
    
    	   case $key in
    	     g) vared -eh -c -p 'globbing condition> ' glob
    		;;
    	     s) vared -eh -c -p 'substitution condition> ' subst
    		;;
    	     c) vared -eh -c -p 'completion condition> ' compl
    		;;
    	   esac
    
    	   [[ $key = 0 ]] && break
    
             done
    	 ;;
          q) return 1
    	 ;;
        esac
    
        [[ $key = 0 ]] && break
      done
    
      __ci_set_this_style max-errors errors
      [[ -n $prompt ]] && prompt=${(qq)prompt}
      __ci_set_this_style prompt prompt
      [[ -n $glob && $glob != [[:alnum:]]## ]] && glob=${(qq)glob}
      __ci_set_this_style glob glob
      [[ -n $subst && $subst != [[:alnum:]]## ]] && subst=${(qq)subst}
      __ci_set_this_style substitute subst
      [[ -n $compl && $compl != [[:alnum:]]## ]] && compl=${(qq)compl}
      __ci_set_this_style completions compl
    
      key=
      return 0
    }
    
    __ci_do_completers() {
      # Set the completers for the current context.
      # This is mostly done via a series of toggles.
    
      typeset -A completers ckeys
      local c clist newc
      __ci_get_this_style completer newc
      for c in ${=newc}; do
        completers[$c]=1
      done
      if (( ${#completers} == 0 )); then
        completers[_complete]=1
        completers[_ignored]=1
      fi
      clist=(_list _oldlist _menu _expand _complete _ignored
             _match _correct _approximate _prefix)
    
      # TODO: these are a bit brief, so could provide some more detailed help.
      ckeys=(_complete 'Basic completion.'
             _approximate
    'Approximate completion:  completion with correction of existing word.'
             _correct
    'Correction:  correct existing word, no completion.'
             _expand
    'Expansion: use globbing and parameter substitution, if possible.'
    
    	 _ignored
    'Use patterns that were previously ignored if no matches so far.'
             _list
    'Only list matches until the second time you hit TAB.'
             _oldlist
    'Keep matches generated by special completion functions.'
            _match
    'If completion fails, retry with pattern matching.'
             _prefix
    'If completion fails, retry ignoring the part after the cursor.'
             )
    
      # TODO: You'll need to handle the bindkey to make _expand work.
      # TODO: _prefix completer should make sure completeinword is set.
    
      while true; do
    
        clear
        print "\
                  *** compinstall: completer menu ***
    
    Current context: $curcontext
    
    The following completers are available.  Those marked \`(*)' are already
    set for the context shown above.  If none are selected, the completers will
    not be set for this context at all.
    
    1. ${${completers[_complete]:+(*)}:-   } $ckeys[_complete]
    2. ${${completers[_approximate]:+(*)}:-   } $ckeys[_approximate]
    3. ${${completers[_correct]:+(*)}:-   } $ckeys[_correct]
    4. ${${completers[_expand]:+(*)}:-   } $ckeys[_expand]
    
    o.     Set options for the completers above.
    m.     Set completers that modify the behaviour of the four main ones above.
    q.     Return without saving.
    0.     Done setting completers.
    "
        read -k key'?--- Hit selection --- '
        print
    
        case $key in
          1) __ci_toggle_completer _complete
    	 ;;
          2) __ci_toggle_completer _approximate
    	 ;;
          3) __ci_toggle_completer _correct
    	 ;;
          4) __ci_toggle_completer _expand
    	 ;;
          [mM]) __ci_do_minor_completers || return
                continue
    	    ;;
          [oO]) __ci_do_completer_options || return
                continue
    	    ;;
          q) return 1
    	 ;;
        esac
    
        [[ $key = 0 ]] && break
      done
    
      newc=
      for c in $clist; do
        [[ -n $completers[$c] ]] && newc="${newc:+$newc }$c"
      done
      [[ -z $newc ]] && newc="''"
      __ci_set_this_style completer newc
    }
    
    __ci_toggle_matcher() {
      # Toggle on/off the matcher in array $1 for element $2
      if [[ ${${(P)1}[$2]} = ' ' ]]; then
        # toggle on
        eval "${1}[$2]=$2"
        if [[ $1 = n* ]]; then
          # no matcher turned on, turn off the others
          c_list[$2]=' '
          C_list[$2]=' '
          p_list[$2]=' '
          s_list[$2]=' '
        else
          # something else turned on, turn off no matcher
          n_list[$2]=' '
        fi
        return 0
      else
        # toggle off
        eval "${1}[$2]=' '"
        if [[ $c_list[$2] == ' ' && $C_list[$2] == ' ' && \
    	  $p_list[$2] == ' ' && $s_list[$2] == ' ' ]]; then
          a_or_r[$2]=' '
        fi
        return 1
      fi
    }
    
    __ci_do_matchers() {
      # Set matchers via the matcher-list style.
      # We just offer a pre-programmed set of possible matchers, but these
      # cover the most common usages for matchers in a general context.
      # More specific use of matchers is usually covered by completion functions.
    
      local mlist m_ci m_pw m_sub c_list C_list p_list s_list pw_seps key key2 elt
      local pw_dstar a_or_r i
      integer eltcnt lastnz
    
      __ci_get_this_style matcher-list mlist
      # $mlist is the once and future list of matchers.  We don't quote it
      # until the end; the eval effectively does de-quoting.
      eval "mlist=($mlist)"
      # ?_list say whether the four possible matchers are set for passes 1,
      # 2, 3, 4, in an easy-to-read manner, i.e. the Nth part of the string
      # is one of N (on) or space (off).
      a_or_r="    "                 # replace by default
      n_list="    "			# null completion, i.e. standard
      c_list="    "			# case match one way
      C_list="    "			# case match both ways
      p_list="    "			# partial word completion
      s_list="    "			# substring completion
      # $pw_seps gives the separators used for partial-word completion
      # by element of the matcher list; these can be edited separately.
      pw_seps=('._-' '._-' '._-' '._-')
      pw_dstar=('' '' '' '')
    
      # See what's in the matcher initially.  If these have been edited,
      # we're in trouble, but that's pretty much true of everything.
      for (( eltcnt = 1; eltcnt <= $#mlist; eltcnt++ )); do
        [[ $mlist[eltcnt] == "+"* ]] && a_or_r[$eltcnt]='+'
        [[ -z $mlist[$eltcnt] ]] && n_list[$eltcnt]=$eltcnt
        # Accept the old form of lower/upper correspondence, but we'll
        # output the new one instead.
        [[ $mlist[$eltcnt] = *"m:{a-z}={A-Z}"* ]] && c_list[$eltcnt]=$eltcnt
        [[ $mlist[$eltcnt] = *"m:{[:lower:]}={[:upper:]}"* ]] &&
          c_list[$eltcnt]=$eltcnt
        [[ $mlist[$eltcnt] = *"m:{a-zA-Z}={A-Za-z}"* ]] && C_list[$eltcnt]=$eltcnt
        [[ $mlist[$eltcnt] = *"m:{[:lower:][:upper:]}={[:upper:][:lower:]}"* ]] &&
          C_list[$eltcnt]=$eltcnt
        # For partial word stuff, we use backreferences to find out what
        # the set of separators was.
        if [[ $mlist[$eltcnt] = (#b)*"r:|["([^\]]#)"]=*"#" r:|=*"* ]]; then
          p_list[$eltcnt]=$eltcnt
          pw_seps[$eltcnt]=${match[1]}
          [[ $mlist[$eltcnt] = *"=**"* ]] && pw_dstar[$eltcnt]='*'
        fi
        # Just look for the left matcher for substring, since the right matcher
        # might have been handled as part of a partial-word spec.
        [[ $mlist[$eltcnt] = *"l:|=*"* ]] && s_list[$eltcnt]=$eltcnt
      done
    
      while true; do
        clear
        print "\
                  *** compinstall: matcher menu ***
    
    \`Matchers' compare the completion code with the possible matches in some
    special way.  Numbers in parentheses show matchers to be tried and the order.
    The same number can be assigned to different matchers, meaning apply at the
    same time.  Omit a sequence number to try normal matching at that point.
    A \`+' in the first line indicates the element is added to preceding matchers
    instead of replacing them; toggle this with \`t'.  You don't need to set
    all four, or indeed any matchers --- then the style will not be set.
    
       ($a_or_r)\
       \`+' indicates add to previous matchers, else replace
    n. ($n_list)\
     No matchers; you may want to try this as the first choice.
    c. ($c_list)\
     Case-insensitive completion (lowercase matches uppercase)
    C. ($C_list)\
     Case-insensitive completion (lower/uppercase match each other)
    p. ($p_list)\
     Partial-word completion:  expand 'f.b' to 'foo.bar', etc., in one go.
              You can choose the separators (here \`.') used each time.
    s. ($s_list)\
     Substring completion:  complete on substrings, not just initial
              strings.  Warning: it is recommended this not be used for element 1.
    
    t.        Toggle replacing previous matchers (\` ' at top) or add (\`+')
    q.        Return without saving.
    0.        Done setting matchers.
    "
    
        read -k key'?--- Hit selection --- '
        print
    
        if [[ $key = [nNcCpPsS] ]]; then
          while true; do
    	read -k key2'?Set/unset for element number (1234)? '
    	print
    	[[ $key2 = [1234] ]] && break
    	print "Only 1, 2, 3 and 4 are handled."
          done
        fi
    
        case $key in
          [nN]) __ci_toggle_matcher n_list $key2
             if [[ $n_list[$key2] != ' ' ]]; then
    	 fi
             ;;
          c) __ci_toggle_matcher c_list $key2
    	 ;;
          C) __ci_toggle_matcher C_list $key2
    	 ;;
          [pP]) if __ci_toggle_matcher p_list $key2; then
    	      print "\
    Edit the set of characters which terminate partial words.  Typically
    these are punctuation characters, such as \`.', \`_' and \`-'.
    The expression will automatically be quoted.
    "
                  vared -eh -p 'characters> ' -c 'pw_seps['$key2']'
    	      # Paranoia: we don't know if there's a ']' in that string,
    	      # which will wreck the spec unless it's at the start.  Other
    	      # quotes are OK, since they are picked up at the ${(qq)...}
    	      # step.
    	      if [[ $pw_seps[$key2] = *']'* ]]; then
    		pw_seps[$key2]="]${pw_seps[$key2]//\\\]}"
    	      fi
    	      print -n "
    You can allow the partial-word terminators to be matched in the pattern,
    too:  then  for example \`c.u' would expand to \`comp.source.unix', whereas
    usually you would need to type an extra intervening dot.  Do you wish the
    terminators to be matched in this way? (y/n) [n] "
                  pw_dstar[$key2]=
    	      read -q key && pw_dstar[$key2]='*'
    	    fi
    	    ;;
          [tT])
    	    read -k key2'?Toggle augment/replace for elements number (1234)? '
    	    if [[ $key2 == [1234] ]]; then
    	      if [[ $a_or_r[$key2] == ' ' ]]; then
    	        a_or_r[$key2]='+'
    	      else
    	        a_or_r[$key2]=' '
    	      fi
    	    else
    	      print "Only 1, 2, 3 and 4 are handled."
    	    fi
    	    ;;
          [sS]) __ci_toggle_matcher s_list $key2
    	    ;;
          [qQ]) return 1
    	 ;;
        esac
    
        [[ $key = 0 ]] && break
      done
    
      # Keep track of the last element which was non-empty; all the rest
      # are junked.
      lastnz=0
    
      # Now we just reverse the first for-loop, looking for set matchers
      # and reconstructing the elements of the matcher array.
      for (( eltcnt = 1; eltcnt <= 4; eltcnt++ )); do
        elt=
        [[ $c_list[$eltcnt] != ' ' ]] &&
          elt="${elt:+$elt }m:{[:lower:]}={[:upper:]}"
        [[ $C_list[$eltcnt] != ' ' ]] &&
          elt="${elt:+$elt }m:{[:lower:][:upper:]}={[:upper:][:lower:]}"
        [[ $p_list[$eltcnt] != ' ' ]] &&
          elt="${elt:+$elt }r:|[${pw_seps[$eltcnt]}]=*${pw_dstar[$eltcnt]}\
     r:|=*${pw_dstar[$eltcnt]}"
        if [[ $s_list[$eltcnt] != ' ' ]]; then
          if [[ $elt = *"r:|=*"* ]]; then
    	elt="${elt:+$elt }l:|=*"
          else
    	elt="${elt:+$elt }l:|=* r:|=*"
          fi
        fi
        [[ $a_or_r[$eltcnt] != ' ' ]] && elt="+$elt"
        [[ -n $elt || $n_list[$eltcnt] != ' ' ]] && lastnz=$eltcnt
        mlist[$eltcnt]=$elt
      done
    
      if (( ! $lastnz )); then
        # No matchers set, so just make the style empty: __ci_set_this_style
        # will omit it completely.
        mlist=
      else
        # Quote the entire list: this correctly quotes element by element,
        # praise be to Sven.
        mlist=(${(qq)mlist[1,$lastnz]})
        # Make it a scalar just for safety's sake.
        mlist="$mlist"
      fi
      __ci_set_this_style matcher-list mlist
    
      return 0
    }
    
    __ci_do_list_format() {
      local key format groupn verbose listp autod haslistp
      __ci_get_this_style format format
      [[ -n $format ]] && format=${(Q)format}
      __ci_get_this_style group-name groupn
      __ci_get_this_style verbose verbose
      __ci_get_this_style list-prompt listp
      [[ -n $listp ]] && haslistp=1
      listp=${(Q)listp}
      __ci_get_this_style auto-description autod
      [[ -n $autod ]] && autod=${(Q)autod}
    
      while true; do
        clear
        print "\
           *** compinstall: order and descriptions in completion lists ***
    Type the appropriate number for more information on how this would affect
    listings.
    
    1.  Print a message above completion lists describing what is being
        completed.
    
    2.  Make different types of completion appear in separate lists.
    
    3.  Make completion verbose, using option descriptions etc. (on by default).
    
    4.  Make single-valued options display the value's description as
        part of the option's description.
    
    q.  Return without saving.
    0.  Done setting options for formatting of completion lists.
    "
    
        read -k key'?--- Hit selection --- '
        print
    
        [[ $key = 0 ]] && break
    
        case $key in
          1) print "\
    You can set a string which is displayed on a line above the list of matches
    for completions.  A \`%d' in this string will be replaced by a brief
    description of the type of completion.  For example, if you set the
    string to \`Completing %d', and type ^D to show a list of files, the line
    \`Completing files' will appear above that list.  Enter an empty line to
    turn this feature off.  If you enter something which doesn't include \`%d',
    then \`%d' will be appended.  Quotation will be added automatically.
    "
             vared -eh -p 'description> ' -c format
    	 if [[ -n $format && $format != *%d* ]]; then
    	   [[ $format = *[[:blank:]] ]] || format="$format "
    	   format="$format%d"
    	 fi
    	 ;;
          2) print "\
    Normally, all possible completions are listed together in a single list, and
    if you have set a description with 1) above, the descriptions are listed
    together above that.  However, you can specify that different types of
    completion appear in separate lists; any description appears above its
    own list.  For example, external commands and shell functions would appear
    in separate lists when you are completing a command name.  Do you
    want to turn this on?
    "
             while true; do
               read -k key'?[y]es, [n]o, [k]eep old setting? '
    	   print
    	   [[ $key = [yYnNkK] ]] && break
    	 done
    	 case $key in
    	   [yY]) groupn="''"
    		 ;;
    	   [nN]) groupn=
    		 ;;
    	 esac
    	 ;;
          3) print "By default, completion uses a \`verbose' setting.  This
    affects different completions in different ways.  For example,  many
    well-known commands have short, uninformative option names; in some cases,
    completion will indicate what the options do when offering to complete them.
    If you prefer shorter listings you can turn this off.  What setting to
    you want?
    "
              while true; do
                read -k key'?[v]erbose, [n]ot verbose, [k]eep old setting? '
                print
                [[ $key = [vVnNkK] ]] && break
              done
              case $key in
    	    # might as well be explicit, particularly since it's
    	    # the only way to override an existing `false' value.
    	    [vV]) verbose=true
    		  ;;
    	    [nN]) verbose=false
    		  ;;
              esac
    	 ;;
          4) print "\
    Many commands have options which take a single argument.  In some cases,
    completion is not set up to describe the option even though it has a
    description for the argument.  You can enter a string containing \`%d',
    which will be replaced by the description for the option.  For
    example, if you enter the string \`specify: %d', and an option -ifile
    exists which has an argument whose description is \`input file', then the
    description \`specify: input file' will appear when the option itself
    is listed.  As this long explanation suggests, this is only occasionally
    useful.  Enter an empty line to turn this feature off.  If you enter
    something which doesn't include \`%d', then \`%d' will be appended.
    Quotation will be added automatically.
    "
             vared -eh -p 'auto-description> ' -c autod
             if [[ -n $autod && $autod != *%d* ]]; then
    	   [[ $autod = *[[:blank:]] ]] || autod="$autod "
    	   autod="$autod%d"
             fi
    	 ;;
          q) return 1
    	 ;;
        esac
      done
    
      [[ -n $format ]] && format=${(qq)format}
      __ci_set_this_style format format
      __ci_set_this_style group-name groupn
      __ci_set_this_style verbose verbose
      [[ -n $autod ]] && autod=${(qq)autod}
      __ci_set_this_style auto-description autod
    }
    
    __ci_do_insertion() {
      local key insertu original # sort
    
      __ci_get_this_style insert-unambiguous insertu
      __ci_get_this_style original original
    
      while true; do
        clear
        print "\
              *** compinstall: options for inserting completions ***
    
    1.   In completers that change what you have already typed, insert any
         unambiguous prefix rather than go straight to menu completion.
    
    2.   In completers which correct what you have typed, keep what you
         originally typed as one of the list of possible completions.
    
    q.   Return with saving.
    0.   Done setting options for insertion.
    "
        read -k key'?-- Hit selection --- '
        print
    
        [[ $key = 0 ]] && break
    
        case $key in
          1) print "\
    The completers which do pattern matching and correction often alter the
    string which is already on the line, in the first case because it was a
    pattern and in the second case because what you typed was wrong.
    Since the possible completions can bear little or no resemblance to one
    another in those cases, so that typing extra characters to resolve the
    completion doesn't make much sense, menu completion is usually turned on
    straight away to allow you to pick the completion you want.  This style
    tells completion that if there is a common, unambiguous prefix in this
    case, you would prefer that to be inserted rather than going straight
    to menu completion.  Do you want this?
    "
             while true; do
               read -k key'?[y]es, [n]o, [k]eep old setting? '
    	   print
    	   [[ $key = [yYnNkK] ]] && break
    	 done
    	 case $key in
    	   [yY]) insertu=true
    	         ;;
    	   [nN]) insertu=false
    		 ;;
    	 esac
    	 ;;
          2) print "\
    For completers which correct what you have typed, you sometimes want
    to keep the original string instead, so if the correction was ambiguous
    the original string is always listed as a possible completion.  However,
    if there was just one completion it is usually accepted.  You can
    force completion to offer the original string as a possibility even in
    this case.  Do you want this?
    "
             while true; do
    	   read -k key'?[y]es, [n]o, [k]eep old setting? '
    	   print
    	   [[ $key = [yYnNkK] ]] && break
    	 done
    	 case $key in
    	   [yY]) original=true
    	         ;;
               [nN]) original=false
    	         ;;
    	 esac
    	 ;;
          [qQ]) return 1
    	      ;;
        esac
    
      done
    
      __ci_set_this_style insert-unambiguous insertu
      __ci_set_this_style original original
      # __ci_set_this_style sort sort
    
      return 0;
    }
    
    
    __ci_do_selection() {
      local key listc menu select amenu elt listp selectp haslistp hasselectp
      integer num
    
      __ci_get_this_style list-colors listc
      __ci_get_this_style menu menu
      __ci_get_this_style list-prompt listp
      [[ -n $listp ]] && haslistp=1
      listp=${(Q)listp}
      __ci_get_this_style select-prompt selectp
      [[ -n $selectp ]] && hasselectp=1
      selectp=${(Q)selectp}
    
      while true; do
        clear
        print "\
         *** compinstall: options for colouring and selecting in lists ***
    
    1.   Use coloured lists for listing completions.
    
    2.   Use cursor keys to select completions from completion lists.
    
    3.   Allow scrolling of long selection lists and set the prompt.
    
    q.   Return without saving.
    0.   Done setting options for insertion.
    "
        read -k key'?--- Hit selection --- '
        print
    
        [[ $key = 0 ]] && break
    
        case $key in
          1) print "\
    Zsh can produce coloured completion listings where different file types
    etc. appear in different colours.  If you want to tailor that to your
    own needs, you will have to edit ~/.zshrc.  Here you have the choice of:
    
    1.  Using the default colours.
    2.  Using the colours already set up for GNU ls via the \$LS_COLORS
        environment variable.  Note this must be set before the completion
        configuration code is executed.
    3.  Turn colouring off.
    0.  Leave the setting the way it is.  Choose this if you have a custom
        setting and you don't want to lose it.
    "
             while true; do
    	   read -k key'?Enter 1, 2, 3, 0: '
    	   print
    	   [[ $key = [1230] ]] && break
    	 done
    	 case $key in
    	   1) listc="''"
    	      ;;
    	   2) listc='${(s.:.)LS_COLORS}'
    	      ;;
    	   3) listc=
    	      ;;
    	 esac
    	 ;;
          2) print "\
    If you use zsh's menu completion and the feature that all short completion
    lists appear below the line on which you are editing, you can enable
    \`menu selection', which lets you pick a completion with the cursor keys:
    the choice is highlighted, and hitting return accepts it.  Note that
    this only happens when you are already using menu completion.  This
    feature can be set so that it is only enabled when there are a certain
    number of completions.  Please enter:
    
    - 0 or 1, to turn this feature on unconditionally
    - a higher number to turn this feature on when there are that many
      completions
    - an \`l' for \`long' to turn it on for listings which don't fit on the
      screen.
    - an \`ll' for \`long list' to turn it on for completions which don't fit
      on the screen, even for commands which only do listing of completions.
      This may be combined with a number which will be used in ordinary selection.
    - a negative number to turn this feature off
    - an empty line to leave the setting the way it is.
    "
    	 # Better to parse and display the current setting.
             while true; do
               vared -eh -p 'value> ' select
    	   [[ -z $select || $select = ((-|)<->|l|<->#ll<->#) ]] && break;
    	   print "Type a number, l, ll, ll, or an empty line." >&2
    	 done
    	 amenu=(${=menu})
    	 elt=${amenu[(i)*select*]}
    	 [[ $elt -eq 0 || $elt -gt $#amenu ]] && elt=
    	 case $select in
    	   <->) if [[ -n $elt ]]; then
    		  amenu[$elt]="select=$select"
    		else
    		  amenu=($amenu "select=$select")
    	        fi
    		menu="$amenu"
    		;;
    	   *ll*) num=${(RS)select##ll}
    	         select="select=long-list"
    		 [[ -n $num ]] && select="$select select=$num"
    		 if [[ -n $elt ]]; then
    		   amenu[$elt]=$select
    		 else
    		   amenu=($amenu $select)
    		 fi
    		 menu="$amenu"
    		 ;;
    	   l#) if [[ -n $elt ]]; then
                     amenu[$elt]="select=long"
                   else
                     amenu=($amenu "select=long")
                   fi
    	       menu="$amenu"
                   ;;
    	   -<->) if [[ -n $elt ]]; then
    		    # i never liked the way indexing was done anyway
    		    if [[ $elt -eq 1 ]]; then
    		      amenu=($amenu[$elt+1,-1])
    		    else
    		      amenu=($amenu[1,$elt-1] $amenu[$elt+1,-1])
    		    fi
    		 fi
    		 menu="$amenu"
    		 ;;
    	 esac
    	 if [[ $menu = *select* ]]; then
    	   print "\
    You can also set a prompt to use for menu selection when it would scroll
    off the screen.  Unless this is set, you won't see a prompt, but the feature
    is still enabled.
    
    Edit a prompt below.  It can contain \`%l' to show the number of matches
    as \`current_number/total_number', \`%p' to show the fraction of
    the way down the list, or font-control sequences such as %B, %U, %S and
    the corresponding %b, %u, %s; quotes will be added automatically.  Delete
    the whole line to turn it off.  Hit return to keep the current value.
    "
    	   [[ -z $hasselectp ]] &&
    	     selectp='%SScrolling active: current selection at %p%s'
    	   vared -eh -p 'prompt> ' -c selectp
    	   [[ -z $selectp ]] && hasselectp=
    	 fi
             ;;
          3) print "\
    You can make completion lists scroll when they don't fit on the screen.
    Note this is different from scrolling in menu selection --- a more basic
    pager is used which should work even with fairly stupid terminals.
    
    To enable this, edit a prompt to show when scrolling is active; an empty 
    string turns this feature off.  It can contain \`%l' to show the number of
    matches as \`current_number/total_number', \`%p' to show the fraction of
    the way down the list, or font-control sequences such as %B, %U, %S and the
    corresponding %b, %u, %s; quotes will be added automatically.  Delete the
    whole line to turn this behaviour off, in which case the display of
    completions which don't fit on the screen is controlled by the LISTMAX
    parameter (currently ${LISTMAX:-unset}), which specifies the maximum number
    to show without asking.  Hit return to keep the current value.
    "
             [[ -z $haslistp ]] &&
    	   listp='%SAt %p: Hit TAB for more, or the character to insert%s'
    	 vared -eh -p 'prompt> ' -c listp
    	 [[ -z $listp ]] && haslistp=
    	 ;;
          q) return 1
             ;;
        esac
      done
    
      __ci_set_this_style list-colors listc
      __ci_set_this_style menu menu
      [[ -n $haslistp ]] && listp=${(qq)listp}
      __ci_set_this_style list-prompt listp
      [[ -n $hasselectp ]] && selectp=${(qq)selectp}
      __ci_set_this_style select-prompt selectp
    
      return 0
    }
    
    
    __ci_do_display() {
      local key usec
    
      __ci_get_this_style use-compctl usec
    
      while true; do
        clear
        print "\
             *** compinstall: display and insertion options ***
    
    1.  Change appearance of completion lists:  allows descriptions of
        completions to appear and sorting of different types of completions.
    
    2.  Change how completions are inserted: includes options for sorting,
        and keeping the original or an unambiguous prefix with correction etc.
    
    3.  Configure coloured/highlighted completion lists, selection of items
        and scrolling.
    
    4.  Change whether old-style \`compctl' completions will be used.
    
    q.  Return without saving.
    0.  Done setting display and insertion options.
    "
    
        read -k key'?--- Hit selection --- '
        print
    
        [[ $key = 0 ]] && break
    
        case $key in
          1) __ci_do_list_format
    	 ;;
          2) __ci_do_insertion
    	 ;;
          3)  __ci_do_selection
    	 ;;
          4) print "\
    Completions defined by the new completion system (the one you are
    configuring) always take precedence over the old sort defined with compctl.
    You can choose whether or not you want to search for a compctl-defined
    completion if no new completion was found for a command.  The default
    behaviour is only to check for compctl-defined completions if the required
    library, zsh/compctl, is already loaded.  (If not, this implies that
    compctl has not been called.)  Do you want to test for compctl-defined
    completions?
    "
             while true; do
    	   read -k key'?[y]es, [n]o, if [l]oaded, [k]eep old setting? '
    	   print
    	   [[ $key = [yYnNlLkK] ]] && break
    	 done
    	 case $key in
    	   [yY]) usec=true
    	         ;;
    	   [nN]) usec=false
    	         ;;
    	   [lL]) usec=
    	         ;;
    	 esac
    	 ;;
          q) return 1
    	 ;;
        esac
    
      done
    
      __ci_set_this_style use-compctl usec
    
      return 0
    }
    
    
    #       file-sort, special-dirs, ignore-parents,
    #       squeeze-slashes,
    __ci_do_file_styles() {
      local key files cursor expand speciald ignorep squeezes select
      local prefon suffon lssuffixes preserve
    
      __ci_get_this_style file-sort files
      __ci_get_this_style ignore-parents ignorep
      __ci_get_this_style special-dirs speciald
      __ci_get_this_style squeeze-slashes squeezes
      __ci_get_this_style expand expand
      __ci_get_this_style list-suffixes lssuffixes
      __ci_get_this_style preserve-prefix preserve
      [[ -n $preserve ]] && preserve=${(Q)preserve}
    
      while true; do
        clear
        print "\
          *** compinstall: options for filename completion ***
    
    1.  Choose how to sort the displayed list of filename matches.
    
    2.  In expressions with .., don't include directories already implied.
    
    3.  Allow completion of . and .. for the bone idle.
    
    4.  When expanding paths, \`foo//bar' is treated as \`foo/bar'.
    
    5.  Configure how multiple paths are expanded and displayed, 
        e.g. /f/b -> /foo/bar
    
    6.  Keep certain prefixes unchanged, such as \`//resource/'.
    
    q.  Return without saving.
    0.  Done setting options for filename completion.
    "
        read -k key'?--- Hit selection --- '
        print
    
        [[ $key = 0 ]] && break
    
        case $key in
          (1) print "\
    Filenames listed as possible completions are usually displayed in
    alphabetical order.  You can alternatively choose:
      s  File size
      l  Number of (hard) links
      m  Modification time
      a  Access time
      i  Inode change time
      n  File name
      k  Keep the current setting
    You can also specify the reverse of any of the above orders (except \`k'):  to
    do this, type the appropriate letter in upper case.
    "
             while true; do
               read -k key'?--- Hit selection --- '
    	   print
    	   [[ $key = [sSlLmMaAiInNkK] ]] && break
    	 done
    	 case $key in
    	   ([sS]) files=size;;
    	   ([lL]) files=links;;
    	   ([mM]) files=modification;;
    	   ([aA]) files=access;;
    	   ([iI]) files=inode;;
    	   ([nN]) files=name;;
    	 esac
    	 if [[ $key = [SLAMIN] ]]; then
    	   # slam it into reverse
    	   files="$files reverse"
    	 fi
    	 ;;
          (2) print "\
    When you type an expression containing \`..', you may usually not want to
    be offered certain directories for completion.
      p   Don't offer parents:  in \`foo/bar/../', don't make \`bar' a completion.
      c   Don't offer the current directory, e.g. after \`../'.
      o   Only perform the two tests if there is a real \`..' in the word so far.
      d   Only perform the two tests when completing directory names.
      0   None of the above; use normal completion.
      k   Keep the current settings.
    You may specify any combination of p, c, o, d including at least one of p
    and c, or you may specify either 0 or k.  Note that the _ignored completer
    functions in the normal way, i.e. you would be able to complete the
    directories in question if nothing else matched.
    "
              while true; do
    	    vared -eh -p 'selection> ' select
    	    [[ ( $select = [pPcCoOdD]# && $select = *[pPcC]* )
    		    || $select = [0kK] ]] && break
    	    print "Type any combination of p, c, o, d, or type 0 or k"
    	  done
    	  case $select in
    	    (0) ignorep=
    		;;
    	    ([pPcCoOdD]#)
    		ignorep=()
    		[[ $select = *[pP]* ]] && ignorep=($ignorep parent)
    		[[ $select = *[cC]* ]] && ignorep=($ignorep pwd)
    		[[ $select = *[oO]* ]] && ignorep=($ignorep ..)
    		[[ $select = *[dD]* ]] && ignorep=($ignorep directory)
    		;;
    	  esac
    	  ;;
          (3) print "\
    Filename completion does not usually offer the directory names \`.' and
    \`..' as choices.  However, some immensely lazy people can't even be
    bothered to type these.  Do you wish to be offered \`.' and \`..' as
    choices ([y]es, [n]o, [k]eep current setting)?
    "
              while true; do
                read -k key'?--- Hit selection --- '
    	    [[ $key = [yYnNkK] ]] && break
    	    print "Type y, n or k."
    	  done
    	  case $key in
    	    ([yY]) speciald=true;;
    	    ([nN]) speciald=;;
    	  esac
    	  ;;
          (4) print "\
    Filename completion can complete sets of path segments at once, for example
    \`/u/X/l/X' to \`/usr/X11R6/lib/X11'.  Normally this means that multiple
    slashes in filenames are treated as matching multiple directories.  For
    example, \`foo//bar' could expand to \`foo/datthe/bar'.  You can, however,
    stick to the usual UNIX convention that multiple slashes are treated as
    a single slash.  Do you wish to treat multiple slashes the same as just
    one ([y]es, [n]o, [k]eep current setting)?
    "
              while true; do
    	    read -k key'?--- Hit selection --- '
    	    [[ $key = [yYnNkK] ]] && break
    	    print "Type one of y, n or k."
    	  done
    	  case $key in
    	    ([yY]) squeezes=true;;
    	    ([nN]) squeezes=;;
    	  esac
              ;;
          (5) if [[ $expand = *prefix* ]]; then
                 prefon=prefix
    	  else
    	     prefon=
    	  fi
    	  if [[ $expand = *suffix* ]]; then
    	     suffon=suffix
    	  else
    	     suffon=
    	  fi
              print "
    When expanding /f/b, the shell will attempt to match /f*/b* (e.g. /foo/bar), 
    and so on to any depth.  If the first part of the expansion fails, by default
    the shell will not expand the remainder.  However, you can force it always
    to expand the first part.  Currently this feature is ${${prefon:+on}:-off}.
    Do you want it on ([y]es, [n]o, [k]eep current setting)?
    "
    	  while true; do
    	    read -k key'?--- Hit selection --- '
    	    [[ $key = [yYnNkK] ]] && break
    	    print "Type one of y, n or k."
    	  done
    	  case $key in
    	    ([yY]) prefon=prefix;;
    	    ([nN]) prefon=prefix;;
    	  esac
    	  print "
    Further, if /f*/b* is ambiguous, the shell will usually only expand
    as far as the part that is unambiguous; for example, if /foo/bar and
    /food/basket exist, it will wait for you to choose either /foo or /food,
    and not attempt to expand the rest of the match.  However, you can force
    it to add all possible completions for you to resolve conflicts in the
    normal way.  Currently this feature is ${${suffon:+on}:-off}.
    Do you want it on ([y]es, [n]o, [k]eep current setting)?
    "
    	  while true; do
    	    read -k key'?--- Hit selection --- '
    	    [[ $key = [yYnNkK] ]] && break
    	    print "Type one of y, n or k."
    	  done
    	  case $key in
    	    ([yY]) suffon=suffix;;
    	    ([nN]) suffon=suffix;;
    	  esac
    	  expand=${prefon:+$prefon${suffon:+ }}${suffon}
    
    	  if [[ $lssuffixes = (1|[tT]|[yY]|[oO])* ]]; then
    	     lssuffixes=true
    	  else
    	     lssuffixes=
    	  fi
    	  print "
    When listing expansions of /f/b such as /foo/bar, /foo/bad, /failed/bag,
    the shell will usually only show the first part of the path if it is
    ambiguous, hence /foo will appear twice.  It is possible to show the
    full path in this case.  Currently this feature is ${${lssuffixes:+on}:-off}.
    Do you want this behaviour ([y]es, [n]o, [k]eep current setting)?
    "
    	  while true; do
    	    read -k key'?--- Hit selection --- '
    	    [[ $key = [yYnNkK] ]] && break
    	    print "Type one of y, n or k."
    	  done
    	  case $key in
    	    ([yY]) lssuffixes=true;;
    	    ([nN]) lssuffixes=;;
    	  esac
    	  ;;
          (6) print "\
    On some systems, there are special forms for the start of a filename
    which should be left alone by the completion system.  For example, Cygwin
    uses a double slash to indicate a network resource, hence a prefix of
    the form \`//resource/' should be left alone.  This style gives a pattern
    to match any such prefixes; alternatives separated by \`|' are therefore
    possible.  Edit the pattern as you like.  If this is empty, the shell will not
    handle any prefixes specially."
              if [[ -z $preserve ]]; then
    	      preserve="//[^/]##/"
    	      print "
    Accept the default to handle network resources as just described."
    	  fi
    	  vared -eh -p "pattern> " preserve
    	  ;;
          (q) return 1
    	 ;;
        esac
    
      done
    
      __ci_set_this_style file-sort files
      __ci_set_this_style ignore-parents ignorep
      __ci_set_this_style special-dirs speciald
      __ci_set_this_style squeeze-slashes squeezes
      __ci_set_this_style expand expand
      __ci_set_this_style list-suffixes lssuffixes
      # pattern, always quote
      [[ -n $preserve ]] && preserve=${(qq)preserve}
      __ci_set_this_style preserve-prefix preserve
    
      return 0
    }
    
    
    # TODO: history completion, jobs, prefix-needed 'n' stuff.
    __ci_do_misc() {
      local key
    
      while true; do
        clear
        print "\
          *** compinstall: options for particular types of completion ***
    
    1.  Options for file completion.
    
    q.  Return without saving.
    0.  Done setting options for particular completions.
    "
        read -k key'?--- Hit selection --- '
        print
    
        [[ $key = 0 ]] && break
    
        case $key in
          1) __ci_do_file_styles
    	 ;;
          q) return 1
    	 ;;
        esac
    
      done
    
      return 0;
    }
    
    
    # TODO: it should probably be possible to set completion options via
    #         compinstall, even though they've been around for years.
    
    while true; do
      clear
      print "\
                   *** compinstall: main menu ***
    Note that hitting \`q' in menus does not abort the set of changes from
    lower level menus.  However, quitting at top level will ensure that nothing
    at all is actually written out.
    
    1.  Completers:  choose completion behaviour for tasks such as
        approximation, spell-checking, expansion.
    
    2.  Matching control: set behaviour for case-insensitive matching,
        extended (partial-word) matching and substring matching.
    
    3.  Styles for changing the way completions are displayed and inserted.
    
    4.  Styles for particular completions.
    
    c.  Change context (plus more information on contexts).
    
    q.  Return without saving.
    0.  Save and exit.
    "
    
      __ci_newline \
        "--- Hit choice --- " || return 1
    
      # note this is a string test:  we require the `0' to have been typed.
      [[ $key = 0 ]] && break
    
      case $key in
        1) __ci_do_completers
           ;;
        2) __ci_do_matchers
           ;;
        3) __ci_do_display
           ;;
        4) __ci_do_misc
           ;;
        c) __ci_change_context
           ;;
      esac
    done
    
    
    if (( $#styles )); then
      typeset style stylevals context values
      for style in ${(ko)styles}; do
        stylevals=(${(f)styles[$style]})
        while (( $#stylevals )); do
          output="$output
    zstyle ${(qq)stylevals[1]} $style ${stylevals[2]}"
          shift 2 stylevals
        done
      done
    fi
    
    if [[ -z $ifile || -d $ifile ]] ||
      ! read -q key"?Save new settings to $ifile ([y]es, [n]o)? "; then
       print "Enter file to save in (~ will be expanded), or return to abort:"
       ifile=
       vared -ch -p 'file> ' ifile
       if [[ $ifile != [/~]* ]]; then
         ifile=$PWD/$ifile
         print "[Not absolute path; updating to $ifile]"
       fi
       ifile=${~ifile}
    fi
    
    local tmpout=${TMPPREFIX:-/tmp/zsh}compinstall$$
    #
    # Assemble the complete set of lines to
    # insert.
    #
    __ci_output >$tmpout
    
    if [[ -n $ifile ]]; then
      if [[ $ifile != *(zshrc|zlogin|zshenv) ]]; then 
        print "\
    If you want this file to be run automatically, you should add
      . $ifile
    to your .zshrc.  compinstall will remember the name of this file for
    future use."
        __ci_newline || return 1
      fi
      #
      # Now use sed to update the file.
      #
      if [[ -f $ifile ]]; then
        cp $ifile ${ifile}\~ &&
        print "Copied old file to ${ifile}~."
      else
        touch $ifile
      fi
      if { { grep "$endline" $ifile >/dev/null 2>&1 &&
             sed -e "/^[ 	]*$endline/r $tmpout
    /^[ 	]*$startline/,/^[ 	]*$endline/d" $ifile >${tmpout}2 } || 
            { cp $ifile ${tmpout}2 && cat $tmpout >>${tmpout}2 } } &&
      cp ${tmpout}2 $ifile && rm -f ${tmpout}2; then
        print "\nSuccessfully added compinstall lines to $ifile."
        rm -f $tmpout
      else
        print "\nFailure adding lines to $ifile.  Lines left in \`$tmpout'"
      fi
      rm -f ${tmpout}2
    elif read -q key'?Print them to stdout instead ([y]es, [n]o)? '; then
      cat $tmpout
      rm -f $tmpout
    fi
    
    if read -q key'?Set new styles for immediate use ([y]es, [n]o)? '; then
      eval $output
      print "The new settings are now in effect.  Note this will not remove old
    styles you have deleted until you restart the shell."
    fi
    
    __ci_tidyup
    return 0
    PK[Q6functions/_mtoolsnuW+A#compdef mattrib mcopy mdel mdu mcd mdeltree mdir mformat mlabel mmd mmount mmove mrd mread mren mtoolstest mtype
    
    (( $+functions[_mtools_drives] )) ||
    _mtools_drives() {
      local expl
    
      _wanted drives expl drive compadd "$@" -M "m:{a-z}={A-Z}" \
          ${${(M)${(f)"$(mtoolstest)"}:#drive*}##drive }
    }
    
    (( $+functions[_mtools_dosfiles] )) ||
    _mtools_dosfiles() {
      local expl files dirs disp dirsonly suf='/' ret=1
      
      zparseopts -D -E '/=dirsonly'
      if compset -P '[A-Za-z]:'; then
        _tags files
      else
        _tags files drives
      fi
      compset -P '*/'
      if compset -S '/*'; then
        suf=''
        dirsonly=(1)
      fi
    
      while _tags; do
        _requested drives expl drive _mtools_drives -S '' && ret=0
        if _requested files; then
          files=( ${(f)"$(mdir -aX $IPREFIX 2>/dev/null)"} )
          dirs=( ${${${(M)files:#*/}%/}##*/} )
          disp=( $dirs/ )
          while _next_label files expl 'file'; do
    	(( ! $#dirsonly )) && compadd "$@" "$expl[@]" -M 'm:{a-zA-Z}={A-Za-z}' \
    	    ${files##*/} && ret=0
    	compadd "$@" "$expl[@]" -M 'm:{a-zA-Z}={A-Za-z}' -S "$suf" -q \
                -d disp -a dirs && ret=0
          done
        fi
        (( ret )) || return 0
      done
      
      return ret
    }
    
    (( $+functions[_mtools_files] )) ||
    _mtools_files() {
      local dos
      
      if [[ -prefix [a-zA-Z]: ]]; then
        dos='files:file:_mtools_dosfiles'
      else
        dos='drives:drive:_mtools_drives -S ""'
      fi
      _alternative $dos 'files:file:_files'
    }
    
    _mtools() {
      local args Dopt oopt sopt topt vopt
    
      Dopt='(-V)-D[specify name clash handling]:clash option:
        _values "name clash handling"
          "o[overwrite primary names]"
          "O[overwrite secondary names]"
          "r[rename primary name]"
          "R[rename secondary name]"
          "a[autorename primary name]"
          "A[autorename secondary name]"
          "s[skip primary name]"
          "S[skip secondary name]"
          "m[ask user what to do with primary name]"
          "M[ask user what to do with secondary name]"'
      oopt='(-V)-o[no confirmation on overwrite of DOS files]'
      sopt=( '(-V -s -/)'-{s,/}'[recurse subdirectories]' )
      topt='(-V)-t[perform text file translation]'
      vopt='(-V)-v[verbose]'
    
      case $service in
        mattrib)
          args=( $mdfiles
    	'(-V)-+a[archive]'
    	'(-V)-+h[hidden]'
    	'(-V)-+r[readonly]'
    	'(-V)-+s[system]'
    	'(-V)-/[recurse subdirectories]'
    	'(-V)-X[concise output]'
    	'(-V)-p[replay mode]'  
            '(-V)*:file:_mtools_dosfiles'
          )
        ;;
        mcopy|mread)
          args=( $Dopt $oopt $sopt $topt $vopt
    	'(-V)-b[batch mode]'
    	'(-V)-p[preserve file attributes]' 
    	'(-V)-Q[quit on failure]'
    	'(-V)-a[text mode transfer]'
    	'(-V)-n[no confirmation on overwrite of Unix files]'
    	'(-V)-m[preserve modification time]'
    	'(-V)*:source file:_mtools_files'
          )
        ;;
        mdeltree|mrd)
          args=( $vopt '(-V)*:directory:_mtools_dosfiles -/' )
        ;;
        mdel)
          args=( $vopt '(-V)*:file:_mtools_dosfiles' )
        ;;
        mdir)
          args=( $Dopt $sopt
    	'(-V)-w[wide output]'
    	'(-V)-a[also list hidden files]'
    	'(-V)-f[fast - do not find free space]'
    	'(-V -b -X)'-{b,X}'[concise output]'
    	'(-V)*:file:_mtools_dosfiles'
          )
        ;;
        mdu)
          args=(
    	'(-V)-a[output for all files]'
    	'(-V)-s[summarize - output only for each argument]'
    	'(-V)*:file:_mtools_dosfiles'
          )
        ;;
        mlabel)
          args=(
    	'(-V -s)-c[clear existing label]'
    	'(-V -c)-s[show existing label]'
    	'(-V -N)-n[assign new random serial number]'
    	'(-V -n)-N[specify new serial number]:serial number'
    	'1:drive:_mtools_drives -S ""'
          )
        ;;
        mmd)
          args=( $Dopt '(-V)*:directory:_mtools_dosfiles -/' )
        ;;
        mmove|mren)
          # target file should be completed relative to source here
          args=( $Dopt $oopt $vopt '(-V)*:file:_mtools_dosfiles' )
        ;;
        mtype)
          args=( $topt
    	'(-V)-s[strip the high bit]'
    	'(-V)*:file:_mtools_files'
          )
        ;;
        mbadblocks|mmount|mformat|mtoolstest|mdrive)
          args=( '(-V)1:drive:_mtools_drives' )
        ;;
        mcd) args=( '(-V)*:directory:_mtools_dosfiles -/' ) ;;
      esac
    
      _arguments -s -S "$args[@]" \
        '(-D -o -s -t -v -w -a -h -r -s -/ -X -p -f -b * 1)-V[display version information]'
    }
    
    _mtools "$@"
    PK[Q5Z*@@functions/transpose-linesnuW+A# Transpose lines.  This is like in emacs: with a positive argument
    # (default 1) the current line and the previous line are swapped and the
    # cursor goes down one line; with a negative argument the previous two
    # lines are swapped and the cursor goes up one line.
    
    emulate -L zsh
    setopt extendedglob # xtrace
    
    local -a match mbegin mend
    integer count=${NUMERIC:-1}
    local init prev lline final rrline
    
    if (( ${NUMERIC:-1} < 0 )); then
      while (( count++ )); do
        [[ $LBUFFER != (#b)(|*$'\n')([^$'\n']#$'\n')([^$'\n']#$'\n')([^$'\n']#) ]] && return 1
        
        LBUFFER=$match[1]$match[3]
        RBUFFER=$match[2]$match[4]$RBUFFER
      done
    else
      while (( count-- )); do
        [[ $LBUFFER != (#b)(*)$'\n'([^$'\n']#) ]] && return 1
    
        prev=$match[1]
        lline=$match[2]
    
        if [[ $prev = (#b)(*$'\n')([^$'\n']#) ]]; then
          init=$match[1]
          prev=$match[2]
        fi
    
        if [[ $RBUFFER = (#b)([^$'\n']#)$'\n'(*) ]]; then
          rline=$match[1]
          final=$match[2]
          prev+=$'\n'
        else
          rline=$RBUFFER
        fi
    
        LBUFFER=$init$lline$rline$'\n'$prev
        RBUFFER=$final
      done
    fi
    PK[hhfunctions/_printenvnuW+A#compdef printenv
    
    local expl
    
    _wanted parameters expl 'environment variable' _parameters -g '*export*'
    PK[vfunctions/_freebsd-updatenuW+A#compdef freebsd-update
    
    local flags
    flags=(
      '(cron)fetch[fetch a compressed snapshot or update existing one]'
      '(fetch)cron[sleep rand(3600) seconds, and then fetch updates]'
      '(install rollback)upgrade[fetch files necessary for upgrading to a new release]'
      '(upgrade rollback)install[install the most recently fetched updates or upgrade]'
      '(upgrade install)rollback[uninstall the most recently installed updates]'
    )
    
    _arguments -s \
      '-b[operate on a system mounted at basedir]:basedir:_files -/' \
      '-d[store working files in workdir]:workdir:_files -/' \
      '-f[read configuration options from conffile]:conf file:_files' \
      '-k[trust an RSA key with SHA256 of KEY]:RSA key:' \
      '-r[specify the new release]:new release:' \
      '-s[fetch files from the specified server or server pool]:server:_hosts' \
      '-f[mail output of cron command, if any, to address]:address:' \
      ':command:_values -S " " -w "commands" $flags[@]'
    PK[Fπńfunctions/_correct_wordnuW+A#compdef -k complete-word \C-xc
    
    # Simple completion front-end implementing spelling correction.
    # The maximum number of errors is set quite high, and
    # the numeric prefix can be used to specify a different value.
    
    local curcontext="$curcontext"
    
    if [[ -z "$curcontext" ]]; then
      curcontext="correct-word:::"
    else
      curcontext="correct-word:${curcontext#*:}"
    fi
    
    _main_complete _correct
    PK[NAAfunctions/_socketnuW+A#compdef socket
    
    # Style used:
    #
    #  hosts-ports
    #    The style that contains pairs `host:port'.
    
    local curcontext="$curcontext" state line expl ret=1
    typeset -A opt_args
    
    [[ $CURRENT -eq 2 ]] &&
        { ! zstyle -T ":completion:${curcontext}:options" prefix-needed ||
          [[ "$PREFIX" = -* ]] } &&
        _wanted options expl option compadd - -version
    
    _arguments -C -s \
      '-b[background]' \
      '-c[crlf]' \
      '-f[fork]' \
      '-q[quit]' \
      '-r[read only]' \
      '-v[verbose]' \
      '-w[write only]' \
      '-s[server]' \
      '-l[loop]' \
      '-p[program]:command:->command' \
      ':arg1:->arg1' \
      ':arg2:->arg2' && ret=0
    
    case "$state" in
    command)
      compset -q
      if [[ $CURRENT -eq 1 ]]; then
        _command_names -e "$@" && ret=0
      else
        _normal && ret=0
      fi
      ;;
    
    arg1)
      if (( $+opt_args[-s] )); then
        _ports && ret=0
      else
        _wanted hosts expl 'host' _combination '' hosts-ports hosts - && ret=0
      fi
      ;;
    
    arg2)
      if (( ! $+opt_args[-s] )); then
        _wanted ports expl 'port to connect' \
            _combination '' hosts-ports hosts="${line[1]:q}" ports - && ret=0
      fi
      ;;
    esac
    
    return ret
    PK[c`wwfunctions/_netscapenuW+A#compdef netscape
    
    local curcontext="$curcontext" state line expl ret=1 suf files
    typeset -A opt_args
    
    _x_arguments -C \
      '-xrm:resource:_x_resource' \
      '-help[show usage message]' \
      '-version[show the version number and build date]' \
      '-visual[use a specific server visual]:visual:_x_visual -b' \
      '-install[install a private colormap]' \
      '-no-install[use the default colormap]' \
      '-ncols[max no. of colors to allocate for images]:n:' \
      '-mono[force 1-bit-deep image display]' \
      '-iconic[start up iconified]' \
      '-remote[execute a command in an existing Netscape]:remote command:->remote' \
      '-id[id of X window to send remote commands to]:window-id:' \
      '-raise[raise window following remote command]' \
      "-noraise[don't raise window following remote command]" \
      '-nethelp[show nethelp]' \
      -{dont-force-window-stacking,no-about-splash} \
      -{,no-}{,irix-}session-management \
      -{done-save,ignore}-geometry-prefs \
      -{component-bar,composer,edit,messenger,mail,discussions,news} \
      '*:location:->urls' && ret=0
    
    # Handle netscape remote commands
    if [[ "$state" = "remote" ]]; then  
      local -a remote_commands
      remote_commands=(openURL openFile saveAs mailto addBookmark)
    
      compset -P '*\('
      if compset -S '(|\\)\)*'; then
        set - -S "" "$@"
      else
        set - -S"${${QIPREFIX:+)}:-\)}$compstate[quote] " "$@"
      fi
      case $IPREFIX in
        openURL*|addBookmark*) state=urls;;
        openFile*) _files "$@" -W ~;;
        saveAs*) 
          if compset -P "*,"; then
            _wanted types expl 'data type' \
                compadd "$@" -M 'm:{a-zA-Z}={A-Za-z}' HTML Text PostScript && ret=0
          else
            compset -S ",*" || suf=","
            _files -qS "$suf" -W ~ && ret=0
          fi
        ;;
        mailto*)
          _email_addresses -s, -c && ret=0
        ;;
        *)
          compset -S '(|\\)\(*' || suf="${${QIPREFIX:+(}:-\(}"
          _wanted commands expl 'remote commands' \
              compadd -qS "$suf" -M 'm:{a-zA-Z}={A-Za-z}' -a \
                      remote_commands && ret=0
        ;;
      esac
    fi
    
    if [[ "$state" = "urls" ]]; then
      _tags files urls
      while _tags; do
        _requested files expl 'file' _files "$@" && files=yes ret=0
        if _requested urls; then
          # Complete netscape urls
          if compset -P about: ; then
    	_wanted values expl 'about what' \
                compadd "$@" authors blank cache document fonts global hype \
    	    	image-cache license logo memory-cache mozilla plugins && ret=0
          elif compset -P news: ; then
    	_newsgroups "$@" && ret=0
          elif compset -P mailto: ; then
            _email_addresses -c && ret=0
          else
    	_tags prefixes
    	while _tags; do
    	  while _next_label prefixes expl 'URL prefix' "$@"; do
                _urls "$expl[@]" && ret=0
    	    compset -S '[^:]*'
                compadd -S '' "$expl[@]" about: news: mailto: mocha: javascript: && ret=0
    	  done
    	  (( ret )) || return 0
    	done
            [[ -z "$files" ]] && _tags files
          fi
        fi
        (( ret )) || return 0
      done
    fi
    
    return ret
    PK[Rfunctions/_zcalc_linenuW+A#compdef -zcalc-line-
    
    # This handles completion of a zcalc command line read via vared.
    
    _zcalc_line_escapes() {
      local -a cmds
      cmds=(
        "!:shell escape"
        "q:quit"
        "norm:normal output format"
        "sci:scientific output format"
        "fix:fixed point output format"
        "eng:engineering (power of 1000) output format"
        "raw:raw output format"
        "local:make variables local"
        "function:define math function"
      )
      cmds=("\:"${^cmds})
      _describe -t command-escapes "command escapes" cmds -Q
    }
    
    _zcalc_line() {
      local expl
    
      if [[ CURRENT -eq 1 && $words[1] != ":"(\\|)"!"* ]]; then
        local -a alts
        if [[ $words[1] = (|:*) ]]; then
          alts=("command-escapes:command escape:_zcalc_line_escapes")
        fi
        if [[ $words[1] = (|[^:]*) ]]; then
          alts+=("math:math formula:_math")
        fi
        _alternative $alts
        return
      fi
    
      case $words[1] in
        (":"(\\|)"!"*)
        if [[ $words[1] = ":"(\\|)"!" && CURRENT -gt 1 ]]; then
          shift words
          (( CURRENT-- ))
        else
          words[1]=${words[1]##:(\\|)\!}
          compset -P ':(\\|)!'
        fi
        _normal
        ;;
    
        (:function)
        # completing already defined user math functions is in fact exactly
        # the wrong thing to do since currently zmathfuncdef won't overwrite,
        # but it may jog the user's memory...
        if (( CURRENT == 2 )); then
          _wanted math-functions expl 'math function' \
    	compadd -- ${${(k)functions:#^zsh_math_func_*}##zsh_math_func_}
        else
          _math
        fi
        ;;
    
        (:local)
        _parameter
        ;;
    
        (:(fix|sci|eng))
        if (( CURRENT == 2 )); then
          _message "precision"
        fi
        ;&
    
        (:*)
        _message "no more arguments"
        ;;
    
        ([^:]*)
        _math
        ;;
      esac
    }
    
    _zcalc_line "$@"
    PK[܋functions/replace-stringnuW+Aemulate -L zsh
    setopt extendedglob
    
    autoload -Uz read-from-minibuffer replace-string-again
    
    local p1="Replace: " p2="   with: "
    # Saving curwidget is necessary to avoid the widget name being overwritten.
    local REPLY previous curwidget=$WIDGET
    
    if (( ${+NUMERIC} )); then
      (( $NUMERIC > 0 )) && previous=1
    else
      zstyle -t ":zle:$WIDGET" edit-previous && previous=1
    fi
    
    read-from-minibuffer $p1 ${previous:+$_replace_string_src} || return 1
    typeset -g _replace_string_src=$REPLY
    
    read-from-minibuffer "$p1$_replace_string_src$p2" \
      ${previous:+$_replace_string_rep} || return 1
    typeset -g _replace_string_rep=$REPLY
    
    replace-string-again $curwidget
    PK[\"functions/_zmodloadnuW+A#compdef zmodload
    
    local suf comp state line expl curcontext="$curcontext" ret=1 NORMARG
    typeset -A opt_args
    suf=()
    
    _arguments -n -C -A "-*" -s \
      '(-i -u -d -a -b -c -I -p -f -e)-A[create module aliases]' \
      '-u[unload module]' \
      '(-e)-a[autoload module]' \
      '(-c -I -p -f)-b[autoload module for builtins]' \
      '(-b -I -p -f)-c[autoload module for condition codes]' \
      '(-i)-d[list or specify module dependencies]' \
      '(-i -u -d -a -b -c -p -f -L -A)-e[test if modules are loaded]' \
      '(-b -c -I -p)-f[autoload module for math functions]' \
      '(-u -b -c -p -f -A)-F[handle features]' \
      '(-d -e)-i[suppress error if command would do nothing]' \
      '(-b -c -p -f)-I[define infix condition names]' \
      '(-u -b -c -p -f -A)-l[list features]' \
      '(-e -u)-L[output in the form of calls to zmodload]' \
      '(-b -c -I -f)-p[autoload module for parameters]' \
      '(-u -b -c -p -f -A)-P[array param for features]:array name:_parameters' \
      '*:params:->params' && ret=0
    
    [[ $state = params ]] || return ret
    
    (( $+opt_args[-A] )) && compset -P '*=' || suf=( -S '=' )
    
    
    if (( $+opt_args[-F] && CURRENT > NORMARG )); then
      local module=$words[NORMARG]
      local -a features
    
      if [[ $modules[$module] != loaded ]]; then
        _message "features for unloaded module"
      else
        zmodload -lFP features $module
        if compset -P -; then
          # only enabled features needed
          features=(${${features:#-*}##?})
        elif compset -P +; then
          # only disabled features needed
          features=(${${features:#+*}##?})
        fi
        _wanted features expl feature compadd -a features
      fi
    else
      comp=( files aliases )
      if (( $+opt_args[-u] )); then
        if (( $+opt_args[-b] || $+opt_args[-a] )); then
          comp=( builtins )
        else
          comp=( loadedmodules aliases )
        fi
      fi
      (( $+opt_args[-a] && CURRENT > 3 )) && comp=( builtins )
    
      _tags "$comp[@]"
      while _tags; do
        _requested builtins expl 'builtin command' \
          compadd "$@" -k builtins && ret=0
        _requested loadedmodules expl 'loaded modules' \
          compadd -k 'modules[(R)loaded]' && ret=0
        _requested files expl 'module file' \
          _files -W module_path -/g '*.(dll|s[ol]|bundle)(:r)' && ret=0
        _requested aliases expl 'module alias' \
          compadd "$suf[@]" -k 'modules[(R)alias*]' && ret=0
      done
      return ret
    fi
    PK[))functions/_bzrnuW+A#compdef bzr
    
    # bzr is the bazaar-ng revision-control system
    
    local curcontext="$curcontext" state line expl cmd args ret=1
    typeset -A opt_args
    
    _arguments -C \
        '1: :->cmd' \
        '*:: :->args' && ret=0
    
    if (( ! $+_bzr_cmds )); then
        typeset -gH _bzr_cmds
        _bzr_cmds=(${(f)"$(_call_program bzr bzr shell-complete)"})
    fi
    
    if [[ $state != 'args' ]]; then
        _describe -t subcommand 'subcommand' _bzr_cmds
        return 0
    fi
    
    cmd="$words[1]"
    curcontext="${curcontext%:*:*}:bzr-$cmd:"
    
    (( $+functions[_bzr_unknownFiles] )) ||
    _bzr_unknownFiles() {
        local fileList
        fileList=(${(ps:\0:)"$(bzr ls --null --unknown)"})
        compadd -af fileList
        return 0
    }
    
    (( $+functions[_bzr_unknownRoot] )) ||
    _bzr_unknownRoot() {
        local fileList
        fileList=(${(ps:\0:)"$(bzr ls --null --from-root --unknown)"})
        compadd -af fileList
        return 0
    }
    
    (( $+functions[_bzr_versionedFiles] )) ||
    _bzr_versionedFiles() {
        local fileList
        fileList=(${(ps:\0:)"$(bzr ls --null --versioned)"})
        compadd -af fileList
        return 0
    }
    
    (( $+functions[_bzr_completeParents] )) ||
    _bzr_completeParents() {
        local parentFile=$(bzr root 2>/dev/null)/.bzr/branch/parent
        [[ -r $parentFile ]] && compadd -X "Completing parents" $(cat $parentFile)
    }
    
    args=( '(-)'{--help,-h}'[show help message]' )
    
    case $cmd in
    (add)
        args+=(
    	'--dry-run[show what would be added without adding anything]'
    	'--no-recurse[do not recurse into subdirectories]'
    	'(-q --quiet -v --verbose)'{--quiet,-q}'[be quiet]'
    	'(-v --verbose -q --quiet)'{--verbose,-v}'[display more information]'
    	'*:unknown files:_bzr_unknownFiles'
    	)
        ;;
    
    (annotate|blame|praise)
        args+=(
    	'--all[show annotations on all lines]'
    	'--long[show date in annotations]'
    	'(-r --revision)'{--revision=,-r}'[the revision to show]:rev:'
    	'*:files:_bzr_versionedFiles'
    	)
        ;;
    
    (branch|get|clone)
        args+=(
    	'(-r --revision)'{--revision=,-r}'[the revision to get]:rev:'
    	'--basis=[specify basis branch]:basis:'
    	)
        if (( CURRENT == 2 )); then
    	args+=( '*:FROM_LOCATION:_files -/' )
        elif (( CURRENT == 3 )); then
    	args+=( '*:TO_LOCATION:_files -/' )
        fi
        ;;
    
    (checkout|co)
        args+=(
    	'--lightweight[perform a lightweight checkout]'
    	'(-r --revision)'{--revision=,-r}'[the revision to get]:rev:'
    	)
        _bzr_completeParents
        ;;
    
    (rename|move|mv)
        if (( CURRENT == 2 )); then
    	args+=( '*:files:_bzr_versionedFiles' )
        else
    	args=( '*:destination dir:_files -/' )
        fi
        ;;
    
    (cat)
        args+=(
    	'(-r --revision)'{--revision=,-r}'[revision]:rev:'
    	'*:file:_bzr_versionedFiles'
    	)
        ;;
    
    (root)
        args+=( '*:file:_files' )
        ;;
    
    (log)
        args+=(
    	'--forward[reverse direction of revisions]'
    	'(-l --long --short --log_format)--line[use log format with one line per revision. Same as "--log-format line"]'
    	'(-l --long --short --line)--log-format=[use the specified log format]:log format:(line short long)'
    	'(-l --long --short --line --log-format)'{--long,-l}'[use detailed log format. Same as "--log-format long"]'
    	'(-l --long --log_format)--short[use moderately short log format. Same as "--log-format short"]'
    	'(-m --message)'{--message=,-m}'[specify regexp]:regexp:'
    	'(-r --revision)'{--revision=,-r}'[revision or range]:rev or rev range:'
    	'--show-ids[show file IDs]'
    	'--timezone=[specify timezone for dates]:timezone:'
    	'(-v --verbose)'{--verbose,-v}'[show revision manifest]'
    	'*:file:_bzr_versionedFiles'
    	)
        ;;
    
    (resolve|resolved)
        args+=(
    	'--all[resolve all conflicts in this tree]'
    	'*:file:_bzr_versionedFiles'
    	)
        ;;
    
    (status|st|stat)
        args+=(
    	'--all[include unchanged versioned files]'
    	'(-r --revision)'{--revision=,-r}'[compare working tree with revision]:revision:'
    	'--show-ids[show file IDs]'
    	'*:file:_bzr_versionedFiles'
    	)
        ;;
    
    (check)
        args+=(
    	'(-v --verbose)'{--verbose,-v}'[display more information]'
    	'*:DIR:_files -/'
    	)
        ;;
    
    (mkdir|renames|update)
        args+=( '*:DIR:_files -/' )
        ;;
    
    (init|upgrade)
        args+=(
    	'--format=[format for repository]:format:(default knit metaweave weave)'
    	'*:DIR:_files -/'
    	)
        ;;
    
    (init-repo|init-repository)
        args+=(
    	'--format=[format for repository]:format:(default knit metaweave weave)'
    	'--trees[allows branches in repository to have a working tree]'
    	'*:DIR:_files -/'
    	)
        ;;
    
    (remove|rm)
        args+=(
    	'(-v --verbose)'{--verbose,-v}'[display more information]'
    	'*:file:_bzr_versionedFiles'
    	)
        ;;
    
    (pull)
        args+=(
    	'--overwrite[ignore differences, overwrite unconditionally]'
    	'--remember[remember the specified location as a default]'
    	'(-r --revision)'{--revision=,-r}'[get a particular revision]:revision:'
    	'(-v --verbose)'{--verbose,-v}'[display more information]'
    	'*:local repository:_files -/'
    	)
        _bzr_completeParents
        ;;
    
    (missing)
        args+=(
    	'(-l --long --short --log_format)--line[use log format with one line per revision. Same as "--log-format line"]'
    	'(-l --long --short --line)--log-format=[use the specified log format]:log format:(line short long)'
    	'(-l --long --short --line --log-format)'{--long,-l}'[use detailed log format. Same as "--log-format long"]'
    	'(-l --long --log_format)--short[use moderately short log format. Same as "--log-format short"]'
    	'--mine-only[display changes in the local branch only]'
    	'--reverse[reverse the order of revisions]'
    	'--show-ids[show internal object ids]'
    	'--theirs-only[display changes in the remote branch only]'
    	'(-v --verbose)'{--verbose,-v}'[display more information]'
    	'*:local repository:_files -/'
    	)
        _bzr_completeParents
        ;;
    
    (commit|checkin|ci)
        args+=(
    	'(-F --file)'{--file=,-F}'[commit message from file]:message file:'
    	'--local[perform a local only commit in a bound branch]'
    	'(-m --message)'{--message=,-m}'[commit message]:message text:'
    	'--strict[refuse to commit if there are unknown files]'
    	'--unchanged[include unchanged files]'
    	'(-q --quiet -v --verbose)'{--quiet,-q}'[be quiet]'
    	'(-v --verbose -q --quiet)'{--verbose,-v}'[display more information]'
    	'*:modified files:_bzr_versionedFiles'
    	)
        ;;
    
    (bind|break-lock|reconcile)
        _bzr_completeParents
        ;;
    
    (register-branch)
        args+=(
    	'--author=[email of the branch author, if not you]:email:'
    	'--branch-description=[longer description of the branch]:description:'
    	'--branch-name=[short name for the branch]:name:'
    	'--branch-title=[one-sentence description of the branch]:title:'
    	'--dry-run[prepare the request but do not actually send it]'
    	'--link-bug=[the bug this branch fixes]:bug-ID:'
    	'--product=[launchpad product short name to associate with the branch]:product:'
    	)
        _bzr_completeParents
        ;;
    
    (remerge)
        args+=(
    	'--merge-type=[the type of the merge]:type:'
    	'--reprocess[reprocess to reduce spurious conflicts]'
    	'--show-base[show base revision text in conflicts]'
    	)
        _bzr_completeParents
        ;;
    
    (conflicts|added|deleted|modified|unknowns|directories|ignored|unbind|nick|revno|version)
        ;;
    
    (whoami)
        args+=( '--email[only show e-mail address]' )
        ;;
    
    (inventory)
        args+=(
    	'--kind=[limit output by type]:kind:(file directory symlink)'
    	'(-r --revision)'{--revision=,-r}'[show inventory of a revision]:revision:'
    	'--show-ids[show file IDs]'
    	)
        ;;
    
    (diff|dif|di)
        args+=(
    	'(-r --revision)'{--revision=,-r}'[revision]:revision:'
    	'--diff-options=[options to pass to gdiff]:diff options:'
    	'(-p --prefix)'{--prefix,-p}'[set prefix added to old and new filenames]'
    	'*:files:_files'
    	)
        ;;
    
    (export)
        args+=(
    	'(-r --revision)'{--revision=,-r}'[revision]:revision:'
    	'--format=[format of exported file]:format:(dir tar tgz tbz2)'
    	'--root=[root directory of patch]:_files -/'
    	'*:destination:_files'
    	)
        ;;
    
    (ignore)
        args+=( '*:NAME_PATTERN:_bzr_unknownRoot' )
        ;;
    
    (info)
        args+=(
    	'(-v --verbose)'{--verbose,-v}'[display more information]'
    	'*:branch:_files -/'
    	)
        ;;
    
    (testament)
        args+=(
    	'(-l --long)'{--long,-l}'[use long format]'
    	'(-r --revision)'{--revision=,-r}'[revision]:revision:'
    	'*:branch:_files -/'
    	)
        ;;
    
    (revert|merge-revert)
        args+=(
    	'--no-backup[skip generation of backup~ files]'
    	'(-r --revision)'{--revision=,-r}'[revision]:revision:'
    	'*:file:_bzr_versionedFiles'
    	)
        ;;
    
    (merge)
        args+=(
    	'--force[ignore uncommitted changes]'
    	'--merge-type:merge type:(diff3 merge3 weave)'
    	'--remember[remember the specified location as a default]'
    	'--reprocess[reprocess to reduce spurious conflicts]'
    	'(-r --revision)'{--revision=,-r}'[revision]:revision:'
    	'--show-base[show base revision text in conflicts]'
    	'*:local repository:_files -/'
    	)
        _bzr_completeParents
        ;;
    
    (ls)
        args+=(
    	'(-q --quiet -v --verbose)'{--quiet,-q}'[be quiet]'
    	'(-v --verbose -q --quiet)'{--verbose,-v}'[display more information]'
    	'(-r --revision)'{--revision=,-r}'[revision]:revision:'
    	'--from-root[print all paths from the root of the branch]'
    	'--non-recursive[do not recurse into subdirectories]'
    	'--null[null separate the files]'
    	'--ignored[print ignored files]'
    	'--unknown[print unknown files]'
    	'--versioned[print versioned files]'
    	)
        ;;
    
    (switch)
        args+=(
    	'--force[switch even if local commits will be lost]'
    	'(-q --quiet -v --verbose)'{--quiet,-q}'[be quiet]'
    	'(-v --verbose -q --quiet)'{--verbose,-v}'[display more information]'
    	'*:local repository:_files -/'
    	)
        _bzr_completeParents
        ;;
    
    (help)
        args=(
    	'(-l --long)'{--long,-l}'[use long format]'
    	'*:subcmds:->cmds'
    	)
        _arguments -s "$args[@]" && ret=0
        _describe -t subcommand 'subcommand' _bzr_cmds
        return 0
        ;;
    
        # Plugins
    
    (visualize|visualise|viz|vis)
        args+=( '(-r --revision)'{--revision=,-r}'[starting revision]:rev:' )
        ;;
    
    (gannotate|gblame|gpraise)
        args+=(
    	'--all[show annotations on all lines]'
    	'--plain[do not hightlight annotation lines]'
    	'*:files:_bzr_versionedFiles'
    	)
        ;;
    
    (push)
        args+=(
    	'--create-prefix[create the path leading up to the branch when missing]'
    	'--overwrite[ignore differences, overwrite unconditionally]'
    	'--remember[remember the specified location as a default]'
    	'*:local repository:_files -/'
    	)
        _bzr_completeParents
        ;;
    
    (clean-tree)
        args+=(
    	'--dry-run[show files to delete instead of deleting them]'
    	'--ignored[delete all ignored files]'
    	'--detritus[delete conflict files, merge backups, failed self-tests, *~, *.tmp, etc]'
    	)
        ;;
    
    (uncommit)
        args+=(
    	'--dry-run[do not make any changes]'
    	'--force[say "yes" to all questions]'
    	'(-r --revision)'{--revision=,-r}'[the earliest revision to delete]:rev:'
    	'(-v --verbose)'{--verbose,-v}'[display more information]'
    	)
        ;;
    
    (sign-my-commits)
        args+=( '--dry-run[do not actually sign anything]' )
        ;;
    
    (*)
        _message "unknown bzr command completion: $cmd"
        return 1
        ;;
    esac
    
    _arguments -s "$args[@]" && ret=0
    return $ret
    PK[O3	\\functions/_lslvnuW+A#compdef lslv
    
    _arguments -C -s \
      '(-l -m)-p[display logical volume allocation map for the physical volume]:pv:_physical_volumes' \
      '(-p)-l[list physical volumes in logical volume]' \
      '(-p)-m[list partition numbers]' \
      '-n[accesses information from the descriptor area of physical volume]:pv:_physical_volumes' \
      '1:lv: _logical_volumes'
    PK[mZfffunctions/prompt_elite2_setupnuW+A# Created by icetrey 
    # Added by Spidey 08/06
    # Converted to zsh prompt theme by 
    
    prompt_elite2_help () {
      cat < []]
    
    The default colors are both cyan.  This theme works best with a dark
    background.
    
    Recommended fonts for this theme: either UTF-8, or nexus or vga or similar.
    If you don't have any of these, the 8-bit characters will probably look
    stupid.
    EOH
    }
    
    prompt_elite2_setup () {
      local text_col=${1:-'cyan'}
      local parens_col=${2:-$text_col}
    
      if [[ $1 == '8bit' ]]; then
      shift
      local -A schars
      autoload -Uz prompt_special_chars
      prompt_special_chars
      fi
    
      local text="%b%F{$text_col}"
      local parens="%B%F{$parens_col}"
      local punct="%B%F{black}"
      local reset="%b%f"
    
      local lpar="$parens($text"
      local rpar="$parens)$text"
    
      PS1="$punct$schars[332]$text$schars[304]$lpar%n$punct@$text%m$rpar$schars[304]$lpar%!$punct/$text%y$rpar$schars[304]$lpar%D{%I:%M%P}$punct:$text%D{%m/%d/%y}$rpar$schars[304]$punct-$reset$prompt_newline$punct$schars[300]$text$schars[304]$lpar%#$punct:$text%~$rpar$schars[304]$punct-$reset " 
    
      PS2="$parens$schars[304]$text$schars[304]$punct-$reset "
    
      prompt_opts=(cr subst percent)
    }
    
    prompt_elite2_preview () {
      local color colors
      colors=(red yellow green blue magenta)
    
      if (( ! $#* )); then
        for (( i = 1; i <= $#colors; i++ )); do
          color=$colors[$i]
          prompt_preview_theme elite2 $color
          (( i < $#colors )) && print
        done
      else
        prompt_preview_theme elite2 "$@"
      fi
    }
    
    prompt_elite2_setup "$@"
    PK[-U99functions/_gprofnuW+A#compdef gprof
    
    local curcontext="$curcontext" state line ret=1
    typeset -A opt_args
    
    _arguments -C -s -{a,b,c,D,h,i,l,L,s,T,v,w,x,y,z} \
               -{A,C,e,E,f,F,J,n,N,O,p,P,q,Q,Z}:'function name:->funcs' \
    	   '-I:directory:_dir_list' \
    	   '-d-:debug level:' '-k:function names:->pair' \
    	   '-m:minimum execution count:' \
    	   ':executable:_files -g \*\(-\*\)' \
    	   ':profile file:_files -g gmon.\*\(-.\)' \
    	   -- -s '((#s)--[no-] --)' \
               '*=name*:function name:->funcs' \
    	   '*=dirs*:directory:_dir_list' && ret=0
    
    if [[ -n "$state" ]]; then
      local cmd pair expl
    
      _tags functions || return 1
    
      [[ "$state" = pair ]] && pair=yes
    
      if [[ $#line -gt 1 ]]; then
        cmd="$line[2]"
      else
        return 1
      fi
    
      if [[ -n "$cmd" ]]; then
        if [[ "$cmd" = /* ]]; then
          tmp="$cmd"
        else
          tmp="$PWD/$cmd"
        fi
    
        if [[ "$tmp" != "$_gprof_command" ]]; then
          _gprof_command="$tmp"
          _gprof_funcs=( "${(@)${(@M)${(@f)$(nm $cmd)}:#[^ ]# [tT] ([^_]|_[^_])*}##* }" )
        fi
      
        if [[ -n "$pair" ]]; then
          if compset -P '*/'; then
            expl='call arc to function'
          else
            expl='call arc from function'
          fi
        else
          expl=function
        fi
        _wanted functions expl "$expl" \
            compadd -M 'r:|_=* r:|=*' -a _gprof_funcs && ret=0
      else
        return 1
      fi
    fi
    
    return ret
    PK[{=䰌functions/_list_filesnuW+A#autoload
    
    # Helper function for _path_files to handle the file-list style.
    
    # arguments:
    #  name of parameter containing file matches
    #  directory prefix
    # Sets array listfiles to the display strings and the array
    # listopts appropriately to be added to the compadd command line.
    
    local stat f elt what dir
    local -a stylevals
    integer ok
    
    listfiles=()
    listopts=()
    
    zstyle -a ":completion:${curcontext}:" file-list stylevals || return 1
    
    # TODO: more flexible way of handling the following?  e.g. use $compstate?
    case $WIDGETSTYLE in
      (*complete*)
      what=insert
      ;;
    
      (*)
      what=list
      ;;
    esac
    
    for elt in $stylevals; do
      case $elt in
        (*($what|all|true|1|yes)*=<->)
        # use long format if no more than the given number of matches
        (( ${(P)#1} <= ${elt##*=} )) && (( ok = 1 ))
        break
        ;;
    
        (*($what|all|true|1|yes)[^=]#)
        # always use long format
        (( ok = 1 ))
        break
        ;;
      esac
    done
    
    (( ok )) || return 1
    
    zmodload -F zsh/stat b:zstat 2>/dev/null || return 1
    
    dir=${2:+$2/}
    dir=${(Q)dir}
    
    for f in ${(PQ)1}; do
      if [[ ! -e "$dir$f" ]]; then
        listfiles+=("$dir$f")
        continue
      fi
    
      # Borrowed from Functions/Example/zls
      zstat -s -H stat -F "%b %e %H:%M" - "$dir$f" >/dev/null 2>&1
    
      listfiles+=("$stat[mode] ${(l:3:)stat[nlink]} ${(r:8:)stat[uid]} \
     ${(r:8:)stat[gid]} ${(l:8:)stat[size]} $stat[mtime] $f")
    done
    
    (( ${#listfiles} )) && listopts=(-d listfiles -l -o)
    
    return 0
    PK[z͟functions/_zcompilenuW+A#compdef zcompile
    
    local state line expl curcontext="$curcontext" ret=1
    typeset -A opt_args
    
    _arguments -C -s \
      "(-t -c -m -a)-U[don't expand aliases]" \
      '(-t -M)-R[mark as read]' \
      '(-t -R)-M[mark as mapped]' \
      '(-t -c -m -a)*-k[ksh-style autoloading]' \
      '(-t -c -m -a)*-z[zsh-style autoloading]' \
      '(-t -U -z -k)-c[currently defined functions]' \
      '(-t -U -z -k)-m[use names as patterns]' \
      '(-t -U -z -k)-a[write autoload functions]' \
      '(-M -R -U -z -k -a -c -m)-t[show table of contents]' \
      '(-M -R -U -a -c -m -t):file:->file' \
      '*:function:->function' && ret=0
    
    if [[ $state = function && -n $opt_args[(i)-[ac]] ]]; then
      _wanted functions expl 'function to write' compadd -k functions && ret=0
    elif [[ -n $opt_args[(i)-[tca]] ]]; then
      _description files expl 'zwc file'
      _files -g '*.zwc(-.)' "$expl[@]" && ret=0
    else
      _description files expl 'file'
      _files "$expl[@]" && ret=0
    fi
    
    return ret
    PK[ulfunctions/_procstatnuW+A#compdef procstat
    
    local pids
    #get list of pids and associated process name as comment
    pids=(${${${(f)"$(/usr/bin/procstat -ah)"}/[[:space:]]#/}/[[:space:]]*[[:space:]](ELF[[:digit:]]#[[:space:]]|-[[:space:]]#)/:})
    
    _arguments -s \
    '-b[display binary information for the process]' \
    '-c[display command line arguments for the process]' \
    '-f[display file descriptor information for the process]' \
    '-k[display the stacks of kernel threads in the process]' \
    '-s[display security credential information for the process]' \
    '-t[display thread information for the process]' \
    '-v[display virtual memory mappings for the process]' \
    '-h[suppress table headers]' \
    '-a[all processes]' \
    ':process id:(($pids))'
    PK[functions/_sablotronnuW+A#compdef sabcmd
    
    local curcontext="$curcontext" state mode line expl ret=1
    typeset -A opt_args
    local mopts='(-c -x -s -? -v --chain-xsl --batch-xml --batch-xsl --help --version)'
    
    _arguments -C \
      '(-b --base)'{-b,--base=}'[specify base URI]:URI' \
      '(-)--debug-options[show help on debug options]' \
      '(- *)'{-\?,--help}'[show help information]' \
      '(-L --log-file)'{-L,--log-file=}'[specify log file, turn on logging]:log file:_files' \
      '(-m --measure)'{-m,--measure}'[measure the processing time]' \
      '(- *)'{-v,--version}'[display version information]' \
      '--debugger[run the xslt debugger]' \
      $mopts{-c,--chain-xsl}'[single input file, multiple chained stylesheets]' \
      $mopts{-x,--batch-xml}'[single input file, multiple stylesheets]' \
      $mopts{-s,--batch-xsl}'[multiple input files, single stylesheet]' \
      '*: :->arguments' && ret=0
    
    if [[ -n "$state" ]]; then
      mode="${opt_args[(i)-c|--chain-xsl]:+chain}${opt_args[(i)-x|--batch-xml]:+batch-x}${opt_args[(i)-s|--batch-xsl]:+batch-s}"
      [[ $mode = (chain|batch-[xs]) ]] || mode=default
      _tags assignments files
      while _tags; do
        if _requested assignments; then
          if [[ -prefix *= ]]; then
            _message -e value value
          else
            _message -e parameter 'parameter name'
          fi
        fi
        if _requested files; then
          case $mode:${#words[1,CURRENT-1]:#(-*|*=*)}; in
            default:1|chain:<3->|batch-x:2|batch-s:1)
    	  _description files expl stylesheet
    	  _files "$expl[@]" -g "*.xsl(-.)" && ret=0
    	;;
            default:2|chain:1|batch-x:1|batch-s:2)
    	  _description files expl 'input file'
    	  _files "$expl[@]" && ret=0
    	;;
            default:3|chain:2|batch-x:<3->|batch-s:<3->)
    	  _description files expl 'output file'
    	  _files "$expl[@]" && ret=0
    	;;
          esac
        fi
        (( ret )) || break
      done
    fi
    
    return ret
    PK[**functions/_x_utilsnuW+A#compdef xdpyinfo xwininfo xkill xfontsel xfd xev xhost xon xsetroot xwd xwud xrdb
    
    case "$service" in
    xdpyinfo)
      _x_arguments \
        -queryExtensions \
        '-ext:extension: _x_extension -a'
      ;;
    xwininfo)
      _x_arguments \
        -{help,int,children,tree,stats,bits,events,size,wm,shape,frame,all,english,metric} \
        '(-id -name)-root' \
        '(-id -root)-name:name: _x_window -n' \
        '(-name -root)-id:id: _x_window'
      ;;
    xkill)
      _x_arguments \
        -frame \
        '(-id)-all' \
        '(-all)-id:window: _x_window' \
        '-button:selection button:(any 1 2 3 4 5)'
      ;;
    xfontsel)
      _xt_arguments \
        -{print,noscaled} \
        '-pattern:font pattern:_x_font' \
        '-sample:sample text' \
        '-sample16:16-bit sample text'
      ;;
    xfd)
      _xt_arguments \
        '-fn:font: _x_font' \
        -{box,center} \
        '-start:first character number' \
        '-bc:box border color:_x_color' \
        '-rows:number of rows' \
        '-columns:number of columns'
      ;;
    xev)
      _x_arguments \
        '-bw:border width' \
        '-bs:type of backing store:(NotUseful WhenMapped Always)' \
        '-id:id:_x_window' \
        '-s[use save-under]' \
        '-name:window name' \
        '-rv'
      ;;
    xhost)
      local expl type ret=1 tmp match
    
      if compset -P '-'; then
        tmp=(${(f)"$(xhost)"})
        shift tmp
        tmp=(${tmp:#LOCAL:|<*>})
        if [[ "$tmp" = *:* ]]; then
          if compset -P '(#b)(*):'; then
    	type="$match[1]"
    	_tags displays
    	while _tags; do
              while _next_label displays expl 'disallow access'; do
    	      { compadd "$expl[@]" -M 'm:{a-z}={A-Z} r:|[:.]=* r:|=*' - \
    		        ${${(M)tmp:#(#i)$type:*}#(#i)$type:} ||
    	            _hosts "$expl[@]" } && ret=0
    	  done
    	  (( ret )) || return 0
            done
          else
    	_alternative \
    	    'types:name family:compadd -S: ${(L)tmp%%:*}' \
    	    'hosts:host:compadd ${(@)tmp#*:}' && ret=0
          fi
        else
          _tags displays
          while _tags; do
            while _next_label displays expl 'disallow access'; do
    	  { compadd "$expl[@]" -M 'm:{a-z}={A-Z} r:|[:.]=* r:|=*' -a tmp ||
                _hosts "$expl[@]" } && ret=0
            done
    	(( ret )) || return 0
          done
        fi
      else
        compset -P +
    
        if [[ "$PREFIX" = *:* ]]; then
          type="${(L)PREFIX%%:*}"
          compset -P '*:'
    
          case "$type" in
          inet) _hosts && ret=0;;
          dnet) _message -e decnet-hosts 'DECnet host';;
          nis)  _message -e network-names 'Secure RPC network name';;
          krb)  _message -e principals 'Kerberos V5 principal';;
          esac
        else
          _alternative \
              'types:name family:compadd -S: - inet dnet nis krb' \
    	  'hosts:: _hosts' && ret=0
        fi
        return ret
      fi
      ;;
    xon)
      _arguments \
        -{access,debug,nols} \
        '-name:window name' \
        '-screen:screen number' \
        '-user:remote user name:_users' \
        ':remote host:_hosts' \
        '(-):command: _command_names -e' \
        '*:command: _normal'
      ;;
    xsetroot)
      _x_arguments \
        -{help,def,gray,grey,rv} \
        '-cursor:cursor file:_files -g \*.\(\#i\)\(xbm\|curs\(\|or\)\):mask file:_files -g \*.\(\#i\)\(xbm\|curs\(\|or\)\|mask\)\(-.\)' \
        '-cursor_name:cursor name:_x_cursor' \
        '-bitmap:bitmap file:_files -g \*.\(\#i\)xbm\(-.\)' \
        '-mod:x grid distance (1-16): :y grid distance (1-16)' \
        '-fg:foreground color:_x_color' \
        '-bg:background color:_x_color' \
        '-solid:screen solid color:_x_color' \
        '-name:root window name'
      ;;
    xwd)
      _x_arguments \
        -{debug,help,nobdrs,xy,frame,root,icmap,screen,silent} \
        '-out:output file:_files' \
        '-add:pixel change value' \
        '-id:id: _x_window' \
        '-name:name: _x_window -n'
      ;;
    xwud)
      _x_arguments \
        -{help,new,noclick,raw,rv,scale} \
        '-bg:background color:_x_color' \
        '-fg:foreground color:_x_color' \
        '-in:input file:_files -g \*.\(\#i\)xwd\(-.\)' \
        '-plane:image plane to display' \
        '-std:standard colormap:(best default gray red blue green)' \
        '-vis:visual:_x_visual'
      ;;
    xrdb)
      _x_arguments \
        -{help,quiet,symbols,retain} \
        '(-all -screen -screens)-global' \
        '(-global -screen -screens)-all' \
        '(-global -all -screens)-screen' \
        '(-global -all -screen)-screens' \
        '-n[only display on stdout]' \
        '(-nocpp)-cpp:preprocessor program:_files -g \*\(-\*\)' \
        '(-cpp)-nocpp' \
        '(-load -override -merge -remove)-query' \
        '(-query -override -merge -remove)-load' \
        '(-query -load -merge -remove)-override' \
        '(-query -load -override -remove)-merge' \
        '(-query -load -override -merge)-remove' \
        '-edit:output file:_files' \
        '-backup:backup extension' \
        '*-D-:symbol to define' \
        '*-U-:symbol to undefine' \
        '*-I-:include directory:_files -/' \
        '*:defaults file:_files'
      ;;
    esac
    PK[ZZfunctions/_have_glob_qualnuW+A#autoload
    
    # Test if $1 has glob qualifiers.  This is partly magic, partly guesswork,
    # wholly flakey.
    #
    # If $2 is "complete" test if the qualifiers are complete (up to the ")"
    # at the end of the word), else that they are incomplete.
    # Sets match, mbegin, mend to reflect their location.
    # $match[1] is everything up to the start of the qualifiers themselves;
    #   this may therefore end in "(" or "(#q".
    # $match[2] is everything at the start not counting the "(" or "(#q".
    # $match[5] is the set of qualifiers themselves, not including a trailing
    #   parenthesis.
    local complete
    
    [[ $2 = complete ]] && complete=")"
    
    [[ -z $compstate[quote] &&
      ( -o bareglobqual &&
           $1 = (#b)(((*[^\\\$]|)(\\\\)#)\()([^\)\|\~]#)$complete &&
           ${#match[1]} -gt 1 ||
         -o extendedglob &&
           $1 = (#b)(((*[^\\\$]|)(\\\\)#)"(#q")([^\)]#)$complete
        ) ]]
    PK[Tfunctions/_svcadmnuW+A#compdef svcadm
    
    _svcadm() {
    	local context state line subcmds
    	typeset -A opt_args
    
    	subcmds=( enable disable restart refresh mark clear milestone )
    
    	if [[ $service == "svcadm" ]]; then
    		_arguments -C -A "-*" \
    			'-v[print actions verbosely]' \
    			'*::command:->subcmd' && return 0
    
    		if (( CURRENT == 1 )); then
    			_wanted commands expl 'svcadm subcommand' compadd -a subcmds
    			return
    		fi
    		service="$words[1]"
    		curcontext="${curcontext%:*}=$service:"
    	fi
    
    	case $service in
    	(enable)
    		_arguments \
    			'-r[recursively enable dependencies]' \
    			'-s[wait for service to come online]' \
    			'-t[state change is temporary]' \
    			'*:instance FMRI:_svcs_fmri -i'
    		;;
    
    	(disable)
    		_arguments \
    			'-s[wait for service to become disabled]' \
    			'-t[state change is temporary]' \
    			'*:instance FMRI:_svcs_fmri -i'
    		;;
    
    	(mark)
    		_arguments \
    			'-I[change state immediately]' \
    			'-t[state change is temporary]' \
    			':state:(degraded maintenance)' \
    			':instance FMRI:_svcs_fmri -i'
    		;;
    
    	(restart|refresh|clear)
    		_arguments \
    			'*:instance FMRI:_svcs_fmri -i'
    		;;
    
    	(milestone)
    		_arguments \
    			'-d[make milestone the default]' \
    			'*:milestone FMRI:_svcs_fmri -m'
    		;;
    
    # 	# The delegate subcommand has been removed, replaced by just using
    # 	# the restarter fmri
    # 	(delegate)
    # 		_arguments \
    # 			'1:restarter FMRI:_svcs_fmri -r' \
    # 			'*:instance FMRI:_svcs_fmri -i'
    # 		;;
    
    	(*)
    		_message "unknown svcadm subcommand: $service"
    	esac
    }
    
    _svcadm "$@"
    PK[++functions/_netcatnuW+A#compdef nc netcat
    
    local curcontext="$curcontext" state line expl
    typeset -A opt_args
    
    # handle name clash with the nedit client
    [[ $service = nc ]] && ! _pick_variant netcat=connect nedit -h &&
        _nedit && return
    
    if (( ! $+_nc_args )); then
      local help="$(_call_program options $words[1] -h < /dev/null 2>&1)"
      local -A optionmap
      optionmap=(
        '*-e prog*' '-e+[program to exec after connect]:prog:_command_names -e'
         '*-g gateway*' '-g+[source-routing hop point]:gateway:_hosts'
         '*-G num*' '-G[source-routing pointer: 4, 8, 12]'
         '*-i secs*' '-i+[delay interval for lines sent or ports scanned]:secs:'
         '*-l*' '-l[listen mode]'
         '*-n*' '-n[numeric-only IP addresses, no DNS]'
         '*-o file*' '-o+[hex dump of traffic]:file:_files'
         '*-p port*' '-p+[local port number]:port:_ports'
         '*-r*' '-r[randomize local and remote ports]'
         '*-q secs*' '-q+[quit after EOF on stdin and delay of secs]:secs:'
         '*-t*' '-t[answer TELNET negotiation]'
         '*-u*' '-u[UDP mode]'
         '*-v*' '-v[verbose]'
         '*-w secs*' '-w+[timeout for connects and final net reads]:secs:'
         '*-z*' '-z[zero-I/O mode]'
         '*-x*' '-x'
         '*-b*' '-b[allow broadcasts]'
      )
      _nc_args=($optionmap[(K)"$help"])
    fi
    
    _arguments -C -s \
      "$_nc_args[@]" \
      ':host:_hosts' \
      ':port:_ports' && return 0
    PK[functions/_sednuW+A#compdef sed
    
    local args
    
    args=(
      '(-n --quiet --silent)'{-n,--quiet,--silent}'[suppress automatic printing of pattern space]'
      '(1)*'{-e,--expression=-}'[add sed commands to run]:sed script'
      '(1)*'{-f,--file=-}'[add contents of file to commands to run]:file:_files'
      '(-e)1: :_guard "^-*" sed script'
      '*:input file:_files'
    )
    
    if _pick_variant gnu=GNU unix --version; then
      args+=(
        '(-i --in-place)'{-i-,--in-place=-}'[edit files in place]::suffix for backup'
        '(-l --line-length)'{-l,--line-length=-}'[specify line-wrap length for the l command]'
        '(-r --regexp-extended)'{-r,--regexp-extended}'[use extended regular expressions]'
        '(-s --separate)'{-s,--separate}'[consider files separately instead of as a combined stream]'
        '(-u --unbuffered)'{-u,--unbuffered}'[disable data buffering]'
        '(- 1 :)--help[print program usage]'
        '(- 1 :)'{-V,--version}'[print program version]'
      )
    else
      args=( "${(@)args:#(|\(*\))(|\*)--*}" )
    fi
    
    _arguments "$args[@]"
    PK[,yfunctions/_aliasesnuW+A#compdef unalias
    
    local expl sel args opts
    
    zparseopts -E -D s:=sel
    
    [[ -z $sel ]] && sel=rgs
    
    opts=( "$@" )
    
    args=()
    [[ $sel = *r* ]] && args=( $args 'aliases:regular alias:compadd -k aliases' )
    [[ $sel = *g* ]] && args=( $args 'global-aliases:global alias:compadd -k galiases' )
    [[ $sel = *s* ]] && args=( $args 'suffix-aliases:suffix alias:compadd -k saliases' )
    [[ $sel = *R* ]] && args=( $args 'disabled-aliases:disabled regular alias:compadd -k dis_aliases' )
    [[ $sel = *G* ]] && args=( $args 'disabled-global-aliases:disabled global alias:compadd -k dis_galiases' )
    [[ $sel = *S* ]] && args=( $args 'disabled-suffix-aliases:disabled suffix alias:compadd -k dis_saliases' )
    
    _alternative -O opts $args
    PK[2}+''functions/VCS_INFO_reposubnuW+A## vim:ft=zsh
    ## Written by Frank Terbeck 
    ## Distributed under the same BSD-ish license as zsh itself.
    
    setopt localoptions extendedglob NO_shwordsplit
    local base=${1%%/##}
    
    [[ ${PWD} == ${base}/* ]] || {
        printf '.'
        return 1
    }
    printf '%s' ${PWD#$base/}
    return 0
    PK[ۧR77 functions/smart-insert-last-wordnuW+A# smart-insert-last-word
    # Inspired by Christoph Lange  from zsh-users/3265;
    # rewritten to correct multiple-call behavior after zsh-users/3270;
    # modified to work with copy-earlier-word after zsh-users/5832.
    # Edited further per zsh-users/10881 and zsh-users/10884.
    #
    # This function as a ZLE widget can replace insert-last-word, like so:
    #
    #   zle -N insert-last-word smart-insert-last-word
    #
    # With a numeric prefix, behaves like insert-last-word, except that words
    # in comments are ignored when interactive_comments is set.
    #
    # Otherwise, the rightmost "interesting" word from any previous command is
    # found and inserted.  The default definition of "interesting" is that the
    # word contains at least one alphabetic character, slash, or backslash.
    # This definition can be overridden by use of a style like so:
    #
    #   zstyle :insert-last-word match '*[[:alpha:]/\\]*'
    #
    # For example, you might want to include words that contain spaces:
    #
    #   zstyle :insert-last-word match '*[[:alpha:][:space:]/\\]*'
    #
    # Or include numbers as long as the word is at least two characters long:
    #
    #   zstyle :insert-last-word match '*([[:digit:]]?|[[:alpha:]/\\])*'
    #
    # That causes redirections like "2>" to be included.
    #
    # Note also that the style is looked up based on the widget name, so you
    # can bind this function to different widgets to use different patterns:
    #
    #   zle -N insert-last-assignment smart-insert-last-word
    #   zstyle :insert-last-assignment match '[[:alpha:]][][[:alnum:]]#=*'
    #   bindkey '\e=' insert-last-assignment
    #
    # The "auto-previous" style, if set to a true value, causes the search to
    # proceed upward through the history until an interesting word is found.
    # If auto-previous is unset or false and there is no interesting word, the
    # last word is returned.
    
    emulate -L zsh
    setopt extendedglob nohistignoredups
    
    # Begin by preserving completion suffix if any
    zle auto-suffix-retain
    
    # Not strictly necessary:
    # (($+_ilw_hist)) || integer -g _ilw_hist _ilw_count _ilw_cursor _ilw_lcursor
    
    integer cursor=$CURSOR lcursor=$CURSOR
    local lastcmd pattern numeric=$NUMERIC
    
    # Save state for repeated calls
    if (( HISTNO == _ilw_hist && cursor == _ilw_cursor )); then
        NUMERIC=$[_ilw_count+1]
        lcursor=$_ilw_lcursor
    else
        NUMERIC=1
        _ilw_lcursor=$lcursor
    fi
    # Handle the up to three arguments of .insert-last-word
    if (( $+1 )); then
        if (( $+3 )); then
    	((NUMERIC = -($1)))
        else
    	((NUMERIC = _ilw_count - $1))
        fi
        (( NUMERIC )) || LBUFFER[lcursor+1,cursor+1]=''
        numeric=$((-(${2:--numeric})))
    fi
    _ilw_hist=$HISTNO
    _ilw_count=$NUMERIC
    
    if [[ -z "$numeric" ]]
    then
        zstyle -s :$WIDGET match pattern ||	pattern='*[[:alpha:]/\\]*'
    fi
    
    # Note that we must use .up-history for navigation here because of
    # possible "holes" in the $history hash (the result of dup expiry).
    # We need $history because $BUFFER retains edits in progress as the
    # user moves around the history, but we search the unedited lines.
    
    {
      zmodload -i zsh/parameter
      zle .end-of-history              # Start from final command
      zle .up-history || return 1      # Retrieve previous command
      local buffer=$history[$HISTNO]   # Get unedited history line
      lastcmd=( ${${(z)buffer}:#\;} )  # Split into shell words
      if [[ -n "$pattern" ]]
      then
          # This is the "smart" part -- search right-to-left and
          # latest-to-earliest through the history for a word.
          integer n=0 found=$lastcmd[(I)$pattern]
          if zstyle -t :$WIDGET auto-previous
          then
              while (( found == 0 && ++n ))
              do
                  zle .up-history || return 1
                  buffer=$history[$HISTNO]
                  lastcmd=( ${${(z)buffer}:#\;} )
                  found=$lastcmd[(I)$pattern]
              done
          fi
          # The following accounts for 1-based index
          (( found-- > 0 && (numeric = $#lastcmd - found) ))
      fi
    } always {
      HISTNO=$_ilw_hist                # Return to current command
      CURSOR=$cursor                   # Restore cursor position
      NUMERIC=${numeric:-1}            # In case of fall-through
    }
    
    (( NUMERIC > $#lastcmd )) && return 1
    
    LBUFFER[lcursor+1,cursor+1]=$lastcmd[-NUMERIC]
    _ilw_cursor=$CURSOR
    PK[1functions/zfcdnuW+A# function zfcd {
    # zfcd:  change directory on the remote server.
    #
    #  Currently has the following features:
    # --- an initial string matching $HOME in the directory is turned back into ~
    #     to be re-interpreted by the remote server.
    # --- zfcd with no arguments changes directory to '~'
    # --- `zfcd old new' and `zfcd -' work analagously to cd
    # --- if the connection is not currently open, it will try to
    #     re-open it with the stored parameters as set by zfopen.
    #     If the connection timed out, however, it won't know until
    #     too late.  In that case, just try the same zfcd command again
    #     (but now `zfcd -' and `zfcd old new' won't work).
    
    # hack: if directory begins with $HOME, turn it back into ~
    # there are two reasons for this:
    #   first, a ~ on the command line gets expanded even with noglob.
    #     (I suppose this is correct, but I wouldn't like to swear to it.)
    #   second, we can no do 'zfcd $PWD' and the like, and that will
    #     work just as long as the directory structures under the home match.
    
    emulate -L zsh
    [[ $curcontext = :zf* ]] || local curcontext=:zfcd
    
    if [[ $1 = /* ]]; then
      zfautocheck -dn || return 1
    else
      zfautocheck -d || return 1
    fi
    
    if [[ $1 = $HOME || $1 = $HOME/* ]]; then
      1="~${1#$HOME}"
    fi
    
    if (( $# == 0 )); then
      # Emulate `cd' behaviour
      set -- '~'
    elif [[ $# -eq 1 && $1 = - ]]; then
      # Emulate `cd -' behaviour.
      set -- $zfconfig[lastdir_$ZFTP_SESSION]
    elif [[ $# -eq 2 ]]; then
      # Emulate `cd old new' behaviour.
      # We have to find a character not in $1 or $2; ! is a good bet.
      eval set -- "\${ZFTP_PWD:s!$1!$2!}"
    fi
    
    # We have to remember the current directory before changing it
    # if we want to keep it.
    local lastdir=$ZFTP_PWD
    
    if zftp cd "$@" && [[ $lastdir != $ZFTP_PWD ]]; then
      # Invalidate current directory listing.
      rm -f $zfconfig[curdir_$ZFTP_SESSION]
      zfconfig[lastdir_$ZFTP_SESSION]=$lastdir
    fi
    
    print $zfconfig[lastloc_$ZFTP_SESSION]
    # }
    PK[functions/zfcd_matchnuW+A# function zfcd_match {
    
    emulate -L zsh
    setopt extendedglob
    
    # see zfcd for details of this hack
    if [[ $1 = $HOME || $1 = $HOME/* ]]; then
      1="~${1#$HOME}"
    fi
    
    # error messages only
    local ZFTP_VERBOSE=45
    # should we redirect 2>/dev/null or let the user see it?
    
    local tmpf=${TMPPREFIX}zfcm$$
    
    if [[ $ZFTP_SYSTEM = UNIX* ]]; then
      # hoo, aren't we lucky: this makes things so much easier
      setopt rcexpandparam
      local dir
      if [[ $1 = ?*/* ]]; then
        dir=${1%/*}
      elif [[ $1 = /* ]]; then
        dir=/
      fi
      # If we're using -F, we get away with using a directory
      # to list, but not a glob.  Don't ask me why.
      reply=(${${(M)${(f)"$(zftp ls -lF $dir)"}:#d*}/(#b)*[[:space:]](*)\//$match[1]})
    #  zftp ls -LF $dir >$tmpf
    #  reply=($(awk '/\/$/ { print substr($1, 1, length($1)-1) }' $tmpf))
    #  rm -f $tmpf
      [[ -n $dir && $dir != */ ]] && dir="$dir/"
      if [[ -n $WIDGET ]]; then
        _wanted directories expl 'remote directory' \
            compadd -S/ -q -P "$dir" - $reply
      elif [[ -n $dir ]]; then
        reply=(${dir}$reply)
      fi
    else
      # I simply don't know what to do here.
      # Just use the list of files for the current directory.
      zfget_match $*
    fi
    
    # }
    PK[;functions/VCS_INFO_detect_svknuW+A## vim:ft=zsh
    ## svk support by: Frank Terbeck 
    ## Distributed under the same BSD-ish license as zsh itself.
    
    setopt localoptions NO_shwordsplit
    
    [[ $1 == '--flavours' ]] && return 1
    
    # This detection function is a bit different from the others.
    # We need to read svk's config file to detect a svk repository
    # in the first place. Therefore, we'll just proceed and read
    # the other information, too. This is more then any of the
    # other detections do but this takes only one file open for
    # svk at most. VCS_INFO_get_data_svk() gets simpler, too. :-)
    
    setopt localoptions noksharrays extendedglob
    local -i fhash
    fhash=0
    
    VCS_INFO_check_com ${vcs_comm[cmd]} || return 1
    [[ -f ~/.svk/config ]] || return 1
    
    while IFS= read -r line ; do
        if [[ -n ${vcs_comm[basedir]} ]] ; then
            line=${line## ##}
            [[ ${line} == depotpath:* ]] && vcs_comm[branch]=${line##*/}
            [[ ${line} == revision:* ]] && vcs_comm[revision]=${line##*[[:space:]]##}
            [[ -n ${vcs_comm[branch]} ]] && [[ -n ${vcs_comm[revision]} ]] && break
            continue
        fi
        (( fhash > 0 )) && [[ ${line} == '  '[^[:space:]]*:* ]] && break
        [[ ${line} == '  hash:'* ]] && fhash=1 && continue
        (( fhash == 0 )) && continue
        [[ ${PWD}/ == ${${line## ##}%:*}/* ]] && vcs_comm[basedir]=${${line## ##}%:*}
    done < ~/.svk/config
    
    [[ -n ${vcs_comm[basedir]} ]]  && \
    [[ -n ${vcs_comm[branch]} ]]   && \
    [[ -n ${vcs_comm[revision]} ]] && return 0
    return 1
    PK[ZHfunctions/prompt_fade_setupnuW+A# Generic colour fade-bar prompt theme from bashprompt
    # Created by Jim Foltz 
    # Changed by Spidey 08/06
    # Converted to zsh prompt theme by 
    
    prompt_fade_help () {
      cat < [ []]] 
    
    where the parameters are the colors for the fade-bar and current
    working directory, user@host text, and date text respectively.  The
    default colors are green, white, and white.  This theme works best
    with a dark background.
    
    Recommended fonts for this theme: either UTF-8, or nexus or vga or similar.
    If you don't have any of these, the 8-bit characters will probably look
    stupid.
    EOH
    }
    
    # emacs shell-script mode gets confused with ' in heredoc above
    
    prompt_fade_setup () {
      local fadebar_cwd=${1:-'green'}
      local userhost=${2:-'white'}
      local date=${3:-'white'}
    
      if [[ $1 == '8bit' ]]; then
      shift
      local -A schars
      autoload -Uz prompt_special_chars
      prompt_special_chars
      fi
    
      PS1="%F{$fadebar_cwd}%B%K{$fadebar_cwd}$schars[333]$schars[262]$schars[261]$schars[260]%F{$userhost}%K{$fadebar_cwd}%B%n@%m%b%F{$fadebar_cwd}%K{black}$schars[333]$schars[262]$schars[261]$schars[260]%F{$date}%K{black}%B %D{%a %b %d} %D{%I:%M:%S%P} $prompt_newline%F{fadebar_cwd}%K{black}%B%~/%b%k%f "
      PS2="%F{$fadebar_cwd}%K{black}$schars[333]$schars[262]$schars[261]$schars[260]%f%k>"
    
      prompt_opts=(cr subst percent)
    }
    
    prompt_fade_preview () {
      local color colors
      colors=(red yellow green blue magenta)
    
      if (( ! $#* )); then
        for (( i = 1; i <= $#colors; i++ )); do
          color=$colors[$i]
          prompt_preview_theme fade $color
          print
        done
        prompt_preview_theme fade white grey blue
      else
        prompt_preview_theme fade "$@"
      fi
    }
    
    prompt_fade_setup "$@"
    PK[A"y||functions/_modulenuW+A#compdef module
    
    # Main dispatcher
    _module()
    {
      _arguments -s \
        '(-H --help)'{--help,-H}'[display usage info]' \
        '(-V --version)'{--version,-V}'[module command version and configuration options]' \
        '(-f --force)'{--force,-f}'[force active dependency resolution]' \
        '(-t --terse)'{--terse,-t}'[display avail and list output in short format]' \
        '(-l --long)'{--long,-l}'[display avail and list output in long format]' \
        '(-h --human)'{--human,-h}'[display short output in human-readable format]' \
        '(-v --verbose)'{--verbose,-v}'[verbose]' \
        '(-s --silent)'{--silent,-s}'[disable verbose messages]' \
        '(-c --create)'{--create,-c}'[create caches]' \
        '(-i --icase)'{--icase,-i}'[case insensitive]' \
        '(-u --userlvl)'{--userlvl,-u}'[set user level to value]:level:(novice expert advanced)' \
        '*::module command:_module_command'
    }
    
    (( $+functions[_module_command] )) || _module_command()
    {
      local -a _module_cmds
    
      _module_cmds=(
        "help:print the usage of each sub-command"
        "load:load a module into the shell environment"
        "add:load a module into the shell environment"
        "unload:remove a module from the shell environment"
        "rm:remove a module from the shell environment"
        "switch:switch loaded a loaded module with another module"
        "swap:switch loaded a loaded module with another module"
        "display:display information about a module"
        "show:display information about a module"
        "list:list loaded modules"
        "avail:list all available modules"
        "use:add a directory to MODULEPATH"
        "unuse:remove a directory from MODULEPATH"
        "update:reload all loaded modules"
        "clear:clear loaded modules information"
        "purge:unload all loaded modules"
        "refresh:refresh all non-persistent components of loaded modules"
        "whatis:display module information"
        "appropos:search for a given keyword in modules"
        "keyword:search for a given keyword in modules"
        "initadd:add or append a module to the user's shell init file"
        "initprepend:add or prepend a module to the user's shell init files"
        "initrm:remove a module from the user's shell init file"
        "initswitch:switch modules in the user's shell init file"
        "initlist:list all loaded modules in the user's shell init files"
        "initclear:clear all modules from the user's shell init files"
      )
    
      if (( CURRENT == 1 )); then
        _describe -t commands 'module command' _module_cmds || compadd "$@"
      else
        local curcontext="$curcontext"
    
        cmd="${${_module_cmds[(r)$words[1]:*]%%:*}}"
        # Deal with any aliases
        case $cmd in
          add) cmd="load";;
          rm) cmd="unload";;
          swap) cmd="switch";;
          show) cmd="display";;
          keyword) cmd="apropos";;
        esac
                    
        if (( $#cmd ));
        then
          local update_policy
          curcontext="${curcontext%:*:*}:module-${cmd}:"
          zstyle -s ":completion:${curcontext}:" cache-policy update_policy
          _call_function ret _module_$cmd || _message 'no more arguments'
        else
          _message "unknown module command: $words[1]"
        fi
    
        return ret
      fi
    }
    
    # Fills the available modules cache
    _module_available_modules()
    {
      if [[ -n $MODULEPATH ]] && [[ ${+_available_modules} -eq 0 ]]
      then
        _available_modules=(${$(find ${(e)=MODULEPATH//:/ } -xtype f -print 2>/dev/null | grep -v \\.version | sed -e 's,\('${${(e)=MODULEPATH//:/\/\\\|}%\\\|}'\),,g' -e 's,^/*,,g'):#*\~})
      fi
    }
    
    # Completion function for help
    (( $+functions[_module_help] )) || _module_help()
    {
      _module_available_modules
      compadd "$@" -a -- _available_modules
    }
    
    # Completion function for load|add
    (( $+functions[_module_load] )) || _module_load()
    {
      _module_available_modules
      compadd "$@" -a -- _available_modules
    }
    
    # Completion function for unload|rm
    (( $+functions[_module_unload] )) || _module_unload()
    {
      compadd "$@" -- ${=LOADEDMODULES//:/ }
    }
    
    # Completion function for switch|swap
    (( $+functions[_module_switch] )) || _module_switch()
    {
      # Actually first argument could be a loaded module
      _module_available_modules
      compadd "$@" -a -- _available_modules
    }
    
    # Completion function for display|show
    (( $+functions[_module_display] )) || _module_display()
    {
      _module_available_modules
      compadd "$@" -a -- _available_modules
    }
    
    # Completion function for avail
    ### No completion (yet?)
    
    # Completion function for use
    (( $+functions[_module_use] )) || _module_use()
    {
      _arguments -s \
        '(-a --append)'{--append,-a}'[append the directories instead of prepending]' \
        '*:directory:_files -/'    
    }
    
    # Completion function for unuse
    (( $+functions[_module_unuse] )) || _module_unuse()
    {
      compadd "$@" -- ${=MODULEPATH//:/ }
    }
    
    # Completion function for whatis
    (( $+functions[_module_whatis] )) || _module_whatis()
    {
      _module_available_modules
      compadd "$@" -a -- _available_modules
    }
    
    # Completion function for initadd
    (( $+functions[_module_initadd] )) || _module_initadd()
    {
      _module_available_modules
      compadd "$@" -a -- _available_modules
    }
    
    # Completion function for initprepend
    (( $+functions[_module_initprepend] )) || _module_initprepend()
    {
      _module_available_modules
      compadd "$@" -a -- _available_modules
    }
    
    # Completion function for initrm
    (( $+functions[_module_initrm] )) || _module_initrm()
    {
      _module_available_modules
      compadd "$@" -a -- _available_modules
    }
    
    # Completion function for initswitch
    (( $+functions[_module_initswitch] )) || _module_initswitch()
    {
      _module_available_modules
      compadd "$@" -a -- _available_modules
    }
    
    _module "$@"
    PK[uAfunctions/_yodlnuW+A#compdef -P yodl(|2*)
    
    _arguments -s \
      '-D-[define symbol]:define symbol:' \
      '-I-[set include directory]:include directory:_files -/' \
      '-l-[set live data policy]:live data policy:((0\:suppress\ SYSTEM\ and\ PIPETHROUGH 1\:require\ user\ confirmation 2\:display\ macros 3\:no\ confirmation,\ no\ display))' \
      '-o-[specify output file]:output file:_files' \
      '-P-[specify preload command]:preload command:' \
      '-p-[specify maximum number of passes]:maximum number of passes:' \
      '-t[enable tracing mode]' \
      '-v[enable verbose mode]' \
      '-w[enable warnings]' \
      '-h[show usage information]' \
      '*:YODL input file:_files -g "*.(#i)yo(|dl)(-.)"'
    PK[`̃Ifunctions/_setfaclnuW+A#compdef setfacl setfacl.exe
    
    if _pick_variant cygwin=cygwin unix --version; then
    # cygwin 1.5.25
    _arguments -s -S \
      '(-d, --delete)'{-d,--delete}'[delete one or more specified ACL entries]:ACL entry:' \
      '(-f, --file)'{-f,--file}'[set ACL entries for FILE to ACL entries read from a ACL_FILE]:ACL file:_files' \
      '(-m, --modify)'{-m,--modify}'[modify one or more specified ACL entries]:ACL entry:' \
      '(-r, --replace)'{-r,--replace}'[replace mask entry with maximum permissions needed for the file group class]' \
      '(-s, --substitute)'{-s,--substitute}'[substitute specified ACL entries for the \[ACL of FILE\]]:ACL entry:' \
      '(- *)'{-h,--help}'[output usage information and exit]' \
      '(- *)'{-v,--version}'[output version information and exit]' \
      '*: :_files'
    else
    _arguments -s -S \
      '(-m --modify)'{-m,--modify=}'[modify the current ACL]:ACL:' \
      '(-M --modify-file)'{-M,--modify-file=}'[read ACL entries to modify from file]:file:_files' \
      '(-x --remove)'{-x,--remove=}'[remove ACL entries]:ACL:' \
      '(-X --remove-file)'{-X,--remove-file=}'[read ACL entries to remove from file]:file:_files' \
      '(-b --remove-all)'{-b,--remove-all}'[remove all extended ACL entries]' \
      '(-k --remove-default)'{-k,--remove-default}'[remove the default ACL]' \
      '--set=[set the ACL, replacing the current ACL]:ACL:' \
      '--set-file=[read ACL entries to set from file]:file:_files' \
      '--mask[do recalculate the effective rights mask]' \
      '(-n --no-mask)'{-n,--no-mask}'[don'"'"'t recalculate the effective rights mask]' \
      '(-d --default)'{-d,--default}'[operations apply to the default ACL]' \
      '(-R --recursive)'{-R,--recursive}'[recurse into subdirectories]' \
      '(-L --logical)'{-L,--logical}'[logical walk, follow symbolic links]' \
      '(-P --physical)'{-P,--physical}'[physical walk, do not follow symbolic links]' \
      '--restore=[restore ACLs]:file:_files' \
      '--test[test mode (ACLs are not modified)]' \
      '--version[print version and exit]' \
      '--help[this help text]' \
      '*: :_files'
    fi
    PK[^38.eefunctions/_trapnuW+A#compdef trap
    
    local expl
    
    if [[ CURRENT -eq 2 ]]; then
      compset -q
      _normal
    else
      _signals -a
    fi
    PK[YYfunctions/zfrglobnuW+A# function zfrglob {
    # Do the remote globbing for zfput, etc.
    # We have two choices:
    #  (1) Get the entire file list and match it one by one
    #      locally against the pattern.
    #      Causes problems if we are globbing directories (rare, presumably).
    #      But: we can cache the current directory, which
    #      we need for completion anyway.  Works on any OS if you
    #      stick with a single directory.  This is the default.
    #  (2) Use remote globbing, i.e. pass it to ls at the site.
    #      Faster, but only works with UNIX, and only basic globbing.
    #      We do this if the remote-glob style (or $zfrglob for
    #      backward compatibility) is set.
    
    # There is only one argument, the variable containing the
    # pattern to be globbed.  We set this back to an array containing
    # all the matches.
    
    emulate -L zsh
    setopt extendedglob
    
    local pat dir nondir files i zfrglob
    
    zstyle -t "$curcontext" remote-glob && zfrglob=1
    
    eval pat=\$$1
    
    # Check if we really need to do anything.  Look for standard
    # globbing characters, and if we are
    # using zsh for the actual pattern matching also look for
    # extendedglob characters.
    if [[ $pat != *[][*?]* &&
      ( -n $zfrglob || $pat != *[(|)#^]* ) ]]; then
      return 0
    fi
    local tmpf=${TMPPREFIX}zfrglob$$
    
    if [[ $zfrglob != '' ]]; then
      zftp ls "$pat" >$tmpf 2>/dev/null
      eval "$1=(\$(<\$tmpf))"
      rm -f $tmpf
    else
      if [[ $ZFTP_SYSTEM = UNIX* && $pat = */* ]]; then
        # not the current directory and we know how to handle paths
        if [[ $pat = ?*/* ]]; then
          # careful not to remove too many slashes
          dir=${pat%/*}
        else
          dir=/
        fi
        nondir=${pat##*/}
        zftp ls "$dir" 2>/dev/null >$tmpf
        files=($(<$tmpf))
        files=(${files:t})
        rm -f $tmpf
      else
        # we just have to do an ls and hope that's right
        local fcache_name
        zffcache
        nondir=$pat
        files=(${(P)fcache_name})
      fi
      # now we want to see which of the $files match $nondir:
      # ${...:/foo} deletes occurrences of foo matching a complete word,
      # while the ^ inverts the sense so that anything not matching the
      # pattern in $nondir is excluded.
      eval "$1=(\${files:/^\${~nondir}})"
    fi
    # }
    PK[p(functions/_gdbnuW+A#compdef gdb
    
    local cur="$words[CURRENT]" prev w list ret=1 expl
    
    [[ "$PREFIX" = --* ]] &&
        _arguments -- '*=(CORE|SYM)FILE:core file:_files' \
    		  '*=EXECFILE:executable:_files -g \*\(-\*\)' \
    		  '*=TTY:terminal device:compadd /dev/tty\*' && return 0
    
    if compset -P '-(cd|directory)='; then
      _files -/
    elif compset -P '-tty='; then
      _wanted devices expl 'terminal device' compadd - /dev/tty*
    elif compset -P '-(exec|se)='; then
      _description files expl executable
      _files "$expl[@]" -g '*(-*)'
    elif compset -P '-(symbols|core|command)='; then
      _files
    elif [[ "$PREFIX" = -* ]]; then
      _tags options
      while _tags; do
        while _next_label options expl option; do
          compadd "$expl[@]" -QS '' - -symbols\= -exec\= -se\= -core\= -command\= \
                                      -directory\= -cd\= -tty\= && ret=0
          compadd "$expl[@]"        - -help -h -s -e -c -x -d -nx -n -quiet -q \
    	    		          -batch -fullname -f -b && ret=0
        done
        (( ret )) || return 0
      done
    else
      prev="$words[CURRENT-1]"
    
      case "$prev" in
      (-d)     _files -/ && return 0 ;;
      (-[csx]) _files && return 0 ;;
      (-e)     _description files expl executable
               _files "$expl[@]" -g '*(-*)' && return 0 ;;
      (-b)     _wanted -V values expl 'baud rate' \
                   compadd 0 50 75 110 134 150 200 300 600 1200 1800 2400 4800 \
    		       9600 19200 38400 57600 115200 230400 && return 0 ;;
      esac
    
      w=( "${(@)words[2,-1]}" )
      while [[ "$w[1]" = -* ]]; do
        [[ "$w[1]" = -[decsxb] ]] && shift 1 w
        shift 1 w
      done
    
      if [[ $#w -gt 1 ]]; then
        _alternative "files:: _files -g '*core(-.)'" "processes:: _pids -m ${w[1]:t}"
      else
        _description files expl executable
        _files "$expl[@]" -g '*(-*)'
      fi
    fi
    PK[functions/_texinuW+A#compdef -P (texi(2*|ndex))
    
    local expl
    
    _description files expl 'texinfo file'
    _files "$@" "$expl[@]" -g '*.(texinfo|texi)(-.)'
    PK[G]eefunctions/_pkginfonuW+A#compdef pkginfo
    
    _pkginfo() {
    	_arguments -s \
    	'(-q -r -x)-l[long listing]' \
    	'(-l -r -x)-q[quiet mode]' \
    	'(-l -q -x)-r[relocation base]' \
    	'(-l -q -r)-x[extracted listing]' \
    	'-c[category]:category: ' \
    	'-a[architecture]:architecture: ' \
    	'-v[version]:version: ' \
    	- set1 \
    	'(-p)-i[select completely installed packages]' \
    	'(-i)-p[select partially installed packages]' \
    	'-R[root path]:root path:_files -/' \
    	'*:package instance:_pkg_instance --_opts installed:set1--R' \
    	- set2 \
    	'-d[device]:device file:_files' \
    	'*:package instance:_pkg_instance --_opts uninstalled:set2--d'
    }
    
    _pkginfo "$@"
    PK[ifunctions/_attrnuW+A#compdef attr getfattr setfattr
    
    case $service in
      attr)
        local -a list
        [[ $OSTYPE = irix* ]] &&
            list=( '(-g -s -r -V)-l[list extended attributes associated with file]' )
        _arguments -s -S "$list[@]" \
          '(-l -r -s -V)-g[get extended attribute for file]:attribute name' \
          '(-l -g -s -q -V)-r[remove given attribute from file]:attribute name' \
          '(-l -g -r)-s[set named attribute for file]:attribute name' \
          '(-r)-q[quiet output]' \
          '(-g -r)-V[specify value of attribute]:value' \
          '-L[dereference symbolic links]' \
          '-R[operator in the root attribute namespace]' \
          '1:file:_files'
        return
      ;;
      getfattr)
        _arguments -s -S \
          '(-d --dump -n --name)'{-n+,--name=}'[dump the value of the named extended attribute]' \
          '(-n --name -d --dump)'{-d,--dump}'[dump the values of all extended attributes]' \
          '(-e --encoding)'{-e+,--encoding=}'[encode values after retrieving them]:encoding:(text hex base64)' \
          '(-h --no-derference)'{-h,--no-dereference}'[do not follow symbolic links]' \
          '(-m --match)'{-m+,--match=}'[only include attributes with names matching regex]:regular expression' \
          '--absolute-names[do not string leasing slash characters]' \
          '--only-values[dump only attribute values]' \
          '(-R --recursive)'{-R,--recursive}'[list attributes of all files and directories recurively]' \
          '(-P --physical -L --logical)'{-L,--logical}'[follow all symbolic links]' \
          '(-L --logical -P --physical)'{-P,--physical}'[skip all symbolic links]' \
          '(* -)--version[display version information]' \
          '(* -)--help[display help information]' \
          '*:file:_files'
        return
      ;;
      setfattr)
        _arguments -s -S \
          '(-n --name)'{-n+,--name=}'[specify extended attribute to set]' \
          '(-v --value)'{-v+,--value=}'[specify value for the attribute]' \
          '(-x --remove)'{-x+,--remove=}'[remove specified extended attribute]' \
          '(-n --name -v --value)--restore[restore extended attributes from dump file]:dump file:_files' \
          '(-h --no-derference)'{-h,--no-dereference}'[do not follow symbolic links]' \
          '(* -)--version[display version information]' \
          '(* -)--help[display help information]' \
          '*:file:_files'
        return
      ;;
    esac
    PK[YG*11functions/_sshnuW+A#compdef ssh slogin=ssh scp ssh-add ssh-agent ssh-keygen sftp
    
    _remote_files () {
      # There should be coloring based on all the different ls -F classifiers.
      local expl rempat remfiles remdispf remdispd args suf ret=1
    
      if zstyle -T ":completion:${curcontext}:files" remote-access; then
        zparseopts -D -E -a args p: 1 2 4 6 F:
        if [[ -z $QIPREFIX ]]
        then rempat="${PREFIX%%[^./][^/]#}\*"
        else rempat="${(q)PREFIX%%[^./][^/]#}\*"
        fi
        remfiles=(${(M)${(f)"$(_call_program files ssh -o BatchMode=yes $args -a -x ${IPREFIX%:} ls -d1FL "$rempat" 2>/dev/null)"}%%[^/]#(|/)})
        compset -P '*/'
        compset -S '/*' || suf='remote file'
    
        remdispf=(${remfiles:#*/})
        remdispd=(${(M)remfiles:#*/})
    
        _tags files
        while _tags; do
          while _next_label files expl ${suf:-remote directory}; do
            [[ -n $suf ]] && compadd "$@" "$expl[@]" -d remdispf \
    	    ${(q)remdispf%[*=@|]} && ret=0 
    	compadd ${suf:+-S/} "$@" "$expl[@]" -d remdispd \
    	    ${(q)remdispd%/} && ret=0
          done
          (( ret )) || return 0
        done
        return ret
      else
        _message -e remote-files 'remote file'
      fi
    }
    
    _ssh () {
      local curcontext="$curcontext" state line expl common tmp cmds suf ret=1
      typeset -A opt_args
    
      common=(
        '-c+[select encryption cipher]:encryption cipher:(idea des 3des blowfish arcfour tss none)'
        '-C[compress data]'
        '-F+[specify alternate config file]:config file:_files'
        '-i+[select identity file]:SSH identity file:_files'
        '*-o+[specify extra options]:option string:->option'
        '(-2)-1[forces ssh to try protocol version 1 only]'
        '(-1)-2[forces ssh to try protocol version 2 only]'
        '(-6)-4[forces ssh to use IPv4 addresses only]'
        '(-4)-6[forces ssh to use IPv6 addresses only]'
      )
    
      case "$service" in
      ssh)
        _arguments -C -s \
          '(-A)-a[disable forwarding of authentication agent connection]' \
          '(-a)-A[enables forwarding of the authentication agent connection]' \
          '(-P)-b+[specify interface to transmit on]:bind address:_bind_addresses' \
          '-D+[specify a dynamic port forwarding]:port' \
          '-e+[set escape character]:escape character (or `none'"'"'):' \
          '(-n)-f[go to background]' \
          '-g[allow remote hosts to connect to local forwarded ports]' \
          '-I+[specify smartcard device]:device:_files' \
          '-k[disable forwarding of kerberos tickets]' \
          '-l+[specify login name]:login name:_ssh_users' \
          '(-1)-m+[specify mac algorithms]:mac spec' \
          '-n[redirect stdin from /dev/null]' \
          '(-1)-N[do not execute a remote command. (protocol version 2 only)]' \
          '-p+[specify port on remote host]:port number on remote host' \
          '-P[use non privileged port]' \
          '(-v)*-q[quiet operation]' \
          '(-1)-s[invoke subsystem]' \
          '(-T)-t[force pseudo-tty allocation]' \
          '(-1 -t)-T[disable pseudo-tty allocation (protocol version 2 only)]' \
          '(-q)*-v[verbose mode]' \
          '-V[show version number]' \
          '(-X -Y)-x[disable X11 forwarding]' \
          '(-x -Y)-X[enable (untrusted) X11 forwarding]' \
          '(-x -X)-Y[enable trusted X11 forwarding]' \
          '-M[master mode for connection sharing]' \
          '-S+:path to control socket:_files' \
          '-O:multiplex control command:(check exit)' \
          '*-L[specify local port forwarding]:local port forwarding:->forward' \
          '*-R[specify remote port forwarding]:remote port forwarding:->forward' \
          ':remote host name:->userhost' \
          '*::args:->command' "$common[@]" && ret=0
        ;;
      scp)
        _arguments -C -s \
          '-p[preserve modification times]' \
          '-r[recursively copy directories]' \
          '-v[verbose mode]' \
          '-B[batch mode]' \
          '-q[disables the progress meter]' \
          '-P+[specify port on remote host]:port number on remote host' \
          '-S+[specify ssh program]:path to ssh:_command_names -e' \
          '*:file:->file' "$common[@]" && ret=0
        ;;
      ssh-add)
        _arguments -s \
          '-l[list all identities]' \
          '-L[lists public key parameters of all identities in the agent]'\
          '-d[remove identity]' \
          '-D[delete all identities]' \
          '-p[read passphrase from stdin]' \
          '*:SSH identity file:_files'
        return
        ;;
      ssh-agent)
        _arguments -s \
          '(*)-k[kill agent automatically]' \
          '(-c)-s[force sh-style shell]' \
          '(-s)-c[force csh-style shell]' \
          '(-k)-d[debug mode]' \
          '*::command: _normal'
        return
        ;;
      ssh-keygen)
        cmds=( -p -i -e -y -c -l -B -D -U )
        _arguments \
          '-q[silence ssh-keygen]' \
          "($cmds -P)-b[specify number of bits in key]:bits in key" \
          "($cmds -P)-t[specify the type of the key to create]:key type:(rsa1 rsa dsa)" \
          "(${cmds#-p })-N[provide new passphrase]:new passphrase" \
          "($cmds -b -t)-C[provide new comment]:new comment" \
          '(-D)-f[key file]:key file:_files' \
          '('${(j. .)cmds:#-[pc]}' -t -b)-P[provide old passphrase]:old passphrase' \
          "($cmds -q -b -t -C)-p[change passphrase of private key file]" \
          "($cmds -q -b -t -N -C -P)-i[import key to OpenSSH format]" \
          "($cmds -q -b -t -N -C -P)-e[export key to SECSH file format]" \
          "($cmds -q -b -t -N -C -P)-y[get public key from private key]" \
          "($cmds -q -b -t -N)-c[change comment in private and public key files]" \
          "($cmds -q -b -t -N -C -P)-l[show fingerprint of key file]" \
          "($cmds -q -b -t -N -C -P)-B[show the bubblebabble digest of key]" \
          "($cmds -q -b -t -N -C -P -f)-D[download key stored in smartcard reader]:reader" \
          "($cmds -q -b -t -N -C -P)-U[upload key to smartcard reader]:reader"
        return
        ;;
      sftp)
        _arguments -C -s \
          '-C[compress data]' \
          '-F+[specify alternate config file]:config file:_files' \
          '(-1)-s[invoke subsystem]' \
          '-S+[specify program]:program:_command_names -e' \
          '-B+[specify buffer size]:buffer size' \
          '-b+[specify batch file to read]:batch file:_files' \
          '*-v[verbose mode]' \
          '-1[forces ssh to try protocol version 1 only]' \
          '*-o+[specify extra options]:option string:->option' \
          '1:file:->rfile' '*:file:->file' && ret=0
        ;;
      esac
    
      while [[ -n "$state" ]]; do
        lstate="$state"
        state=''
    
        case "$lstate" in
        option)
          if compset -P '*[= ]'; then
            case "$IPREFIX" in
            *(#i)(afstokenpassing|batchmode|compression|fallbacktorsh|forward(agent|x11)|keepalive|passwordauthentication|rhosts(|rsa)authentication|rsaauthentication|usersh|kerberos(authetication|tgtparsing)|useprivileged)*)
    	  _wanted values expl 'truth value' compadd yes no && ret=0
              ;;
            *(#i)ciphers*)
              _values -s , 'encryption cipher' \
    	      'aes128-cbc' \
    	      '3des-cbc' \
    	      'blowfish-cbc' \
    	      'cast128-cbc' \
    	      'arcfour' \
    	      'aes192-cbc' \
    	      'aes256-cbc' \
    	      'rijndael128-cbc' \
    	      'rijndael192-cbc' \
    	      'rijndael256-cbc' \
    	      'rijndael-cbc@lysator.liu.se' && ret=0
              ;;
            *(#i)cipher*)
    	  _wanted values expl 'encryption cipher' \
                  compadd idea des 3des blowfish arcfour tss none && ret=0
              ;;
            *(#i)globalknownhostsfile*)
              _description files expl 'global file with known hosts'
              _files "$expl[@]" && ret=0
              ;;
            *(#i)hostname*)
    	  _wanted hosts expl 'real host name to log into' _ssh_hosts && ret=0
              ;;
            *(#i)identityfile*)
              _description files expl 'SSH identity file'
              _files "$expl[@]" && ret=0
              ;;
            *(#i)(local|remote)forward*)
              state=forward
              ;;
            *(#i)protocol*)
              _values -s , 'protocol version' \
    	      '1' \
    	      '2' && ret=0
    	  ;;
            *(#i)proxycommand*)
              compset -q
              shift 1 words
              (( CURRENT-- ))
              _normal && ret=0
              ;;
            *(#i)stricthostkeychecking*)
              _wanted values expl 'checking type' compadd yes no ask && ret=0
              ;;
            *(#i)userknownhostsfile*)
              _description files expl 'user file with known hosts'
              _files "$expl[@]" && ret=0
              ;;
            *(#i)user*)
    	  _wanted users expl 'user to log in as' _ssh_users && ret=0
              ;;
            *(#i)xauthlocation*)
              _description files expl 'xauth program'
              _files "$expl[@]" -g '*(-*)' && ret=0
              ;;
    	*(#i)controlmaster*)
    	  _wanted values expl 'truthish value' compadd yes no auto autoask && ret=0
    	  ;;
    	*(#i)controlpath*)
              _description files expl 'path to control socket'
              _files "$expl[@]" && ret=0
    	  ;;
            esac
          else
            _wanted values expl 'configure file option' \
                compadd -M 'm:{a-z}={A-Z}' -qS '=' - \
    	    	AddressFamily \
                    AFSTokenPassing BatchMode BindAddress \
    		ChallengeResponseAuthentication CheckHostIP \
    		Cipher Ciphers ClearAllForwardings Compression \
                    CompressionLevel ConnectionAttempts ConnectTimeout \
    		ControlMaster ControlPath \
    		DynamicForward EnableSSHKeysign \
    		EscapeChar FallBackToRsh ForwardAgent ForwardX11 \
    		ForwardX11Trusted \
                    GatewayPorts GlobalKnownHostsFile GSSAPIAuthentication \
    		GSSAPIDelegateCredentials HostbasedAuthentication \
    		HostKeyAlgorithms HostKeyAlias HostName IdentityFile \
    		IdentitiesOnly KbdInteractiveDevices \
    		KeepAlive KerberosAuthentication KerberosTgtPassing \
    		LocalForward LogLevel MACs NoHostAuthenticationForLocalhost \
    		NumberOfPasswordPrompts PreferredAuthentications \
    		PasswordAuthentication Port Protocol ProtocolKeepAlives \
                    ProxyCommand PubkeyAuthentication RemoteForward \
    		RhostsAuthentication RhostsRSAAuthentication \
    		RSAAuthentication ServerAliveInterval ServerAliveCountMax \
    		SetupTimeOut SmartcardDevice StrictHostKeyChecking \
    		TCPKeepAlive \
                    UsePrivilegedPort User UserKnownHostsFile UseRsh \
                    VerifyHostKeyDNS XAuthLocation && ret=0
          fi
          ;;
        forward)
          if compset -P 1 '*:'; then
            if compset -P '*:'; then
              _message -e port-numbers 'port number'
            else
    	  _wanted hosts expl host _ssh_hosts -qS:
            fi
          else
            _message -e port-numbers 'listen-port number'
          fi
          return
          ;;
        command)
          shift 1 words
          (( CURRENT-- ))
          _normal
          return
          ;;
        userhost)
          if compset -P '*@'; then
    	_wanted hosts expl 'remote host name' _ssh_hosts && ret=0
          elif compset -S '@*'; then
            _wanted users expl 'login name' _ssh_users -S '' && ret=0
          else
            if (( $+opt_args[-l] )); then
    	  tmp=()
    	else
    	  tmp=( 'users:login name:_ssh_users -qS@' )
    	fi
    	_alternative \
    	    'hosts:remote host name:_ssh_hosts' \
    	    "$tmp[@]" && ret=0
          fi
          ;;
        file)
          if compset -P '*:'; then
            _remote_files ${(kv)~opt_args[(I)-[FP1246]]/-P/-p} && ret=0
          elif compset -P '*@'; then
            suf=( -S '' )
            compset -S ':*' || suf=( -r: -S: )
            _wanted hosts expl 'remote host name' _ssh_hosts $suf && ret=0
          else
            _alternative \
    	    'files:: _files' \
    	    'hosts:remote host name:_ssh_hosts -r: -S:' \
    	    'users:user:_ssh_users -qS@' && ret=0
          fi
          ;;
        rfile)
          if compset -P '*:'; then
            _remote_files && ret=0
          elif compset -P '*@'; then
            _wanted hosts expl host _ssh_hosts -r: -S: && ret=0
          else
            _alternative \
    	    'hosts:remote host name:_ssh_hosts -r: -S:' \
    	    'users:user:_ssh_users -qS@' && ret=0
          fi
          ;;
        esac
      done
    }
    
    _ssh_users () {
      _combination -s '[:@]' my-accounts users-hosts users "$@"
    }
    
    _ssh_hosts () {
      local -a config_hosts
      local config
      integer ind
    
      # If users-hosts matches, we shouldn't complete anything else.
      if [[ "$IPREFIX" == *@ ]]; then
        _combination -s '[:@]' my-accounts users-hosts "users=${IPREFIX/@}" hosts "$@" && return
      else
        _combination -s '[:@]' my-accounts users-hosts \
          ${opt_args[-l]:+"users=${opt_args[-l]:q}"} hosts "$@" && return
      fi
      if (( ind = ${words[(I)-F]} )); then
        config=${~words[ind+1]}
      else
        config="$HOME/.ssh/config"
      fi
      if [[ -r $config ]]; then
        local IFS=$'\t ' key hosts host
        while read key hosts; do
          if [[ "$key" == (#i)host ]]; then
    	 for host in ${(z)hosts}; do
    	    case $host in
    	    (*[*?]*) ;;
    	    (*) config_hosts+=("$host") ;;
    	    esac
    	 done
          fi
        done < "$config"
        if (( ${#config_hosts} )); then
          _wanted hosts expl 'remote host name' \
    	compadd -M 'm:{a-zA-Z}={A-Za-z} r:|.=* r:|=*' "$@" $config_hosts
        fi
      fi
    }
    
    _ssh "$@"
    PK[nllfunctions/_pkg-confignuW+A#compdef pkg-config
    
    local arguments packages curcontext="$curcontext" stat line
    declare -A opt_args
    
    arguments=(
          "--modversion[print the version information of a given package]"
          "--atleast-pkgconfig-version=[require given version of pkg-config]:minimum version"
          "(- *)"{--help,-\?}"[display a help message]"
          "(- *)--usage[display brief usage message]"
          "--print-errors[cause errors to be printed]"
          "--silence-errors[prevent the printing of errors]"
          "--errors-to-stdout[print errors to stdout rather than stderr]"
          "--cflags[prints the preprocessor and compile flags]"
          "--cflags-only-I[output -I flags only]"
          "--cflags-only-other[output cflags not covered by the cflags-only-I option]"
          "--debug[show verbose debug information]"
          "--libs[prints the link flags]"
          "--libs-only-L[prints the -L and -R parts of \"--libs\"]"
          "--libs-only-l[prints the -l part of \"--libs\"]"
          "--libs-only-other[output other libs]"
          "--list-all[list all known packages]"
          "--variable=[return the value of the specified variable]:variable"
          "--define-variable=[set the global value for a variable]:name value pair"
          "--uninstalled[return successfully if any \"-uninstalled\" packages are being used and fails otherwise]"
          "--exists[tests whether the package exists or not]"
          "--atleast-version=[test whether the version is at least that of the specified value]:least value"
          "--exact-version=[test whether the version is exactly that of the specified value]:exact value"
          "--max-version=[test whether the version is no greater than some specific value]:max version"
    #      "--msvc-syntax[output linker flags in a form compatible with MSVC++ (Windows only)]"
    #      "--dont-define-prefix[disables automatic overiding of the variable \"prefix\" (Windows only)]"
    #      "--prefix-variable=[set the name of the variable \"prefix\" (Windows only)]:prefix value"
          "*:package name:->package"
    )
    
    _arguments -C $arguments
    
    if [[ -n $state ]] ; then
        packages=( ${(f)"$((pkg-config --list-all | cut -d' ' -f1) 2>/dev/null)"} )
        compadd -a - packages
    fi
    PK[##functions/_espeaknuW+A#compdef espeak
    
    #TODO: complete non-existing filenames for -w and --phonout
    #TODO: describe special cases for -k
    #TODO: complete --punct better?
    
    _arguments \
        '-h[help]' \
        '-f[file to speak]:text file:_files' \
        '--stdin[speak from stdin]' \
        '-q[quiet, no sound output]' \
        '-a[amplitude]:integer:(0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
    18 19 20)' \
        '-l[line length]:integer: ' \
        '-p[pitch]:integer:(0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
    19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
    43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66
    67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90
    91 92 93 94 95 96 97 98 99)' \
        '-s[speed]:words per minute: ' \
        '-v[voice]:voice name:(afrikaans bosnian catalan czech welsh-test danish-test german greek default en-scottish english lancashire english_rp english_wmids english-us en-westindies esperanto spanish spanish-latin-american finnish french french greek-ancient hindi-test croatian hungarian armenian armenian-west indonesian-test icelandic-test italian test/jbo kurdish latin latvian macedonian-test dutch-test norwegian-test test/pap polish brazil portugal romanian russian_test slovak albanian serbian swedish swahihi-test tamil turkish vietnam-test Mandarin cantonese-test)' \
        '-b[8-bit text]' \
        '-m[SSML or other XML text]' \
        '-w[wav output]:filename: ' \
        '-x[output phoneme mnemonics]' \
        '-X[output phoneme mnemonics and translation trace]' \
        '--stdout[output speech to stdout]' \
        '-k[capital letter indication]:integer:' \
        '--punct=-::characters: ' \
        '--voices=-[list available voices]::language code:(af bs ca cs cy da de el en en-sc en-uk en-uk-north en-uk-rp en-uk-wmids en-us en-wi eo es es-la fi fr fr-be grc hi hr hu hy hy id is it jbo ku la lv mk nl no pap pl pt pt-pt ro ru sk sq sr sv sw ta tr vi zh zh-yue)' \
        '--path=-[espeak-data path]:path:_files -/' \
        '--compile=-[compile]::voicename or debug: ' \
        '--phonout=-[output filename for -x/-X]:filename: ' 
    PK[/6functions/_md5sumnuW+A#compdef md5sum
    
    _arguments -S \
      '(-b --binary)'{-b,--binary}'[read in binary mode]' \
      '(-c --check)'{-c,--check}'[read MD5 sums from the FILEs and check them]' \
      '(-t --text)'{-t,--text}'[read in text mode]' \
      '--status[no output, status code shows success]' \
      '(-w --warn)'{-w,--warn}'[warn about improperly formatted checksum lines]' \
      '--help[display help and exit]' \
      '--version[output version information and exit]' \
      '*:files:_files'
    PK[D}}functions/_dlocatenuW+A#compdef dlocate
    
    local context state line
    typeset -A opt_args
    
    _arguments \
    	'-h[help]' \
    	'-S[match strings only]' \
    	'-L[list all files in package]' \
    	'-l[almost-emulation of dpkg -l]' \
    	'-s[print status of package]' \
    	'-ls[ls -ldF of all files in package]' \
    	'-du[du -sck of all files in package]' \
            '-conf[list conffiles in package]' \
    	'-lsconf[ls -ldF of conffiles in package]' \
    	'-lsman[list man pages in package]' \
    	'-lsbin[list executable files in package]' \
    	'-md5sum[list md5sums (if any) of package]' \
    	'-md5check[check md5sums (if any) of package]' \
    	'-man[list man pages (if any) of package]' \
    	':arg:->stringorpkg' && return 0
    
    case "$state" in
        (stringorpkg)
          if (( $+opt_args[-S] )); then
              _files
          else
              _alternative \
    		'string:search string:_files' \
    		'package:Debian packages:_deb_packages installed'
          fi
        ;;
    esac
    PK[$functions/prompt_fire_setupnuW+A# Fire prompt theme from bashprompt
    # Inspired by Raster (Carsten Haitzler of Red Hat Advanced Development Labs)
    # Created by BadlandZ
    # Changed by Spidey 08/06
    # Converted to zsh prompt theme by 
    
    prompt_fire_help () {
      cat < [ [ [ [ []]]]]]
    
    where the parameters are the three fire colors, and the colors for the
    user@host text, date text, and current working directory respectively.
    The default colors are yellow, yellow, red, white, white, and yellow.
    This theme works best with a dark background.
    
    Recommended fonts for this theme: either UTF-8, or nexus or vga or similar.
    If you don't have any of these, the 8-bit characters will probably look
    stupid.
    EOH
    }
    
    prompt_fire_setup () {
      local fire1=${1:-'yellow'}
      local fire2=${2:-'yellow'}
      local fire3=${3:-'red'}
      local userhost=${4:-'white'}
      local date=${5:-'white'}
      local cwd=${6:-'yellow'}
    
      if [[ $1 == '8bit' ]]; then
      shift
      local -a schars
      autoload -Uz prompt_special_chars
      prompt_special_chars
      fi
    
      local GRAD1="%{$schars[333]$schars[262]$schars[261]$schars[260]%}"
      local GRAD2="%{$schars[260]$schars[261]$schars[262]$schars[333]%}"
      local COLOR1="%B%F{$fire1}%K{$fire2}"
      local COLOR2="%B%F{$userhost}%K{$fire2}"
      local COLOR3="%b%F{$fire3}%K{$fire2}"
      local COLOR4="%b%F{$fire3}%K{black}"
      local COLOR5="%B%F{$cwd}%K{black}"
      local COLOR6="%B%F{$date}%K{black}"
      local GRAD0="%b%f%k"
    
      PS1=$COLOR1$GRAD1$COLOR2'%n@%m'$COLOR3$GRAD2$COLOR4$GRAD1$COLOR6' %D{%a %b %d} %D{%I:%M:%S%P} '$prompt_newline$COLOR5'%~/'$GRAD0' '
      PS2=$COLOR1$GRAD1$COLOR3$GRAD2$COLOR4$GRAD1$COLOR5'>'$GRAD0' '
    
      prompt_opts=(cr subst percent)
    }
    
    prompt_fire_preview () {
      if (( ! $#* )); then
        prompt_preview_theme fire
        print
        prompt_preview_theme fire red magenta blue white white white 
      else
        prompt_preview_theme fire "$@"
      fi
    }
    
    prompt_fire_setup "$@"
    PK[rrfunctions/_ispellnuW+A#compdef ispell buildhash munchlist findaffix tryaffix icombine ijoin
    
    case "$service" in
    ispell)
      _arguments -s \
        '(-n -h)-t[input file is in TeX/LaTeX format]' \
        '(-t -h)-n[input file is in nroff/troff format]' \
        '(-n -t)-h[input file is in HTML format]' \
        '(-x)-b[create backup file]' \
        '(-b)-x[don'"'"'t create backup file]' \
        '(-C)-B[report run-together words as errors]' \
        '(-B)-C[take run-together words as compounds]' \
        '-P[don'"'"'t generate extra root/affix combinations]' \
        '-m[make possible root/affix combinations]' \
        '-S[sort guesses by probable correctness]' \
        '-d[specify alternate dictionary file]:dictionary file:_files' \
        '-p[specify alternate personal dictionary file]:personal dictionary file:_files' \
        '-w[specify additional word characters]:word characters:' \
        '-W[specify length of legal words]:length of legal words:' \
        '-T[specify formatter type]:formatter type:(nroff mm ms me man NeXT tex bib)' \
        '(-N)-M[show menu]' \
        '(-M)-N[don'"'"'t show menu]' \
        '-L-[specify number of context lines to show]:number of context lines:' \
        '-V[show non-7-bit characters escaped]' \
        '-l[produce list of misspelled words on stdout]' \
        '-s[stop after each line of input (SIGTSTP)]' \
        '-f[specify output file name]:output file:_files' \
        '(-A)-a[single line input/output mode]' \
        '(-a)-A[single line input/output mode (with include-files)]' \
        '(-e)-c[produce list of possible root words and affixes]' \
        '(-c)-e-[expand affix flags]::expansion level:((1\:normal 2\:append\ prepend\ original\ root/affix\ combination 3\:output\ multiple\ lines 4\:append\ root\ length\ ratios))' \
        '-D[dump affix tables]' \
        '*-v[show version]' \
        ':file to spell-check:_files'
      ;;
    buildhash)
      _arguments \
        '(-c)-s[silent operation]' \
        '(: -s)-c[count mode]:count: :affix file:_files -g "*.(#i)aff(-.)"' \
        ':raw dictionary file:_files:' \
        ':affix file:_files -g "*.(#i)aff(-.)"' \
        ':hashed output file:_files "*.(#i)hash(-.)"'
      ;;
    munchlist)
      _arguments -s \
        '-l[specify affix file]:affix file:_files -g "*.(#i)aff(-.)"' \
        '-c[specify converted output file name]:converted file name:_files' \
        '-T[specify string character type]:string character type:' \
        '-s[specify strip hash file]:hash file:_files "*.(#i)hash(-.)"' \
        '-D[debug mode]' \
        '-v[verbose mode]' \
        '-w[specify additional word characters]:word characters:' \
        '*:dictionary file:_files'
      ;;
    findaffix)
      _arguments -s \
        '(-s)-p[search possible prefixes]' \
        '(-p)-s[search possible suffixes]' \
        '-f[sort affixes by frequency]' \
        '-c[clean output]' \
        '-m[specify minimum affix length]:minimum affix length:' \
        '-M[specify maximum affix length]:maximum affix length:' \
        '-e[specify header/trailer length of suppressed affixes]:header/trailer length of suppressed affixes:' \
        '-t[specify field separator character]:field separator character:' \
        '-l[specify minimum occurrence count]:minimum occurrence count:' \
        '*:dictionary file:_files'
      ;;
    tryaffix)
      _arguments -s \
        '(-s)-p[estimate effectiveness of prefix]' \
        '(-p)-s[estimate effectiveness of suffix]' \
        '-c[write only summary of the results]' \
        ':expanded dictionary file:_files:' \
        '*:affix and optional addition:'
      ;;
    icombine)
      _arguments \
        '-T[specify string character type]:string character type:' \
        ':affix file:_files -g "*.(#i)aff(-.)"'
      ;;
    ijoin)
      _arguments -s \
        '(-u)-s[use signed comparison]' \
        '(-s)-u[use unsigned comparison]' \
        '-a[print lines for unpairable lines and normal output]:file number:(1 2)' \
        '-v[print lines for unpairable lines instead of normal output]:file number:(1 2)' \
        '-e[specify replacement string]:replacement string:' \
        '-o[specify output field list]:output field list:' \
        '-t[specify field separator character]:field separator character:' \
        '(-1 -2)-j-[specify join file and field]:file number:(1 2):field number:' \
        '(-j)-1[specify join field]:field number:' \
        '(-j)-2[specify join field]:field number:' \
        ':first input file:_files' \
        ':second input file:_files'
      ;;
    esac
    PK[5IIfunctions/tcp_shootnuW+Aemulate -L zsh
    setopt extendedglob
    
    local REPLY tfd
    
    if [[ $# -ne 2 ]]; then
        print "Usage: tcp_dump host port
    Connect to the given host and port; send standard input.">&2
        return 1
    fi
    
    if ! ztcp $1 $2; then
        print "Failed to open connection to host $1 port $2" >&2
        return 1
    fi
    
    tfd=$REPLY
    
    cat >&$tfd
    
    ztcp -c $tfd
    PK[.functions/_getclipnuW+A#compdef getclip getclip.exe
    
    # cygutils 1.3.2
    
    _arguments -s -S \
      '(--dos -d --unix -u --no-conv -n)'{-d,--dos}'[output text will have DOS line endings]' \
      '(--dos -d --unix -u --no-conv -n)'{-u,--unix}'[output text will have UNIX line endings]' \
      '(--dos -d --unix -u --no-conv -n)'{-n,--no-conv}'[do not translate line endings]' \
      '(-)'{-\?,--help}'[display help information]' \
      '(-)--usage[display brief usage message]' \
      '(-)--version[display version information]' \
      '(-)--license[display licensing information]'
    PK[qUUfunctions/VCS_INFO_setnuW+A## vim:ft=zsh
    ## Written by Frank Terbeck 
    ## Distributed under the same BSD-ish license as zsh itself.
    
    setopt localoptions noksharrays NO_shwordsplit
    local -i i j
    
    if [[ $1 == '--clear' ]] ; then
        for i in {0..9} ; do
            unset vcs_info_msg_${i}_
        done
    fi
    if [[ $1 == '--nvcs' ]] ; then
        [[ $2 == '-preinit-' ]] && (( maxexports == 0 )) && (( maxexports = 1 ))
        for i in {0..$((maxexports - 1))} ; do
            typeset -gx vcs_info_msg_${i}_=
        done
        VCS_INFO_nvcsformats $2
    fi
    
    (( ${#msgs} - 1 < 0 )) && return 0
    for i in {0..$(( ${#msgs} - 1 ))} ; do
        (( j = i + 1 ))
        typeset -gx vcs_info_msg_${i}_=${msgs[$j]}
    done
    
    if (( i < maxexports )) ; then
        for j in {$(( i + 1 ))..${maxexports}} ; do
            [[ -n ${(P)${:-vcs_info_msg_${j}_}} ]] && typeset -gx vcs_info_msg_${j}_=
        done
    fi
    return 0
    PK[~~66functions/_vimnuW+A#compdef vim exim gvim gex gview rvim rview rgvim rgview evim eview vimdiff gvimdiff
    
    (( $+functions[_vim_files] )) ||
    _vim_files () {
      case $PREFIX in
        (+*) _files -P './' $* && return 0 ;;
        (*) _files $* ;;
      esac
      case $PREFIX in
        (+) _message -e 'start at a given line (default: end of file)' ;;
        (+<1->) _message -e 'line number' ;;
      esac
    }
    
    local arguments
    
    arguments=(
      '(   -e -E -s -d -y)-v[vi mode]'
      '(-v    -E    -d -y)-e[ex mode]'
      '(-v -e       -d -y)-E[improved ex mode]'
      '(-v -e -E -s    -y)-d[diff mode]'
      '(-v -e -E -s -d   )-y[easy mode]'
      '-R[readonly mode]'
      '-Z[restricted mode]'
      '-m[modifications (writing files) not allowed]'
      '-M[modifications in text not allowed]'
      '-b[binary mode]'
      '-g[start with GUI]'
      '-l[lisp mode]'
      '-C[start in compatible mode]'
      '-N[start in incompatibile mode]'
      '(--nofork -f)'{--nofork,-f}'[do not detach the GUI version from the shell]'
      '-V-[verbosity level]::verbosity:((0\:"do not display any messages"
                                         1\:"display when viminfo file is read or written"
                                         2\:"display sourced files"
                                         5\:"display every searched tag-file"
                                         8\:"display files that trigger autocommands"
                                         9\:"display every triggered autocommand (default)"
                                        12\:"display every executed function"
                                        13\:"report every thrown, caught, finished, or discarded exception"
                                        14\:"display anything pending in a \:finally clause"
                                        15\:"display every executed ex-command"))'
      '-D[debugging mode]'
      '-n[no swap file (memory only)]'
      '-nb[start as NetBean server]'
      {-r,-L}'[list swap files and exit or recover from a swap file]::swap file:_vim_files -g \*.sw\?'
      '(   -H -F)-A[start in Arabic mode]'
      '(-A    -F)-H[start in Hebrew mode]'
      '(-A -H   )-H[start in Farsi mode]'
      '-T[set terminal type]:::_terminals'
      '-u[use given vimrc file instead of default .vimrc]::rc file:_files'
      '-U[use given gvimrc file instead of default .gvimrc]::rc file:_files'
      '--noplugin[do not load plugin scripts]'
      '-o-[number of windows to open (default: one for each file)]::window count: '
      '-O-[number of windows to vertically split open (default is one for each file)]::window count: '
      '-p-[number of tabs to open (default: one for each file)]::tab count: '
      '-q-[quickfix file]:*:file:_vim_files'
      '*--cmd[execute given command before loading any RC files]:command: '
      '-c[execute given command after loading the first file]:command: '
      '-S[source a session file after loading the first file]:session file:_files'
      '-s[read normal-mode commands from script file]:script file:_files'
      '-w[append all typed commands to given file]:output file:_files'
      '-W[write all typed commands to given file, overwriting existing file]:output file:_files'
      '-x[edit encrypted files]'
      '-X[do not connect to X server]'
      '--remote[edit given files in a vim server if possible]:*:file:_vim_files'
      '--remote-silent[as --remote but without complaining if not possible]:*:file:_vim_files'
      '--remote-wait[as --remote but wait for files to have been edited]:*:file:_vim_files'
      '--remote-wait-silent[as --remote-wait but without complaining if not possible]:*:file:_vim_files'
      '--remote-send[send given keys to vim server if possible]:keys: '
      '--remote-tab[as --remote but open tab page for each file]:*:file:_vim_files'
      '--remote-tab-silent[as --remote-silent but open tab page for each file]:*:file:_vim_files'
      '--remote-tab-wait[as --remote-wait but open tab page for each file]:*:file:_vim_files'
      '--remote-tab-wait-silent[as --remote-wait-silent but open tab page for each file]:*:file:_vim_files'
      '--remote-expr[evaluate given expression in a vim server and print result]:expression: '
      '--echo-wid[echo window ID on STDOUT, GUI version only]'
      '--literal[do not expand wildcards in arguments (this is useless with ZSH)]'
      '(- *)--serverlist[list available vim servers and exit]'
      '--servername[name of vim server to send to or name of server to become]:server name: '
      '--startuptime[write startup timing messages to given file]:log file:_files'
      '--socketid[run GVIM in another window]'
      '-i[use given viminfo file instead of default .viminfo]:viminfo file:_files'
      '(- *)'{-h,--help}'[print help and exit]'
      '(- *)--version[print version information and exit]'
      '(*)-t[edit file where tag is defined]:tag:_complete_tag'
      '(-t)*:file:_vim_files'
    )
    
    _arguments -S $arguments
    PK[66functions/_kvnonuW+A#compdef kvno
    
    local curcontext="$curcontext" state line ret=1
    
    _arguments -C \
      '(-4)-c[specify credentials cache to use]:cache:_files' \
      '(-4)-e[specify encryption type]:encryption type' \
      '-q[suppress printing]' \
      '(- :)-h[display help information]' \
      '(-c -e)-4[kerberos 4 tickets]' \
      ':principal:->principal' && ret=0
    
    if [[ $state = principal ]]; then
      if [[ -prefix host/ ]]; then
        compset -P host/
        _hosts && ret=0
      else
        _alternative \
          'users:user:_users' \
          'services:service:compadd -S/ host' && ret=0
      fi
    fi
    
    return ret
    PK[tfunctions/_pfexecnuW+A#compdef pfexec
    
    # This is a _values-like function that completes privileges and !-prefixed
    # privileges, comma-separated, and unique.
    _privset() {
    	local expl p
    	local -a privs
    
    	privs=( ${(f)"$(ppriv -l)"} all none zone basic )
    
    	# Ignore existing values
    	compset -P '*,'
    	# Ignore a leading !, maybe backslash-quoted
    	compset -P '\\#!'
    
    	# Remove already-referenced privs
    	for p in ${(s:,:)${IPREFIX//\\#\!/}}; do
    		privs=( ${privs:#$p} )
    	done
    
    	_wanted privs expl 'privilege' compadd -qS , -a privs
    }
    
    _pfexec() {
     	_arguments \
    		'-P[privileges to acquire]:privspec:_privset' \
     		'(-):command name: _command_names -e' \
     		'*::arguments: _normal'
    }
    
    _pfexec "$@"
    PK[R|M{{functions/_oldlistnuW+A#autoload
    
    [[ _matcher_num -gt 1 || $_lastcomp[nmatches] -eq 0 ]] && return 1
    
    local list
    
    zstyle -s ":completion:${curcontext}:" old-list list
    
    # If this is a listing widget and there is already an old list,
    # and either the style :oldlist:old-list is `always', or it is not `never'
    # and the list is not already shown, then use the existing list for listing
    # (even if it was generated by another widget).
    # Do this also if there is an old list and it was generated by the
    # completer named by the oldlist_list key.
    
    if [[ -n $compstate[old_list] && $list != never &&
          $LASTWIDGET != _complete_help && $WIDGET != _complete_help ]]; then
      if [[ $WIDGETSTYLE = *list* && ( $list = always || $list != shown ) ]]; then
        compstate[old_list]=keep
        return 0
      elif [[ $list = *${_lastcomp[completer]}* ]]; then
        [[ "$_lastcomp[insert]" = unambig* ]] && compstate[to_end]=single
        compstate[old_list]=keep
        if [[ -o automenu ]]; then
          compstate[insert]=menu
        else
          compadd -Qs "$SUFFIX" - "$PREFIX"
        fi
        return 0
      fi
    fi
    
    # If this is a completion widget, and we have a completion inserted already,
    # and the style :oldlist:old-menu is `true', then we cycle through the
    # existing list (even if it was generated by another widget).
    
    if [[ -z $compstate[old_insert] && -n $compstate[old_list] &&
          ( $_lastcomp[nmatches] -ne 0 || $WIDGET != $LASTWIDGET ) &&
          $LASTWIDGET != _complete_help && $WIDGET != _complete_help ]]; then
      compstate[old_list]=keep
      return 0
    elif [[ $WIDGETSTYLE = *complete(|-prefix|-word) ]] &&
         zstyle -T ":completion:${curcontext}:" old-menu; then
      if [[ -n $compstate[old_insert] ]]; then
        compstate[old_list]=keep
        if [[ $WIDGETSTYLE = *reverse* ]]; then
          compstate[insert]=$(( compstate[old_insert] - 1 ))
        else
          compstate[insert]=$(( compstate[old_insert] + 1 ))
        fi
      else
        return 1
      fi
      return 0
    fi
    
    return 1
    PK[B.lfunctions/_muttnuW+A#compdef mutt
    
    _arguments -s \
      '::recipient:_email_addresses -n mutt' \
      '*-a[attach file using MIME]:file attachment:_files' \
      '*-b[specify a BCC recipient]:BCC recipient:_email_addresses -n mutt' \
      '*-c[specify a CC recipient]:CC recipient:_email_addresses -n mutt' \
      '-e+[specify a post-init configuration command]:post-init configuration:' \
      '-f+[specify mailbox to load]:mailbox: _mailboxes' \
      '-F+[specify an init file]:init file:_files' \
      '-h[display help]' \
      '-H+[specify a draft file for message]:draft file:_files' \
      '-i+[specify file to include in message]:include file:_files' \
      '-m+[specify default mailbox type]:mailbox type:(mbox MMDF MH Maildir)' \
      '-n[bypass system configuration]' \
      '-p[resume postponed message]' \
      '-R[open in read-only mode]' \
      '-s+[specify a subject]:subject:' \
      '-v[display mutt version]' \
      '-x[emulate mailx compose]' \
      '-y[start listing mailboxes]' \
      '-z[start only if new messages]' \
      '-Z[open first mailbox with new mail]'
    PK[Kfunctions/prompt_adam2_setupnuW+A# adam2 prompt theme
    
    prompt_adam2_help () {
      cat <<'EOF'
    This prompt is color-scheme-able.  You can invoke it thus:
    
      prompt adam2 [ 8bit ] [ [ [] []]
    
    where the colors are for the hyphens, current directory, user@host,
    and user input bits respectively.  The default colors are cyan, green,
    cyan, and white.  This theme works best with a dark background.
    
    If you have either UTF-8 or the `nexus' or `vga' console fonts or similar,
    you can specify the `8bit' option to use 8-bit replacements for the
    7-bit characters.
    
    And you probably thought adam1 was overkill ...
    EOF
    }
    
    prompt_adam2_setup () {
      # Some can't be local
      local prompt_gfx_tlc prompt_gfx_mlc prompt_gfx_blc
    
      if [[ $1 == '8bit' ]]; then
        shift
        if [[ ${LC_ALL:-${LC_CTYPE:-$LANG}} = *UTF-8* ]]; then
          prompt_gfx_tlc=$'\xe2\x94\x8c'
          prompt_gfx_mlc=$'\xe2\x94\x9c'
          prompt_gfx_blc=$'\xe2\x94\x94'
          prompt_gfx_hyphen=$'\xe2\x94\x80'
        else
          prompt_gfx_tlc=$'\xda'
          prompt_gfx_mlc=$'\xc3'
          prompt_gfx_blc=$'\xc0'
          prompt_gfx_hyphen=$'\xc4'
        fi
      else
        prompt_gfx_tlc='.'
        prompt_gfx_mlc='|'
        prompt_gfx_blc='\`'
        prompt_gfx_hyphen='-'
      fi
    
      # Colour scheme
      prompt_adam2_color1=${1:-'cyan'}    # hyphens
      prompt_adam2_color2=${2:-'green'}   # current directory
      prompt_adam2_color3=${3:-'cyan'}    # user@host
      prompt_adam2_color4=${4:-'white'}   # user input
    
      local prompt_gfx_bbox 
      prompt_gfx_tbox="%B%F{$prompt_adam2_color1}${prompt_gfx_tlc}%b%F{$prompt_adam2_color1}${prompt_gfx_hyphen}"
      prompt_gfx_bbox="%B%F{$prompt_adam2_color1}${prompt_gfx_blc}${prompt_gfx_hyphen}%b%F{$prompt_adam2_color1}"
    
      # This is a cute hack.  Well I like it, anyway.
      prompt_gfx_bbox_to_mbox=$'%{\e[A\r'"%}%B%F{$prompt_adam2_color1}${prompt_gfx_mlc}%b%F{$prompt_adam2_color1}${prompt_gfx_hyphen}%{"$'\e[B%}'
    
      prompt_l_paren="%B%F{black}("
      prompt_r_paren="%B%F{black})"
    
      prompt_user_host="%b%F{$prompt_adam2_color3}%n%B%F{$prompt_adam2_color3}@%b%F{$prompt_adam2_color3}%m"
    
      prompt_line_1a="$prompt_gfx_tbox$prompt_l_paren%B%F{$prompt_adam2_color2}%~$prompt_r_paren%b%F{$prompt_adam2_color1}"
      prompt_line_1b="$prompt_l_paren$prompt_user_host$prompt_r_paren%b%F{$prompt_adam2_color1}${prompt_gfx_hyphen}"
    
      prompt_line_2="$prompt_gfx_bbox${prompt_gfx_hyphen}%B%F{white}"
    
      prompt_char="%(!.#.>)"
    
      prompt_opts=(cr subst percent)
    
      add-zsh-hook precmd prompt_adam2_precmd
    }
    
    prompt_adam2_precmd() {
      setopt noxtrace localoptions extendedglob
      local prompt_line_1
    
      prompt_adam2_choose_prompt
    
      PS1="$prompt_line_1$prompt_newline$prompt_line_2%B%F{white}$prompt_char %b%f%k"
      PS2="$prompt_line_2$prompt_gfx_bbox_to_mbox%B%F{white}%_> %b%f%k"
      PS3="$prompt_line_2$prompt_gfx_bbox_to_mbox%B%F{white}?# %b%f%k"
      zle_highlight[(r)default:*]="default:fg=$prompt_adam2_color4,bold"
    }
    
    prompt_adam2_choose_prompt () {
      local prompt_line_1a_width=${#${(S%%)prompt_line_1a//(\%([KF1]|)\{*\}|\%[Bbkf])}}
      local prompt_line_1b_width=${#${(S%%)prompt_line_1b//(\%([KF1]|)\{*\}|\%[Bbkf])}}
    
      local prompt_padding_size=$(( COLUMNS
                                      - prompt_line_1a_width
                                      - prompt_line_1b_width ))
    
      # Try to fit in long path and user@host.
      if (( prompt_padding_size > 0 )); then
        local prompt_padding
        eval "prompt_padding=\${(l:${prompt_padding_size}::${prompt_gfx_hyphen}:)_empty_zz}"
        prompt_line_1="$prompt_line_1a$prompt_padding$prompt_line_1b"
        return
      fi
    
      prompt_padding_size=$(( COLUMNS - prompt_line_1a_width ))
    
      # Didn't fit; try to fit in just long path.
      if (( prompt_padding_size > 0 )); then
        local prompt_padding
        eval "prompt_padding=\${(l:${prompt_padding_size}::${prompt_gfx_hyphen}:)_empty_zz}"
        prompt_line_1="$prompt_line_1a$prompt_padding"
        return
      fi
    
      # Still didn't fit; truncate 
      local prompt_pwd_size=$(( COLUMNS - 5 ))
      prompt_line_1="$prompt_gfx_tbox$prompt_l_paren%B%F{$prompt_adam2_color2}%$prompt_pwd_size<...<%~%<<$prompt_r_paren%b%F{$prompt_adam2_color1}$prompt_gfx_hyphen"
    }
    
    prompt_adam2_setup "$@"
    PK[#44functions/_yafcnuW+A# compdef yafc
    
    _yafc() {
        local arguments
        arguments=(
        '(--anon -a)'{--anon,-a}'[try an anonymous login]'
        '(--debug -d)'{--debug,-d}'[print all messages to/from server]'
        '(--dump-rc -D)'{--dump-rc,-D}'[print the default configuration file]'
        '(--mechanism -m)'{--mechanism=-,-m}'[specify a security mechanism]:security mechanism:(krb4, krb5, none)'
        '(--norc -n)'{--norc,-n}'[do not read the users configuration file]'
        '(--noproxy -p)'{--noproxy,-p}'[do not connect via the proxy]'
        '(--quiet -q)'{--quiet,-q}'[do not print the welcome message]'
        '(--rcfile -r)'{--rcfile=-,-r}'[specify a configuration file]:configuration file:_files'
        '(--trace -t)'{--trace=-,-t-}'[specify a trace file]:trace file:_files'
        '(--noauto -u)'{--noauto,-u}'[do not login automagically]'
        '(--noalias -U)'{--noalias,-U}'[as --noauto, but bookmark aliases is disabled]'
        '(--verbose -v)'{--verbose,-v}'[print all responses received]'
        '(--wait -w)'{--wait,-w=}'[specify a waiting time between connection attempts]:wait time: '
        '(--workdir -W)'{--workdir=,-W+}'[use a different working directory]:working directory:_directories'
        '(--version -V)'{--version,-V}'[print version information]'
        '(--help -h)'{--help,-h}'[print a short help description]'
        '*:address:_yafc_address'
        )
    
        _arguments -S -s $arguments
    }
    
     (( $+functions[_yafc_bookmarks] )) ||
    _yafc_bookmarks() {
        local bkmfile=~/.yafc/bookmarks
        
        if [[ -f $bkmfile ]]; then
            local -a bkms
            bkms=(${${${(M)"${(f)$(<$bkmfile)}":#machine*alias ##\'*\' #}##machine*alias ##\'}%%\' #}) #" vim syntax goes crazy
            _wanted bookmarks expl 'bookmarks' compadd "$@" -a - bkms
        fi
    }
    
     (( $+functions[_yafc_address] )) ||
    _yafc_address() {
      _alternative 'bookmarks:bookmark:_yafc_bookmarks' '_hosts'
    }
    
    _yafc "$@"
    PK[.Oyssfunctions/_ethtoolnuW+A#compdef ethtool
    
    local -a cmds
    
    if [[ $CURRENT -ge 4 ]]; then
    	case $words[CURRENT-1]; in
    	  rx|tx)
    		if [[ $words[2] = '-G' ]] && _message -e n 'number of ring entries' || _wanted -x onoff expl 'enabled' compadd off on
    	  ;;
    	  autoneg|adaptive-rx|adaptive-tx|raw|hex|sg|tso|ufo|gso)
    		_wanted -x onoff expl 'enabled' compadd off on
    	  ;;
    	  rx-usecs|rx-frames|rx-usecs-irq|rx-frames-irq|tx-usecs|tx-frames|tx-usecs-irq|tx-frames-irq|stats-block-usecs|pkt-rate-low|rx-usecs-low|rx-frames-low|tx-usecs-low|tx-frames-low|pkt-rate-high|rx-usecs-high|rx-frames-high|tx-usecs-high|tx-frames-high|sample-interval|rx-mini|rx-jumbo|offset|length|magic|value|phyad|msglvl)
    		_message -e n 'number'
    	  ;;
    	  speed)
    		_wanted -x speed expl 'speed' compadd 10 100 1000
    	  ;;
    	  duplex)
    		_wanted -x duplex expl 'duplex mode' compadd half full
    	  ;;
    	  port)
    		_wanted -x port expl 'device port' compadd tp aui bnc mii
    	  ;;
    	  advertise)
    		_values 'hexidecimal value (or a combination of the following)' \
    			'0x001[10 half]' \
    			'0x002[10 full]' \
    			'0x004[100 half]' \
    			'0x008[100 full]' \
    			'0x010[1000 half(not supported by IEEE standards)]' \
    			'0x020[1000 full]' \
    			'0x8000[2500 full(not supported by IEEE standards)]' \
    			'0x800[10000 full]' \
    			'0x03F[auto]'
    	  ;;
    	  xcvr)
    		_wanted -x xcvr expl 'transceiver type' compadd internal external
    	  ;;
    	  wol)
    		_values -s '' 'Wake-on-LAN options' \
    			'(d)p[wake on phy activity]' \
    			'(d)u[wake on unicast messages]' \
    			'(d)m[wake on multicast messages]' \
    			'(d)b[wake on broadcast messages]' \
    			'(d)a[wake on ARP]' \
    			'(d)g[wake on MagicPacket(tm)]' \
    			'(d)s[enable SecureOn(tm) password for MagicPacket(tm)]' \
    			'(p u m b a g s)d[disable (wake on nothing)]'
    	  ;;
    	  sopass)
    		_message -e secureon 'password - 6 bytes in ethernet MAC hex format (xx:yy:zz:aa:bb:cc)'
    	  ;;
    	  file)
    		_wanted files expl 'raw register dump files' _files
    	  ;;
    	  *)
    	case $words[2]; in
    	  -A|--pause)
    		_values -S ' ' -w 'pause options' \
    			'autoneg[specify if pause autonegotiation is enabled]' \
    			'rx[specify if RX pause is enabled]' \
    			'tx[specify if TX pause is enabled]'
    	  ;;
    	  -C|--coalesce)
    		_values -S ' ' -w 'coalescing settings' \
    			'adaptive-rx' 'adaptive-tx' \
    			'rx-usecs' 'rx-frames' 'rx-usecs-irq' 'rx-frames-irq' \
    			'tx-usecs' 'tx-frames' 'tx-usecs-irq' 'tx-frames-irq' \
    			'stats-block-usecs' \
    			'pkt-rate-low' \
    			'rx-usecs-low' 'rx-frames-low' \
    			'tx-usecs-low' 'tx-frames-low' \
    			'pkt-rate-high' \
    			'rx-usecs-high' 'rx-frames-high' \
    			'tx-usecs-high' 'tx-frames-high' \
    			'sample-interval'
    	  ;;
    	  -G|--set-ring)
    		_values -S ' ' -w 'ring parameters' \
    			'rx[change number of ring entries for the RX ring]' \
    			'rx-mini[change number of ring entries for the RX Mini ring]' \
    			'rx-jumbo[change number of ring entries for the RX Jumbo ring]' \
    			'tx[change number of ring entries for the TX ring]'
    	  ;;
    	  -d|--register-dump)
    		_values -S ' ' -w 'register dump options' \
    			'hex[dump hex register data]' \
    			'raw[dump raw register data]' \
    			'file[use contents from file rather than device]'
    	  ;;
    	  -e|--eeprom-dump)
    		_values -S ' ' -w 'EEPROM dump options' \
    			'raw[dump raw EEPROM data]' \
    			'offset[dump certain portions of the EEPROM]' \
    			'length[dump certain portions of the EEPROM]'
    	  ;;
    	  -E|--change-eeprom)
    		_values -S ' ' -w 'EEPROM values' \
    			'magic[device-specific key]' \
    			'offset[select byte]' \
    			'value[new value]'
    	  ;;
    	  -K|--offload)
    		_values -S ' ' -w 'offload options' \
    			'rx[specify if RX checksumming is enabled]' \
    			'tx[specify if TX checksumming is enabled]' \
    			'sg[specify if scatter-gather is enabled]' \
    			'tso[specify if TCP segmentation offload is enabled]' \
    			'ufo[specify if UDP segmentation offload is enabled]' \
    			'gso[specify if generic segmentation offload is enabled]'
    	  ;;
    	  -p|--identify)
    		if [[ $CURRENT -eq 4 ]] && _message -e length 'seconds'
    	  ;;
    	  -t|--test)
    		_values -S ' ' -w 'selftest option' \
    			'(online)offline:perform full set of tests possibly causing normal operation interruption (default)]' \
    			'(offline)online:perform limited set of tests do not interrupting normal adapter operation]'
    	  ;;
    	  -s|--change)
    		_values -S ' ' -w 'change setting' \
    			'speed[set speed in Mb/s]' \
    			'duplex[set full or half duplex mode]' \
    			'port[select device port]' \
    			'autoneg[specify if autonegotiation is enabled]' \
    			'advertise[set the speed and duplex advertised by autonegotiation]' \
    			'phyad[PHY address]' \
    			'xcvr[select transceiver type]' \
    			'wol[set Wake-on-LAN options]' \
    			'sopass[set the SecureOn(tm) password]' \
    			'msglvl[set the driver message level]'
    	  ;;
    	esac
    	  ;;
    	esac
    fi
    
    cmds=(-h -a -A -c -C -g -G -i -d -e -E -k -K -p -r -S -t -s
    	--help --show-pause --pause --show-coalesce --coalesce --show-ring
    	--set-ring --driver --register-dump --eeprom-dump --change-eeprom
    	--show-offload --offload --identify --negotiate --statistics --test --change)
    
    _arguments \
    	"($cmds)1:interface:_net_interfaces" \
    	"($cmds 1)"{-h,--help}'[shows a short help message]' \
    	"($cmds)"{-a,--show-pause}'[queries the specified ethernet device for pause parameter information]' \
    	"($cmds)"{-A,--pause}'[change the pause parameters of the specified ethernet device]' \
    	"($cmds)"{-c,--show-coalesce}'[queries the specified ethernet device for coalescing information]' \
    	"($cmds)"{-C,--coalesce}'[change the coalescing settings of the specified ethernet device]' \
    	"($cmds)"{-g,--show-ring}'[queries the specified ethernet device for RX/TX ring parameter information]' \
    	"($cmds)"{-G,--set-ring}'[change the RX/TX ring parameters of the specified ethernet device]' \
    	"($cmds)"{-i,--driver}'[queries the specified ethernet device for associated driver information]' \
    	"($cmds)"{-d,--register-dump}'[retrieves and prints a register dump for the specified ethernet device]' \
    	"($cmds)"{-e,--eeprom-dump}'[retrieves and prints an EEPROM dump for the specified ethernet device]' \
    	"($cmds)"{-E,--change-eeprom}'[changes EEPROM byte for the specified ethernet device]' \
    	"($cmds)"{-k,--show-offload}'[queries the specified ethernet device for offload information]' \
    	"($cmds)"{-K,--offload}'[change the offload parameters of the specified ethernet device]' \
    	"($cmds)"{-p,--identify}'[initiates adapter-specific action intended to identify the adapter by sight]' \
    	"($cmds)"{-r,--negotiate}'[restarts auto-negotiation on the specified ethernet device]' \
    	"($cmds)"{-S,--statistics}'[queries the specified ethernet device for NIC- and driver-specific statistics]' \
    	"($cmds)"{-t,--test}'[executes adapter selftest on the specified ethernet device]' \
    	"($cmds)"{-s,--change}'[allows changing some or all settings of the specified ethernet device]' \
    	'*:' && ret=0
    PK[8Cxccfunctions/_zcatnuW+A#compdef zcat
    
    if _pick_variant gnu=GNU unix --license; then
      _gzip "$@"
    else
      _compress "$@"
    fi
    PK[ˆ|functions/thrownuW+A# Throw an exception.
    # The first argument is a string giving the exception.  Other arguments
    # are ignored.
    #
    # This is designed to be called somewhere inside a "try-block", i.e.
    # some code of the form:
    #   {
    #     # try-block
    #   } always {
    #     # always-block
    #   }
    # although as normal with exceptions it might be hidden deep inside
    # other code.  Note, however, that it must be code running within the
    # current shell; with shells, unlike other languages, it is quite easy
    # to miss points at which the shell forks.
    #
    # If there is nothing to catch an exception, this behaves like any
    # other shell error, aborting to the command prompt or abandoning a
    # script.
    
    # The following must not be local.
    typeset -g EXCEPTION="$1"
    readonly THROW
    if (( TRY_BLOCK_ERROR == 0 )); then
      # We are throwing an exception from the middle of an always-block.
      # We can do this by restoring the error status from the try-block.
      (( TRY_BLOCK_ERROR = 1 ))
    fi
    # Raise an error, but don't show an error message.
    THROW= 2>/dev/null
    PK[;i}functions/_mailnuW+A#compdef mail mailx=mail Mail=mail mush zmail nail=mail
    
    _arguments -s \
      '(-f -u)*-b[specify a BCC recipient]:BCC recipient:->userhost' \
      '(-f -u)*-c[specify a CC recipient]:CC recipient:->userhost' \
      '(-b -c -u -s *)-f+[specify mail folder]:mailbox:_mailboxes' \
      '(-f -u)-s+[specify a subject]:subject:' \
      "(-b -c -f -s *)-u+[read specified user's mail]:user:_users" \
      "(-f -u)*:recipient:_email_addresses -n $service"
    PK[KP$functions/cycle-completion-positionsnuW+A# This may be called after a completion that inserted the unambiguous
    # (i.e. non-menu- and non-single-match-) string into the command line.
    # If there are multiple positions in the string with missing or differing
    # characters, repeatedly calling this widget cycles between all these
    # positions.
    
    emulate -L zsh
    setopt extendedglob
    
    local p="$_lastcomp[insert_positions]"
    
    if [[ $p = ((#s)|*:)${CURSOR}:* ]]; then
      CURSOR=${${p#(|*:)${CURSOR}:}%%:*}
    elif [[ -n $p ]]; then
      CURSOR=${p%%:*}
    fi
    PK[rr
    functions/zednuW+A#!/bin/zsh
    # zed
    #
    # No other shell could do this.
    # Edit small files with the command line editor.
    # Use ^X^W to save, ^C to abort.
    # Option -f: edit shell functions.  (Also if called as fned.)
    
    local var opt zed_file_name
    # We do not want timeout while we are editing a file
    integer TMOUT=0 okargs=1 fun bind
    
    while getopts "fb" opt; do
      case $opt in
        (f)
        fun=1
        ;;
    
        (b)
        bind=1
        ;;
      esac
    done
    shift $(( OPTIND - 1 ))
    
    [[ $0 = fned ]] && fun=1
    (( bind )) && okargs=0
    
    if (( $# != okargs )); then
        echo 'Usage:
    zed filename
    zed -f function
    zed -b'
        return 1
    fi
    
    local curcontext=zed:::
    
    zstyle -m ":completion:zed:*" insert-tab '*' ||
        zstyle ":completion:zed:*" insert-tab yes
    
    if (( bind )) || ! bindkey -M zed >&/dev/null; then
      # Make the zed keymap a copy of the current main.
      bindkey -N zed main
      # Save the current main.  In zle widgets called from
      # zed we may want to set this temporally.
      bindkey -A main zed-normal-keymap
    
      # Assign some default keys.
      # Depending on your stty's, you may be able to use ^J as accept-line, else:
    
      # The following isn't useful if we are copying viins, but that's
      # a nicety.
      bindkey -M zed '^x^w' accept-line
      bindkey -M zed '^M' self-insert-unmeta
    
      # Make zed-set-file-name available.
      # Assume it's in fpath; there's no error at this point if it isn't
      autoload -Uz zed-set-file-name
      zle -N zed-set-file-name
    fi
    if (( bind )) || ! bindkey -M zed-vicmd >&/dev/null; then
      bindkey -N zed-vicmd vicmd
    
      bindkey -M zed-vicmd "ZZ" accept-line
    fi
    
    (( bind )) && return 0
    
    # don't mangle !'s
    setopt localoptions nobanghist
    
    if ((fun)) then
      var="$(functions $1)"
      # If function is undefined but autoloadable, load it
      if [[ $var = *\#\ undefined* ]] then
        var="$(autoload +X $1; functions $1)"
      elif [[ -z $var ]] then
        var="$1() {
    }"
      fi
      vared -M zed -m zed-vicmd var && eval function "$var"
    else
      zed_file_name=$1
      [[ -f $1 ]] && var="$(<$1)"
      while vared -M zed -m zed-vicmd var
      do
        {
          print -r -- "$var" >| $zed_file_name
        } always {
          (( TRY_BLOCK_ERROR = 0 ))
        } && break
        echo -n -e '\a'
      done
    fi
    
    return 0
    
    # End of zed
    PK[pp
    functions/_dunuW+A#compdef du
    
    if _pick_variant gnu=Free\ Soft unix --version /dummy/no-such-file; then
      _arguments -s \
        '(-a --all -s --summarize)'{-a,--all}'[write counts for all files]' \
        '--apparent-size[print apparent sizes rather than disc usage]' \
        '(-B --block-size -k)'{-B,--block-size=}'[specify block size]:size (bytes)' \
        '(-B --block-size -k --apparent-size -b --bytes)'{-b,--bytes}'[equivalent to --apparent-size --block-size=1]' \
        '(-c --total)'{-c,--total}'[produce a grand total]' \
        '(-H -D --dereference-args -L --dereference -P --no-dereference)'{-H,-D,--dereference-args}'[dereference arguments that are symlinks]' \
        '(-H -D --dereference-args -L --dereference -P --no-dereference)'{-P,--no-dereference}'[do not dereference any symlinks]' \
        '(-h --human-readable -H --si)'{-h,--human-readable}'[print sizes in human readable format]' \
        '(--si -h --human-readable)--si[human readable form using powers of 1000]' \
        '(-B --block-size)-k[use block size of 1k]' \
        '(-B --block-size)-m[use block size of 1M]' \
        '(-l --count-links)'{-l,--count-links}'[count sizes many times if hard linked]' \
        '(-L --dereference -H -D --dereference-args -P --no-dereference)'{-L,--dereference}'[dereference all symlinks]' \
        '(-S --separate-dirs)'{-S,--separate-dirs}'[do not include size of subdirectories]' \
        '(-s --summarize --max-depth -a --all)'{-s,--summarize}'[only display total for each argument]' \
        '(-x --one-file-system)'{-x,--one-file-system}'[skip directories on different filesystems]' \
        '(-0 --null)'{-0,--null}'[end each output line with NUL instead of newline]' \
        \*{-X+,--exclude-from=}'[exclude files matching any pattern in file]:file:_files' \
        '*--exclude=[exclude files matching pattern]:pattern' \
        '(-s --summarize)--max-depth=[maximum levels to recurse]:levels' \
        '--files0-from=[use NUL-terminated list of files from file]:file' \
        '--time-style=[show times using given style, +FORMAT for strftime formatted args]:style:->timestyle' \
        '--time=-[show time of last modification of any file in the directory]:property:->time' \
        '(* -)--help[display help information]' \
        '(* -)--version[display version information]' \
        '*:file:_files'
    
      case $state in
        (time)
          local -a property
          property=(atime access use ctime status)
          _wanted property expl property compadd -a property
          ;;
        (timestyle)
          local -a style desc
          style=(full-iso long-iso iso +)
          desc=('full-iso' 'long-iso' 'iso' '+FORMAT like `date'\''')
          _wanted -V style expl style compadd -d desc -a style
          ;;
      esac
    
    else
      # based on $OSTYPE = solaris2.8
      local xdev='[skip directories on different filesystems]'
      if [[ ${commands[$words[1]]:-$words[1]} = *xpg4* ]]; then
        args=( -x$xdev )
      else
        args=( -d$xdev
          '-L[dereference symlinks]'
          "(-a)-o[do not add child directories' usage to parent's total]"
        )
      fi
      _arguments -s "$args[@]" \
        '(-s -o)-a[write counts for all files]' \
        '-k[use block size of 1k]' \
        '-r[notify about unreadable files/directories]' \
        '(-a)-s[only display total for each argument]' \
        '*:file:_files'
    fi
    PK[&r>>functions/_rebootinnuW+A#compdef rebootin
    
    local loader=$(sudo detectloader -q)
    
    _arguments -C -s \
        '-n[no immediate reboot just set the flags for next reboot]' \
        '-f[create a /fastboot file to reboot in fastboot mode]' \
        '*::arguments:->loader_entry'
    
    local expl
    case $state in
        loader_entry)
    	case $loader in
    	    GRUB)
    		if [ -r /boot/grub/menu.lst ];then
    		compadd ${${(M)${(f)"$(probe-opts' \
      '-A[enable OS detection and version scanning]' \
      '-O[enable remote OS identification]' \
      '-6[enable IPv6 support]' \
      '-I[enable TCP reverse ident scanning]' \
      '-f[use tiny fragmented IP  packets]' \
      '*-v[verbose mode]' \
      '-h[show help information]' \
      '*-o-[log results]:log format:->log-forms:log filename:_files' \
      '--resume[resume cancelled scan]:log filename:_files' \
      '--append_output[append results to any log files]' \
      '-iL[read target specifications from file]:file:_files' \
      '-iR[scan random hosts]:num hosts' \
      '-p[specify ports to try]:port numbers' \
      '-F[scan only ports listed in services file]' \
      '-D[perform decoy scan]:host list:->host-list' \
      '-S[specify source address]:address:_hosts' \
      '-e[specify interface to use]:network interface:_net_interfaces' \
      '-g[specify source port number]:port number' \
      '--data_length[add random data to packets]:data length' \
      '(-R)-n[skip reverse DNS to speed things up]' \
      '(-n)-R[always do reverse DNS on targets]' \
      '-r[do not ramdomize order in which ports are scanned]' \
      '-ttl[specify IPv4 time to live for sent packets]' \
      '--randomize_hosts[scan hosts in random order]' \
      '-M[specify maximum number of parallel TCP connects]:maximum TCP connects' \
      '--packet_trace[show all packets sent in tcpdump-like format]' \
      '--version_trace[show packets related to version scanning]' \
      '--datadir[specify directory containing data files]:directory:_directories' \
      '-T[specify timing policy]:timing policy:(Paranoid Sneaky Polite Normal Aggressive Insane)' \
      '--host_timeout[specify maximum time for scanning a single host]:timeout (ms)' \
      '--max_rtt_timeout[maximum time for a probe response]:timeout (ms)' \
      '--min_rtt_timeout[minimum time to wait for a probe response]:time (ms)' \
      '--initial_rtt_timeout[specify initial probe timeout]:timeout (ms)' \
      '--max_parallelism[specify max number of scans to perform in parallel]:number' \
      '--min_parallelism[scan at least specified number of ports in parallel]:number' \
      '--scan_delay[specify minimum amount of time between probes]:delay (ms)' \
      '--interactive[go into interactive mode]' \
      '*:host:_hosts' && ret=0
    
    case $state in
      probe-opts)
        _values -S '' 'probe type/option' \
          "0[don't try to ping hosts before scanning]" \
          'T[use TCP "ping"]' \
          'S[use SYN packets instead of ACK]' \
          'U[send UDP probes]' \
          'E[use a true ping]' \
          'P[use an ICMP timestamp request]' \
          'M[use a netmask request]' \
          'B[use ACK and ICMP echo in parallel]' && ret=0
      ;;
      log-forms)
        _values 'log format' \
          'N[human readable (normal)]' \
          'X[XML]' \
          'G[grepable]' \
          'A[all]' \
          'S[S|&2 && return 1
      eval "opt_$opt=1"
    done
    (( OPTIND > 1 )) && shift $(( OPTIND - 1 ))
    
    zfautocheck || return 1
    
    if [[ $ZFTP_VERBOSE = *5* ]]; then
      # should we turn it off locally?
      print "Messages with code 550 are harmless." >&2
    fi
    
    for rem in $*; do
      loc=${rem:t}
      doit=y
      remstats=()
      if [[ ! -f $loc ]]; then
        print "$loc: file not found" >&2
        stat=1
        continue
      fi
      zftp local $loc >$tmpfile
      locstats=($(<$tmpfile))
      zftp remote $rem >$tmpfile
      rstat=$?
      remstats=($(<$tmpfile))
      rm -f $tmpfile
      if [[ $rstat = 2 ]]; then
        print "Server does not implement full command set required." 1>&2
        return 1
      elif [[ $rstat = 1 ]]; then
        [[ $opt_v = 1 ]] && print New file $loc
      else
        [[ $opt_v = 1 ]] && zfuput_print
        if (( $locstats[1] != $remstats[1] )); then
          # Files have different sizes
          if [[ $locstats[2] < $remstats[2] && $opt_s != 1 ]]; then
    	[[ $opt_v != 1 ]] && zfuput_print
    	print "Remote file $rem more recent than local," 1>&2
    	print -n "but sizes are different.  Transfer anyway [y/n]? " 1>&2
    	read -q doit
          fi
        else
          # Files have same size
          if [[ $locstats[2] > $remstats[2] ]]; then
    	if [[ $opt_s != 1 ]]; then
    	  [[ $opt_v != 1 ]] && zfuput_print
    	  print "Remote file $rem has same size as local," 1>&2
    	  print -n "but remote file is older. Transfer anyway [y/n]? " 1>&2
    	  read -q doit
    	fi
          else
    	# presumably same file, so don't get it.
    	[[ $opt_v = 1 ]] && print Not transferring
    	doit=n
          fi
        fi
      fi
      if [[ $doit = y ]]; then
        zftp put $rem <$loc || stat=$?
      fi
    done
    
    (( do_close )) && zfclose
    
    return $stat
    # }
    PK[?ff
    functions/_lpnuW+A#compdef lp lpr lpq lprm
    
    local expl ret=1 printer list disp strs shown
    
    if compset -P '-[dP]' || [[ "$words[CURRENT-1]" = -[dP] ]]; then
      _printers
    else
      if [[ "$service" = (lpq|lprm) ]]; then
        if [[ "$words" = *-P* ]]; then
          printer=(-P "${${words##*-P( |)}%% *}")
        else
          printer=()
        fi
        list=( ${(M)"${(f@)$(_call_program jobs lpq $printer 2> /dev/null)}":#[0-9]*} )
    
        if (( $#list )); then
          _tags users jobs
    
          while _tags; do
            if _requested users; then
              strs=( "${(@)${(@)list##[^ 	]##[ 	]##[^ 	]##[ 	]##}%%[ 	]*}" )
              if [[ -z "$shown" ]] &&
                 zstyle -T ":completion:${curcontext}:users" verbose; then
                disp=(-ld list)
      	  shown=yes
              else
      	  disp=()
              fi
    	  _all_labels users expl user compadd "$disp[@]" -a strs ||
                  _users && ret=0
            fi
            if _requested jobs; then
              strs=( "${(@)${(@)list##[^ 	]##[ 	]##[^ 	]##[ 	]##[^ 	]##[ 	]##}%%[ 	]*}" )
              if [[ -z "$shown" ]] &&
                 zstyle -T ":completion:${curcontext}:jobs" verbose; then
                disp=(-ld list)
      	  shown=yes
              else
      	  disp=()
              fi
              _all_labels jobs expl job compadd "$disp[@]" -a strs && ret=0
            fi
            (( ret )) || return 0
          done
        else
          _message 'no print jobs'
        fi
        return 1
      else
        _pspdf
      fi
    fi
    PK[Mfunctions/_gitnuW+A#compdef git git-cvsserver git-receive-pack git-upload-archive git-upload-pack git-shell
    
    # Some parts of this completion's behaviour are configurable:
    #
    # Say, you got your own git sub-commands (git will run a program `git-foo'
    # when you run "git foo") and you want "git f" to complete that sub
    # commands name for you. You can make that sub-command know to the completion
    # via the user-command style:
    #
    #     % zstyle ':completion:*:*:git:*' user-commands foo:'description for foo'
    #
    # `user-commands' is a list style, so you can add any number of programs there.
    # The :description part is optional, so you could add all git-* programs from
    # your $path like this:
    #
    #     % zstyle ':completion:*:*:git:*' user-commands ${${(M)${(k)commands}:#git-*}/git-/}
    #
    # You could even create a function _git-foo() to handle specific completion
    # for that command.
    
    # TODO: There is still undocumented configurability in here.
    
    # TODO: All if (( words[(I)-option] )) should be turned into
    # if (( words[(I)-option] > 0 && words[(I)-option] < CURRENT )), as the user
    # may go back and want to add an option before -option and in that case should
    # be able to complete whatever may come before -option.
    
    # TODO: suggested zstyles:
    #
    # zstyle ':completion::*:git-{name-rev,add,rm}:*' ignore-line true
    
    _git() {
    local nul_arg abbrev_arg find_copies_harder_arg diff_l_arg pretty_arg exec_arg
    local author_conversion_file_arg long_author_conversion_file_arg verbose_arg
    local help_arg template_arg shared_arg thin_arg author_conversion_file_arg_spec
    local -a diff_args fetch_args merge_args force_ref_arg tags_fetch_arg
    local -a upload_pack_arg common_fetch_args common_apply_args
    local -a revision_arguments
    
    nul_arg='-z[use NUL termination on output]'
    abbrev_arg='--abbrev=-[set minimum SHA1 display-length]: :_guard "[[\:digit\:]]#" length'
    find_copies_harder_arg='--find-copies-harder[try harder to find copies]'
    diff_l_arg='-l-[limit number of rename/copy targets to run]: :_guard "[[\:digit\:]]#" number'
    
    diff_args=(
      '--diff-filter=-[select certain kinds of files for diff]: :_guard "[ACDMRTUXB*]#" kinds'
      $find_copies_harder_arg
      '(--name-only --name-status -u -p --stat --patch-with-stat --patch-with-raw --raw --numstat --shortstat --summary)--name-only[show only names of changed files]'
      '(--name-only --name-status -u -p --stat --patch-with-stat --patch-with-raw --raw --numstat --shortstat --summary)--name-status[show only names and status of changed files]'
      '(--name-only --name-status -u -p --stat --patch-with-stat --patch-with-raw --raw --numstat --shortstat --summary)'{-u,-p}'[generate diff in patch format]'
      '(--name-only --name-status -u -p --stat --patch-with-stat --patch-with-raw --raw --numstat --shortstat --summary)--stat=-[generate a diffstat instead of a patch]:: :__git_guard_diff-stat-width' \
      '(--name-only --name-status -u -p --stat --patch-with-stat --patch-with-raw --raw --numstat --shortstat --summary)--patch-with-stat[generate patch and prepend its diffstat]' \
      '(--name-only --name-status -u -p --stat --patch-with-stat --patch-with-raw --raw --numstat --shortstat --summary)--patch-with-raw[generate patch but also keep the default raw diff output]' \
      '(--name-only --name-status -u -p --stat --patch-with-stat --patch-with-raw --raw --numstat --shortstat --summary)--raw[generate the default raw diff output]' \
      '(--name-only --name-status -u -p --stat --patch-with-stat --patch-with-raw --raw --numstat --shortstat --summary)--numstat[generate a more machine-friendly diffstat]' \
      '(--name-only --name-status -u -p --stat --patch-with-stat --patch-with-raw --raw --numstat --shortstat --summary)--shortstat[generate a summary diffstat]' \
      '(--name-only --name-status -u -p --stat --patch-with-stat --patch-with-raw --raw --numstat --shortstat --summary)--summary[generate a condensed summary of extended header information]' \
      '(--name-only --name-status -u -p --stat --patch-with-stat --patch-with-raw --raw --numstat --shortstat --summary)--dirstat[generate a dirstat by amount of changes]' \
      '(--name-only --name-status -u -p --stat --patch-with-stat --patch-with-raw --raw --numstat --shortstat --summary)--dirstat-by-file[generate a dirstat by number of files]' \
      '-B-[break complete rewrite changes into pairs of given size]: :_guard "[[\:digit\:]]#" size'
      '-C-[detect copies as well as renames with given scope]: :_guard "[[\:digit\:]]#" size'
      $diff_l_arg
      '-M-[detect renames with given scope]: :_guard "[[\:digit\:]]#" size'
      '-O-[output patch in the order of glob-pattern lines in given file]:file:_files'
      '-R[do a reverse diff]'
      '-S-[look for differences that contain the given string]:string'
      '--pickaxe-all[when -S finds a change, show all changes in that changeset]'
      '--pickaxe-regex[treat argument of -S as regular expression]'
      '--full-index[show full object name of pre- and post-image blob]'
      '(--full-index)--binary[in addition to --full-index, output binary diffs for git-apply]'
      '(        --no-color --color-words)--color[show colored diff]'
      '(--color            --color-words)--no-color[turn off colored diff]'
      '(--color --no-color              )--color-words[show colored-word diff]'
      '--no-renames[turn off rename detection]'
      '--check[warn if changes introduce trailing whitespace or space/tab indents]'
      '(-a --text)'{-a,--text}'[treat all files as text]'
      '(-b --ignore-space-change -w --ignore-all-space)'{-b,--ignore-space-change}'[ignore changes in amount of white space]'
      '(-b --ignore-space-change -w --ignore-all-space)'{-w,--ignore-all-space}'[ignore white space when comparing lines]'
      '(-1 --base)'{-1,--base}'[diff against stage 1]'
      '(-2 --ours)'{-2,--ours}'[diff against stage 2]'
      '(-3 --theirs)'{-3,--theirs}'[diff against stage 3]'
      $abbrev_arg
      $nul_arg
      '--exit-code[report exit code 1 if differences, 0 otherwise]'
      '--unified=[generate diffs with n lines of context]:n'
      '--inter-hunk-context=[combine hunks closer than n lines]:n'
      '--patience[generate diffs with patience algorithm]'
      '(--exit-code)--quiet[disable all output]'
      '--relative=:path:_files -/'
    )
    
    pretty_arg='--pretty=-[pretty print commit messages]::pretty print:((raw\:"the raw commits"
                                                                         medium\:"most parts of the messages"
                                                                         short\:"few headers and only subject of messages"
                                                                         full\:"all parts of the commit messages"
                                                                         fuller\:"like full and includes dates"
                                                                         email\:"use email headers like From and Subject"
                                                                         oneline\:"commit-ids and subject of messages"))'
    
    exec_arg='--exec=-[specify path to git-upload-pack on remote side]:remote path'
    
    fetch_args=(
      '-c[fetch commit objects]'
      '-t[fetch trees associated with commit objects]'
      '-a[fetch all objects]'
      '-v[show what is downloaded]'
      '-w[write commit-id into the filename under "$GIT_DIR/refs/"]:filename'
      '--recover[recover from a failed fetch]'
    )
    
    # TODO: Add descriptions to strategies (stupid is undocumented).
    merge_args=(
      '(-n --no-stat)'{-n,--no-stat}'[do not show diffstat at the end of the merge]'
      '--stat[show a diffstat at the end of the merge]'
      '--no-commit[perform the merge but do not autocommit]'
      '--squash[merge, but do not make a commit]'
      '--log[fill in one-line descriptions of the commits being merged in the log message]'
      '--no-log[do not list one-line descriptions of the commits being merged in the log message]'
      '--no-ff[generate a merge commit even if the merge resolved as a fast-forward]'
      '--ff[do not generate a merge commit if the merge resolved as a fast-forward]'
      '*'{-s,--strategy=-}'[use given merge strategy]:merge strategy:__git_merge_strategies'
    )
    
    force_ref_arg=('(-f --force)'{-f,--force}'[allow refs that are not ancestors to be updated]')
    
    tags_fetch_arg=(
      '(--no-tags -t --tags)--no-tags[disable automatic tag following]'
      '(--no-tags -t --tags)'{-t,--tags}'[fetch remote tags]'
    )
    
    author_conversion_file_arg_spec='[specify author-conversion file]:author-conversion file:_files'
    
    author_conversion_file_arg='-A'$author_conversion_file_arg_spec
    
    long_author_conversion_file_arg='--authors-file=-'$author_conversion_file_arg_spec
    
    verbose_arg='-v[produce verbose output]'
    
    help_arg='-h[display usage information]'
    
    upload_pack_arg=('(-u --upload-pack)'{-u,--upload-pack=-}'[specify path to git-upload-pack on remote side]:remote path')
    
    common_fetch_args=(
      '(-a --append)'{-a,--append}'[append ref names and object names of fetched refs to "$GIT_DIR/FETCH_HEAD"]'
      $upload_pack_arg
      $force_ref_arg
      $tags_fetch_arg
      '(-k --keep)'{-k,--keep}'[keep downloaded pack]'
      '(-u --update-head-ok)'{-u,--update-head-ok}'[allow updates of current branch head]'
      '(-q --quiet)'{-q,--quiet}'[do not print any results to stdout]'
      '(-v --verbose)'{-v,--verbose}'[output extra information]'
      '--depth=[deepen the history of a shallow repository by the given number of commits]:depth'
    )
    
    common_apply_args=(
      '--whitespace=-[detect a new or modified line that ends with trailing whitespaces]: :__git_apply_whitespace_strategies'
      '-p-[remove N leading slashes from traditional diff paths]: :_guard  "[[\:digit\:]]#" number'
      '-C-[ensure at least N lines of context match before and after each change]: :_guard  "[[\:digit\:]]#" number')
    
    template_arg='--template=-[directory to use as a template for the object database]:directory:_directories'
    
    shared_arg='--shared=-[share repository amongst several users]::permissions:__git_repository_permissions'
    
    thin_arg='--thin[minimize number of objects to be sent]'
    
    __git_zstyle_default () {
      zstyle -t $1 $2
      if (( $status == 2 )); then
        zstyle $*
      fi
    }
    
    # TODO: Either skip uninteresting commands or skip the description - the list
    # is just too long.
    # NOTE: I'm coming to the opinion that skipping the description is the right
    # thing to do…, but not 100% sure yet.
    (( $+functions[_git_commands] )) ||
    _git_commands () {
      local -a base_commands
      base_commands=(
        'add:add paths to the index'
        'apply:apply patch on a git index file and a work tree'
        'bisect:find the change that introduced a bug'
        'branch:create and show branches'
        'checkout:checkout and switch to a branch'
        'cherry-pick:cherry-pick the effect of an existing commit'
        'clone:clone a repository into a new directory'
        'commit:record changes to the repository'
        'diff:show changes between commits, commit and working tree, etc.'
        'fetch:download objects and a head from another repository'
        'gc:cleanup unnecessary files and optimize the local repository'
        'grep:print lines matching a pattern'
        'help:display help information about git subcommands'
        'init:create empty git object database'
        'log:show commit logs'
        'merge:grand unified merge driver'
        'mv:move or rename file, directory, or symlink'
        'prune:prune all unreachable objects from the object database'
        'pull:fetch from and merge with a remote repository'
        'push:update remote refs along with associated objects'
        'rebase:rebase local commits to new upstream head'
        'reset:reset current HEAD to the specified state'
        'revert:revert existing commit'
        'rm:remove files from the working tree and from the index'
        'show-branch:show branches and their commits'
        'stage:add file contents to the staging area'
        'stash:stash away changes to the working tree'
        'status:show working-tree'\''s status'
        'submodule:initialize or update or inspect submodules'
        'tag:create tag object signed with GPG'
        'verify-tag:check GPG signature of a tag')
    
      local -a additional_commands
      additional_commands=(
        'am:apply patches from a mailbox (cooler than applymbox)'
        'annotate:annotate file lines with commit info'
        'applymbox:apply patches from a mailbox'
        'applypatch:apply one patch extracted from an e-mail'
        'archive:create an archive of files from a named tree'
        'blame:blame file lines on commits'
        'cat-file:provide content or type information for repository objects'
        'check-attr:display gitattributes information'
        'check-ref-format:makes sure that a reference-name is well formed'
        'checkout-index:copy files from the index to the working directory'
        'cherry:find commits not merged upstream'
        'clean:remove untracked files from the working tree'
        'clone-pack:clone a repository into the current repository (transport)'
        'commit-tree:create a new commit object'
        'count-objects:count unpacked objects and display their disk consumption'
        'describe:show the most recent tag that is reachable from a commit'
        'diff-files:compare files in the working tree and the index'
        'diff-index:compare content and mode of blobs between index and repository'
        'diff-stages:compare two "merge states" in the index file'
        'diff-tree:compare the content and mode of blobs found via two tree objects'
        'fetch-pack:receive missing objects from another repository'
        'imap-send:dump mailbox from stdin into imap folder'
        'index-pack:build pack index file for an existing packed archive'
        'local-fetch:duplicate another git repository on a local system'
        'ls-remote:show references in a remote or local repository'
        'ls-tree:display tree object in human-readable form'
        'mailinfo:extract patch from a single e-mail message'
        'mailsplit:split mbox file into a list of files'
        'merge-base:find as good a common ancestor as possible for a merge'
        'merge-file:run a three-way file merge'
        'merge-index:run merge for files needing merging'
        'merge-tree:show three-way merge without touching index'
        'mktag:create tag object'
        'mktree:build tree-object from ls-tree formatted text'
        'name-rev:find symbolic names for given revisions'
        'notes:add/inspect commit notes'
        'pack-objects:create packed archive of objects'
        'pack-redundant:find redundant pack files'
        'pack-refs:pack heads and tags for efficient repository access'
        'parse-remote:routines to help parsing $GIT_DIR/remotes/'
        'peek-remote:list references on a remote repository using the upload-pack protocol'
        'prune-packed:remove extra objects that are already in pack files'
        'read-tree:read tree information into the directory index'
        'reflog:manage reflog information'
        'relink:hardlink common objects in local repositories'
        'repack:pack unpacked objects in a repository'
        'request-pull:generate summary of pending changes'
        'rerere:reuse recorded resolve'
        'rev-list:list commit object in reverse chronological order'
        'shortlog:summarize git log output'
        'show:show various types of objects'
        'show-index:display contents of a pack idx file'
        'show-ref:list references in a local repository'
        'symbolic-ref:read and modify symbolic references'
        'tar-tree:create tar archive of the files in the named tree'
        'unpack-file:create temporary file with blob'\''s contents'
        'unpack-objects:unpack objects out of packed archive'
        'update-ref:update object name stored in a reference safely'
        'update-server-info:update auxiliary information on a dumb server'
        'var:display git logical variable'
        'verify-pack:validate packed git archive files'
        'whatchanged:show commit-logs and differences they introduce'
        'write-tree:create tree from the current index')
    
      local -a useful_commands
      useful_commands=(
        'format-patch:prepare patches for e-mail submission'
        'ls-files:information about files in the index/working directory'
        'instaweb:instantly browse your working repository in gitweb'
        'remote:manage set of tracked repositories'
        'send-email:send patch-e-mails out of "format-patch" output'
        'update-index:modify index in some given way')
    
      local -a interoperability_commands
      interoperability_commands=(
        'archimport:import an Arch repository into git'
        'cvsexportcommit:export a commit to a CVS checkout'
        'cvsimport:import a CVS "repository" into a git repository'
        'svnimport:import SVN repository into git'
        'quiltimport:apply a quilt patchset'
        'svn:bidirectional operation between a single Subversion branch and git'
        'annex:manage files without tracking content')
    
      local -a ancillary_commands
      ancillary_commands=(
        'config:get and set repository or global options'
        'convert-objects:convert old-style git repository'
        'for-each-ref:output information on each ref'
        'get-tar-commit-id:extract commit ID from an archive created using tar-tree'
        'hash-object:compute object ID from a file'
        'patch-id:compute unique ID for a patch'
        'fsck:verify the connectivity and validity of the objects in the database'
        'lost-found:recover lost references that luckily have not yet been pruned'
        'mergetool:run merge conflict resolution tools to resolve merge conflicts')
    
      local -a internal_commands
      internal_commands=(
        'daemon:start a really simple server for git repositories'
        'fast-import:import information into git directly'
        'fmt-merge-msg:produce merge commit message'
        'http-fetch:download remote git repository via HTTP'
        'http-push:push missing objects using HTTP/DAV'
        'merge-one-file:standard helper-program to use with merge-index'
        'receive-pack:command invoked by send-pack to receive what is pushed to it'
        'rev-parse:pick out and massage parameters for other git commands'
        'runstatus:a helper for git-status and git-commit'
        'send-pack:push to remote repository, intelligently'
        'shell:restricted login shell for GIT-only SSH access'
        'ssh-fetch:pull from remote repository over an SSH connection'
        'ssh-upload:"server-side" helper program used by ssh-fetch'
        'stripspace:filter out empty lines'
        'upload-archive:send archive back to git-archive'
        'upload-pack:command invoked by clone-pack and fetch-pack')
    
      local wanted_commands
      zstyle -s ":completion:${curcontext}:" commands wanted_commands || wanted_commands="all -internal"
      local -a user_commands
      zstyle -a ":completion:${curcontext}:" user-commands user_commands || user_commands=()
    
      local -aU unique_wanted_commands
      unique_wanted_commands=($=wanted_commands)
    
      integer index_of_all=$(( $unique_wanted_commands[(I)all] ))
      if (( index_of_all > 0 )); then
        unique_wanted_commands[index_of_all]=()
        unique_wanted_commands+=(base additional useful interoperability ancillary internal)
      fi
    
      for (( i = 0; i < $#unique_wanted_commands; i++ )); do
        if [[ $unique_wanted_commands[i] == (#bq)-(*) ]]; then
          unique_wanted_commands[i]=()
          unique_wanted_commands[(I)$match[1]]=()
        fi
      done
    
      local -a commands
      for wanted_command in $unique_wanted_commands; do
        case $wanted_command in
          (base)
            commands+=($base_commands) ;;
          (additional)
            commands+=($additional_commands) ;;
          (useful)
            commands+=($useful_commands) ;;
          (interoperability)
            commands+=($interoperability_commands) ;;
          (ancillary)
            commands+=($ancillary_commands) ;;
          (internal)
            commands+=($internal_commands) ;;
        esac
      done
      commands+=( $user_commands )
    
      _describe -t commands 'git command' commands && ret=0
    }
    
    (( $+functions[__git_aliases] )) ||
    __git_aliases () {
      declare -a aliases
    
      # TODO: See __git_config_gettable_name for discussion on how to actually get
      # out the names, skipping the values.
      # TODO: Should check if the terminal is unicode capable.  If so, use ‘ and ’
      # instead of '.
      aliases=(${^${${(M)${(f)"$(_call_program aliases git config --list)"}:#alias.*}#alias.}/(#b)=(*)/:alias for \'$match[1]}\')
      __git_command_successful || return 0
    
      local expl
    
      _describe -t aliases 'git alias' aliases
    }
    
    (( $+functions[__git_aliases_and_commands] )) ||
    __git_aliases_and_commands () {
      _alternative \
        'aliases: :__git_aliases' \
        'commands: :_git_commands'
    }
    # NOTE: -c is undocumented.
    # TODO: Perhaps provide some sort of completion or guard for line range (-L).
    # NOTE: --score-debug is undocumented.
    # NOTE: --show-name is undocumented.
    # NOTE: --show-number is undocumented.
    (( $+functions[_git-annotate] )) ||
    _git-annotate () {
      _arguments -S \
        '-b[show blank SHA-1 for boundary commits]' \
        '--root[do not treat root commits as boundaries]' \
        '--show-stats[include additional statistics at the end of blame output]' \
        '-c[undocumented]' \
        '-l[show long rev]' \
        '-t[show raw timestamp]' \
        '-S[use revs from revs-file]:revs-file:_files' \
        '-M-[detect moving lines in the file as well]:number of characters' \
        '*-C-[detect copied lines from other files from same commit as well]:number of characters' \
        '-L[annotate only the given line range]:line range' \
        '--contents[annotate against the given file if no rev is specified]:file:_files' \
        '--incremental[show results incrementally for machine processing]' \
        '--score-debug[uncodumented]' \
        '(-f --show-name)'{-f,--show-name}'[undocumented]' \
        '(-n --show-number)'{-n,--show-number}'[undocumented]' \
        '(-p --porcelain)'{-p,--porcelain}'[show results designed for machine processing]' \
        '(-h --help)'{-h,--help}'[show help message]' \
        ':file:__git_cached_files' \
        '::revision:__git_revisions' && ret=0
    }
    
    (( $+functions[_git-apply] )) ||
    _git-apply () {
      _arguments \
        $nul_arg \
        '--allow-binary-replacement[allow binary files to be patched]' \
        '--apply[apply patches that would otherwise not be applied]' \
        '--cached[apply patches without touching the working tree]' \
        '--check[check if patches are applicable (turns off "apply")]' \
        '--include=-[include files matching specified pattern]:pattern' \
        '--exclude=-[skip files matching specified pattern]:pattern' \
        '--inaccurate-eof[work around missing-new-line-at-EOF bugs]' \
        '--index[make sure that the patch is applicable to the index]' \
        '--index-info[output information about original version of a blob if available]' \
        '--no-add[ignore additions made by the patch]' \
        '--numstat[same as --stat but in decimal notation and complete pathnames (turns off "apply")]' \
        '(-R --reverse)'{-R,--reverse}'[apply patches in reverse]' \
        '--reject[apply as much as possible, and leave rejected hunks in .rej files]' \
        '--stat[output diffstat for the input (turns off "apply")]' \
        '--summary[output summary of git-diff extended headers (turns off "apply")]' \
        '--unidiff-zero[disable unified-diff-context check]' \
        '(-v --verbose)'{-v,--verbose}'[report progress to stderr]' \
        $common_apply_args \
        '*::patch:_files' && ret=0
    }
    
    # NOTE: Documentation mentions options that don’t exist anymore, for example,
    # --since, and shows -C twice!aa
    (( $+functions[_git-blame] )) ||
    _git-blame () {
      _git-annotate
    }
    
    (( $+functions[_git-checkout-index] )) ||
    _git-checkout-index () {
      _arguments -S \
        $nul_arg \
        '(-a --all :)'{-a,--all}'[check out all files in the index]' \
        '(-f --force)'{-f,--force}'[force overwrite of existing files]' \
        '(-n --no-create)'{-n,--no-create}'[do not checkout new files]' \
        '--stage=-[check out files from named stage]:stage:(1 2 3 all)' \
        '--stdin[read list of paths from the standard input]' \
        '--temp[write the content to temporary files]' \
        '--prefix=-[prefix to use when creating files]:directory:_directories' \
        '(-q --quiet)'{-q,--quiet}'[do not complain about existing files or missing files]' \
        '(-u --index)'{-u,--index}'[update stat information in index]' \
        '*::file:__git_cached_files' && ret=0
    }
    
    (( $+functions[_git-commit-tree] )) ||
    _git-commit-tree () {
      if (( CURRENT == 2 )); then
        __git_trees && ret=0
      elif [[ $words[CURRENT-1] == -p ]]; then
        local expl
        _description commits expl 'parent commit'
        __git_objects $expl && ret=0
      else
        compadd - '-p'
      fi
    }
    
    (( $+functions[_git-hash-object] )) ||
    _git-hash-object () {
      _arguments -S \
        '(:)--stdin[read object from standard input]' \
        '-t[the type of object to create]:object type:((blob\:"a blob of data"
                                                        commit\:"a tree with parent commits"
                                                        tag\:"a symbolic name for another object"
                                                        tree\:"a recursive tree of blobs"))' \
        '-w[write the object to the object database]' \
        '(--stdin):file:_files' && ret=0
    }
    
    (( $+functions[_git-help] )) ||
    _git-help () {
      _arguments -S \
        ':command:_git_commands' \
        - '(all)' \
        '(:)'{--all,-a}'[List all available commands]' \
        - '(format)' \
        {--man,-m}'[Display help in man page format]' \
        {--info,-i}'[Display help in info format]' \
        {--web,-w}'[Display help in web browser]' \
        && ret=0
    }
    
    (( $+functions[_git-index-pack] )) ||
    _git-index-pack () {
      local -a stdin_arguments
    
      if (( words[(I)--stdin] )); then
        stdin_arguments=(
          '--fix-thin[record deltified objects, based on objects not included]'
          '--keep=-[create .keep file]::reason:')
      fi
    
      _arguments \
        '-v[report progress to stderr]' \
        '-o[write generated pack index into specified file]:file:_files' \
        '--stdin[read pack from stdin and instead write to specified file]' \
        $stdin_arguments \
        ':pack file:_files -g "*.pack"' && ret=0
    }
    
    (( $+functions[_git-init] )) ||
    _git-init () {
      _arguments \
        '(-q --quiet)'{-q,--quiet}'[do not print any results to stdout]' \
        '--bare[create a bare repository]' \
        $shared_arg \
        $template_arg && ret=0
    }
    
    (( $+functions[_git-merge-file] )) ||
    _git-merge-file () {
      integer n_labels=${#${(M)words[1,CURRENT-1]:#-L}}
      local label_argument
    
      if (( n_labels < 3 )) || [[ $words[CURRENT-1] == -L ]]; then
        local -a ordinals
    
        ordinals=(first second third)
    
        label_argument="*-L[label to use for the $ordinals[n_labels+1] file]:label"
      fi
    
      _arguments \
        $label_argument \
        '(-p --stdout)'{-p,--stdout}'[send merged file to standard output instead of overwriting first file]' \
        '(-q --quiet)'{-q,--quiet}'[do not warn about conflicts]' \
        ':current file:_files' \
        ':base file:_files' \
        ':other file:_files' && ret=0
    }
    
    (( $+functions[_git-merge-index] )) ||
    _git-merge-index () {
      if (( CURRENT > 2 )) && [[ $words[CURRENT-1] != -[oq] ]]; then
        _arguments -S \
          '(:)-a[run merge against all files in the index that need merging]' \
          '*:index file:__git_cached_files' && ret=0
      else
        declare -a arguments
    
        (( CURRENT == 2 )) && arguments+='-o[skip failed merges]'
        (( CURRENT == 2 || CURRENT == 3 )) && arguments+='(-o)-q[do not complain about failed merges]'
        (( 2 <= CURRENT && CURRENT <= 4 )) && arguments+='*:merge program:_files -g "*(*)"'
    
        _arguments -S $arguments && ret=0
      fi
    }
    
    # TODO: Shouldn’t we add a __git_branches type completion?
    (( $+functions[_git-merge-tree] )) ||
    _git-merge-tree () {
      _arguments \
        ':base-tree:__git_tree_ishs' \
        ':branch 1:__git_tree_ishs' \
        ':branch 2:__git_tree_ishs' && ret=0
    }
    
    (( $+functions[_git-mktag] )) ||
    _git-mktag () {
      _message 'no arguments allowed; only accepts tags on standard input'
    }
    
    (( $+functions[_git-mktree] )) ||
    _git-mktree () {
      _arguments \
        '-z[read NUL-terminated ls-tree -z output]' && ret=0
    }
    
    (( $+functions[_git-pack-objects] )) ||
    _git-pack-objects () {
      _arguments \
        '(--revs)--all[include all refs as well as revisions already specified]' \
        '--all-progress[force progress output, even during write-out phase]' \
        '--delta-base-offset[use delta-base-offset packing]' \
        '--depth=[maximum delta depth]:number' \
        '--incremental[ignore objects that have already been packed]' \
        '--no-reuse-delta[do not reuse existing deltas, but compute them from scratch]' \
        '--non-empty[only create a package if it contains at least one object]' \
        '--local[similar to --incremental, but only ignore unpacked non-local objects]' \
        '--progress[force progress output]' \
        '--revs[read revision arguments from standard input]' \
        '(:)--stdout[write the pack to standard output]' \
        '-q[do not report progress]' \
        '(--revs)--unpacked[limit objects to pack to those not already packed]' \
        '--window=[number of objects to use per delta compression]:number' \
        '(--stdout):base-name:_files' && ret=0
    }
    
    (( $+functions[_git-prune-packed] )) ||
    _git-prune-packed () {
      _arguments -S \
        '-n[only list the objects that would be removed]' \
        '-q[suppress progress output]' && ret=0
    }
    
    (( $+functions[_git-read-tree] )) ||
    _git-read-tree () {
      local aggressive_arg
    
      if (( words[(I)-m] )); then
        aggressive_arg='--aggressive[try harder to resolve merge conflicts]'
      fi
    
      local -a ui_args
    
      if (( words[(I)(-m|--reset|--prefix)] )); then
        ui_args=(
          '(   -i)-u[update the work tree after successful merge]'
          '(-u   )-i[update only the index; ignore changes in work tree]')
      fi
    
      local exclude_per_directory_arg
    
      if (( words[(I)-u] )); then
        exclude_per_directory_arg='--exclude-per-directory=-[specify .gitignore file]:.gitignore file:_files'
      fi
    
      _arguments -A '-*' \
        '(   --reset --prefix)-m[perform a merge, not just a read]' \
        '(-m         --prefix)--reset[perform a merge, not just a read, ignoring unmerged entries]' \
        '(-m --reset          2 3)--prefix=-[read the contents of specified tree-ish under specified directory]:prefix:_directories -r ""' \
        $aggressive_arg \
        $ui_args \
        $exclude_per_directory_arg \
        '--trivial[restrict three-way merge to only happen if no file-level merging is required]'  \
        '--index-output=[write index in the named file instead of $GIT_INDEX_FILE]:file:_files' \
        '1:first tree-ish to be read/merged:__git_tree_ishs' \
        '2:second tree-ish to be read/merged:__git_tree_ishs' \
        '3:third tree-ish to be read/merged:__git_tree_ishs' && ret=0
    }
    
    # TODO: Complete value regex somehow?
    (( $+functions[_git-config] )) ||
    _git-config () {
      local name_arg
    
      if (( words[(I)--get-regexp] )); then
        name_arg=':name regex'
      elif (( words[(I)--get(-all|)] )); then
        name_arg=':name:__git_config_gettable_name'
      else
        name_arg=':name:__git_config_name'
      fi
    
      _arguments -A '--*' \
        '(         --global)--system[use system-wide config file]' \
        '(--system         )--global[use user-global config file]' \
        '(      --bool)--int[setting is an integer]' \
        '(--int       )--bool[setting is a boolean]' \
        $name_arg \
        ":value:__git_config_values $words[CURRENT-1]" \
        '::value regex' \
        - '(actions)' \
        '(: -)--rename-section[rename the given section]:section:__git_config_section_names:new name'  \
        '(: -)--remove-section[remove the given section]:section:__git_config_section_names' \
        '(3 -)--add[add new value without altering any existing ones]' \
        '(2 -)--unset[remove the first matching value of the key]' \
        '(2 -)--unset-all[remove all matching values of the key]' \
        '(2 -)--get[get the first matching value of the key]' \
        '(2 -)--get-all[get all matching values of the key]' \
        '(2 -)--get-regexp[like "--get-all", but interpret "name" as a regular expression]' \
        '(-)--replace-all[replace all values of the given key]' \
        '(: --int --bool)'{-l,--list}'[list all variables set in config file]' && ret=0
    }
    
    # NOTE: --track is undocumented.
    # TODO: --track, -t, --master, and -m should take remote branches, I guess.
    # NOTE: --master is undocumented.
    # NOTE: --fetch is undocumented.
    (( $+functions[_git-remote] )) ||
    _git-remote () {
      local curcontext=$curcontext state line
      declare -A opt_args
    
      _arguments -C \
        ':command:->command' \
        '*::options:->options' && ret=0
    
      case $state in
        (command)
          declare -a commands
    
          commands=(
            'add:add a new remote'
            'show:show information about a given remote'
            'prune:delete all stale tracking branches for a given remote'
            'update:fetch updates for a set of remotes'
            'rm:remove a remote from .git/config and all associated tracking branches'
            'rename:rename a remote from .git/config and update all associated tracking branches')
    
          _describe -t commands 'sub-command' commands && ret=0
          ;;
        (options)
          case $line[1] in
            (add)
              _arguments \
                '*'{--track,-t}'[track given branch instead of default glob refspec]:branch:__git_branch_names' \
                '(--master -m)'{--master,-m}'[set the remote'\''s HEAD to point to given master branch]:branch:__git_branch_names' \
                '(--fetch -f)'{--fetch,-f}'[run git-fetch on the new remote after it has been created]' \
                ':branch name:__git_remotes' \
                ':url:_urls' && ret=0
              ;;
            (show)
              _arguments \
                '-n[do not contact the remote for a list of branches]' \
                ':remote:__git_remotes' && ret=0
              ;;
            (prune)
              _arguments \
                '(--dry-run -n)'{-n,--dry-run}'[do not actually prune, only list what would be done]' \
                ':remote:__git_remotes' && ret=0
              ;;
            (update)
              __git_remote-groups && ret=0
              ;;
            (rm)
              __git_remotes && ret=0
              ;;
            (rename)
              __git_remotes && ret=0
              ;;
          esac
          ;;
      esac
    }
    
    (( $+functions[_git-unpack-objects] )) ||
    _git-unpack-objects () {
      _arguments \
        '-n[only list the objects that would be unpacked]' \
        '-q[run quietly]' \
        '-r[try recovering objects from corrupt packs]' && ret=0
    }
    
    (( $+functions[_git-update-index] )) ||
    _git-update-index () {
      local nul_arg
    
      if (( words[(I)--stdin] )); then
        nul_arg='-z[paths are separated with NUL instead of LF for --stdin]'
      fi
    
      _arguments -S \
        $refreshables \
        '--add[add files not already in the index]' \
        '(         --force-remove)--remove[remove files that are in the index but are missing from the work tree]' \
        '(--remove               )--force-remove[remove files from both work tree and the index]' \
        '(-q --unmerged --ignore-missing)--refresh[refresh the index]' \
        '-q[run quietly]' \
        '--unmerged[if unmerged changes exists, ignore them instead of exiting]' \
        '--ignore-missing[ignore missing files when refreshing the index]' \
        '*--cacheinfo[insert information directly into the cache]: :_guard "[0-7]#" "octal file mode": :_guard "[[\:xdigit\:]]#" "object id":file:_files' \
        '(: -)--index-info[read index information from stdin]' \
        '--chmod=-[set the execute permissions on the updated files]:permission:((-x\:executable +x\:"not executable"))' \
        '(                   --no-assume-unchanged)--assume-unchanged[set the "assume unchanged" bit for the given paths]' \
        '(--assume-unchanged                      )--no-assume-unchanged[unset the "assume unchanged" bit for the given paths]' \
        '(-)'{-g,--again}'[run git-update-index on differing index entries]' \
        '(-)--unresolve[restore "unmerged" or "needs updating" state of files]' \
        '--info-only[only insert files object-IDs into index]' \
        '--replace[replace files already in the index if necessary]' \
        '(: -)--stdin[read list of paths from standard input]' \
        '--verbose[report what is being added and removed from the index]' \
        $nul_arg \
        '*::file:_files' && ret=0
    }
    
    (( $+functions[_git-write-tree] )) ||
    _git-write-tree () {
      _arguments \
        '--missing-ok[ignore objects in the index that are missing in the object database]' \
        '--prefix=-[write tree representing given sub-directory]:sub-directory:_directories -r ""' && ret=0
    }
    
    # shouldn't complete objects after --batch{,-check}...
    (( $+functions[_git-cat-file] )) ||
    _git-cat-file () {
      _arguments \
        '(-t -s -e -p --batch-check         1)--batch[print the SHA1, type, size, and contents of each object provided on stdin]' \
        '(-t -s -e -p               --batch 1)--batch-check[print the SHA1, type, and size of each object provided on stdin]' \
        '(   -s -e -p --batch-check --batch 1)-t[show the type of the given object]' \
        '(-t    -e -p --batch-check --batch 1)-s[show the size of the given object]' \
        '(-t -s    -p --batch-check --batch 1)-e[exit with zero status if object exists]' \
        '(-t -s -e    --batch-check --batch 1)-p[pretty-print the given object]' \
        '(-t -s -e -p --batch-check --batch  ):object type:(blob commit tag tree)' \
        '(-t -s -e -p --batch-check --batch  ):object:__git_objects' && ret=0
    }
    
    (( $+functions[_git-describe] )) ||
    _git-describe () {
      _arguments \
        '--all[use any ref found in "$GIT_DIR/refs/"]' \
        '--tags[use any ref found in "$GIT_DIR/refs/tags"]' \
        '(--contains)--tags[use any tag found in "$GIT_DIR/refs/tags/"]' \
        $abbrev_arg \
        '--contains[find the tag after the commit instead of before]' \
        '--exact-match[only output exact matches, same as --candidates=0]' \
        '--always[show uniquely abbreviated commit object as fallback]' \
        '--long[always show full format, even for exact matches]' \
        '--match=[only consider tags matching glob pattern]:pattern' \
        '--candidates=-[consider up to given number of candidates]: :_guard "[[\:digit\:]]##" "number of candidates"' \
        '--debug[display information about the searching strategy]' \
        '*:committish:__git_committishs' && ret=0
    }
    
    # TODO: Use __git_modified_files instead?
    (( $+functions[_git-diff-index] )) ||
    _git-diff-index () {
      _arguments -S \
        $diff_args \
        '--cached[do not consider the work tree at all]' \
        '-m[flag non-checked-out files as up-to-date]' \
        ':tree-ish:__git_tree_ishs' \
        '*::index file:__git_cached_files' && ret=0
    }
    
    # TODO: Use __git_modified_files instead?
    (( $+functions[_git-diff-files] )) ||
    _git-diff-files () {
      _arguments \
        $diff_args \
        '(-0 -1 -2 -3 --base --ours --theirs -c --cc --no-index)-0[omit diff output for unmerged entries]' \
        '(-0 -1 -2 -3 --base --ours --theirs -c --cc --no-index)'{-1,--base}'[diff against "base" version]' \
        '(-0 -1 -2 -3 --base --ours --theirs -c --cc --no-index)'{-2,--ours}'[diff against "our branch" version]' \
        '(-0 -1 -2 -3 --base --ours --theirs -c --cc --no-index)'{-3,--theirs}'[diff against "their branch" version]' \
        '(-0 -1 -2 -3 --base --ours --theirs -c --cc --no-index)'{-c,--cc}'[compare "our branch", "their branch" and working tree files]' \
        '(-0 -1 -2 -3 --base --ours --theirs -c --cc --no-index --exit-code *)--no-index[compare given files / directories]' \
        '-q[remain silent even on nonexisting files]' \
        '1:file:_files' \
        '2:file:_files' \
        '*::file:_files' && ret=0
    }
    
    # TODO: Use __git_modified_files instead?
    (( $+functions[_git-diff-stages] )) ||
    _git-diff-stages () {
      _arguments \
        $diff_args \
        ':stage 1:__git_stages' \
        ':stage 2:__git_stages' \
        '*::index file:_files' && ret=0
    }
    
    # TODO: Use __git_modified_files instead?
    (( $+functions[_git-diff-tree] )) ||
    _git-diff-tree () {
      local curcontext=$curcontext state line
      declare -A opt_args
    
      _arguments -C -S \
        $diff_args \
        $pretty_arg \
        '--encoding=-[re-code commit log-message in given encoding]::log-message encoding:__git_encodings' \
        '--no-commit-id[skip output of commit IDs]' \
        '--root[show diff against the empty tree]' \
        '--stdin[read commit and tree information from standard input]' \
        '-m[show merge commits]' \
        '-r[recurse into subdirectories]' \
        '(-r)-t[show tree entry itself as well as subtrees (implies -r)]' \
        '-s[do not show differences]' \
        '-v[show commit message before the differences]' \
        '(-c --cc)-c[show differences from each of the parents to the merge result]' \
        '(-c --cc)--cc[how differences from each of the parents and omit differences from only one parent]' \
        '--always[always show commit itself and the commit log message]' \
        ':tree-ish:__git_tree_ishs' \
        '*::file:->files' && ret=0
    
      case $state in
        files)
          if (( $#line > 2 )); then
            # TODO: this is probably just stupid to do.
            # What'd be nice would be
            # common files:
            #   ...
            # original tree:
            #   ...
            # new tree:
            #   ...
            _alternative \
              "original tree:original tree:__git_tree_files . $line[1]" \
              "new tree:new tree:__git_tree_files . $line[2]" && ret=0
          else
            _alternative \
              ': :__git_tree_ishs' \
              ": :__git_tree_files . $line[1]" && ret=0
          fi
          ;;
      esac
    }
    
    # TODO: Better completion for --format: should complete %(field) stuff, that
    # is, %(refname), %(objecttype), %(objectsize), %(objectname) with optional ‘*’
    # in front.
    # TODO: Documentation says that --count can be given * number of times, but
    # sources beg to differ, allowing only one.
    (( $+functions[_git-for-each-ref] )) ||
    _git-for-each-ref () {
      _arguments -S \
        '--format=-[output format of ref information]:format' \
        '(-s --shell -p --perl --python --tcl)'{-s,--shell}'[use string literals suitable for sh]' \
        '(-s --shell -p --perl --python --tcl)'{-p,--perl}'[use string literals suitable for Perl]' \
        '(-s --shell -p --perl          --tcl)'--python'[use string literals suitable for Python]' \
        '(-s --shell -p --perl --python      )'--tcl'[use string literals suitable for Tcl]' \
        '--count=-[maximum number of refs to iterate over]: :_guard "[[\:digit\:]]#" "maximum number of refs"' \
        '--sort=-[key to sort refs by]:sort key:__git_ref_sort_keys' \
        ':: :_guard "([^-]?#|)" pattern' && ret=0
    }
    
    (( $+functions[_git-fmt-merge-msg] )) ||
    _git-fmt-merge-msg () {
      arguments \
        '(          --no-summary)--summary[add one-line descriptions from commits being merged]' \
        '(--summary             )--no-summary[do not add one-line descriptions from commits being merged]' \
        '(-F --file)'{-F,--file}'[specify list of merged objects from file]:file:_files' && ret=0
    }
    
    (( $+functions[_git-fsck] )) ||
    _git-fsck () {
      _arguments \
        '--cache[consider objects recorded in the index as head nodes for reachability traces]' \
        '--full[check all object directories]' \
        '--root[show root nodes]' \
        '--strict[do strict checking]' \
        '--tags[show tags]' \
        '--unreachable[show objects that are unreferenced in the object database]' \
        '*::object:__git_objects' && ret=0
    }
    
    (( $+functions[_git-ls-files] )) ||
    _git-ls-files () {
      local no_empty_directory_arg
    
      if (( words[(I)--directory] )); then
        no_empty_directory_arg='--no-empty-directory[do not list empty directories]'
      fi
    
      _arguments -S \
        $nul_arg \
        '(-c --cached)'{-c,--cached}'[show cached files in the output]' \
        '(-d --deleted)'{-d,--deleted}'[show deleted files in the output]' \
        '(-i --ignored)'{-i,--ignored}'[show ignored files in the output]' \
        '(-k --killed)'{-k,--killed}'[show killed files in the output]' \
        '(-m --modified)'{-m,--modified}'[show modified files in the output]' \
        '(-o --others)'{-o,--others}'[show other files in the output]' \
        '(-s --stage)'{-s,--stage}'[show stage files in the output]' \
        '(-u --unmerged)'{-u,--unmerged}'[show unmerged files in the output]' \
        '(   -v)-t[identify each files status (HMRCK?)]' \
        '(-t   )-v[identify each files status (hmrck?)]' \
        '*'{-x,--exclude=-}'[skip files matching given pattern]:file pattern' \
        '*'{-X,--exclude-from=-}'[skip files matching patterns in given file]:file:_files' \
        '*--exclude-per-directory=-[skip directories matching patterns in given file]:file:_files' \
        '--directory[if a whole directory is classified as "other", show just its name]' \
        $no_empty_directory_arg \
        '--error-unmatch[if any  does not appear in the index, treat this as an error]' \
        '--full-name[force paths to be output relative to the project top directory]' \
        $abbrev_arg \
        '*::index file:_files' && ret=0
    }
    
    (( $+functions[_git-ls-tree] )) ||
    _git-ls-tree () {
      local curcontext=$curcontext state line
      declare -A opt_args
    
      _arguments -C \
        $nul_arg \
        $abbrev_arg \
        '(-t)-d[do not show children of given tree (implies -t)]' \
        {--name-only,--name-status}'[list only filenames, one per line]' \
        '-r[recurse into subdirectories]' \
        '-t[show tree entries even when going to recurse them]' \
        '--full-name[output full path-names]' \
        ':tree-ish:__git_tree_ishs' \
        '*::tree file:->files' && ret=0
    
      case $state in
        files)
          __git_tree_files . $line[1] && ret=0
          ;;
      esac
    }
    
    (( $+functions[_git-imap-send] )) ||
    _git-imap-send () {
      _message 'no arguments allowed; accepts mailbox file on standard input'
    }
    
    (( $+functions[_git-quiltimport] )) ||
    _git-quiltimport () {
      _arguments \
        '--dry-run[check patches and warn if they can'\''t be imported]' \
        '--author[default author name and email address to use for patches]' \
        '--patches[set directory containing patches]:patch directory:_directories' && ret=0
    }
    
    (( $+functions[_git-merge-base] )) ||
    _git-merge-base () {
      _arguments \
        '(-a --all)'{-a,--all}'[show all common ancestors]' \
        ':commit 1:__git_commits' \
        ':commit 2:__git_commits' && ret=0
    }
    
    (( $+functions[_git-name-rev] )) ||
    _git-name-rev () {
      _arguments -S \
        '--tags[only use tags to name the commits]' \
        '--refs=-[only use refs matching given pattern]: :_guard "?#" "shell pattern"' \
        '--always[show uniquely abbreviated commit object as fallback]' \
        '--no-undefined[die with non-zero return when a reference is undefined]' \
        '(--stdin :)--all[list all commits reachable from all refs]' \
        '(--all :)--stdin[read from stdin and append revision-name]' \
        '(--stdin --all)*:commit-ish:__git_revisions' && ret=0
    }
    
    (( $+functions[_git-notes] )) ||
    _git-notes () {
      local expl
      local -a notes_cmds
    
      notes_cmds=(
        edit:"edit note"
        show:"show commit note"
      )
    
      if (( CURRENT == 2 )); then
        _describe -t command "git-notes commands" notes_cmds && ret=0
      else
        case $words[2] in
          (show)
            _arguments \
              '*:commit id:__git_commits' && ret=0
            ;;
          (edit)
            _arguments \
              '-F[use file'\''s contents as the commit note]:file:_path_files' \
              '-m[use the given message as the commit note]:message' \
              '*:commit id:__git_commits' && ret=0
            ;;
          (*)
            _nothing
            ;;
        esac
      fi
    }
    
    (( $+functions[_git-pack-redundant] )) ||
    _git-pack-redundant () {
      _arguments \
        '(:)--all[process all packs]' \
        '--alt-odb[do not require objects to be present in local packs]' \
        '--verbose[output some statistics to stderr]' \
        '(--all)*::packs:_files -g "*.pack"' && ret=0
    }
    
    # TODO: --timestamp undocumented.
    (( $+functions[_git-rev-list] )) ||
    _git-rev-list () {
      if (( words[(I)--] && words[(I)--] != CURRENT )); then
        _arguments \
          '*:index file:__git_cached_files' && ret=0
      else
        __git_setup_revision_arguments
    
        _arguments -S \
          $revision_arguments \
          '(--pretty)--header[show commit headers]' \
          '--remote-empty[stop when a given path disappears from the tree]' \
          '--timestamp[undocumented]' \
          '(         --bisect-vars)--bisect[show only the middlemost commit object]' \
          '(--bisect              )--bisect-vars[same as --bisect, outputing shell-evalable code]' \
          '--stdin[read commit objects from standard input]' \
          '*:commit id:__git_commit_ranges2' && ret=0
      fi
    }
    
    (( $+functions[_git-show-ref] )) ||
    _git-show-ref () {
      _arguments -S \
        - list \
          '(-h --head)'{-h,--head}'[show the HEAD reference]' \
          '--tags[show only "refs/tags"]' \
          '--heads[show only "refs/heads"]' \
          '(-d --dereference)'{-d,--dereference}'[dereference tags into object IDs as well]' \
          '(-s --hash)'{-s+,--hash=-}'[only show the SHA-1 hash, not the reference name]:: :_guard "[[\:digit\:]]#" length' \
          '--verify[enable stricter reference checking]' \
          $abbrev_arg \
          '(-q --quiet)'{-q,--quiet}'[do not print any results to stdout]' \
          '*: :_guard "([^-]?#|)" pattern' \
        - exclude \
          '--exclude-existing=-[filter out existing refs from stdin]:: :_guard "([^-]?#|)" pattern' && ret=0
    }
    
    (( $+functions[_git-show] )) ||
    _git-show () {
      local curcontext=$curcontext state line
      typeset -A opt_args
      __git_setup_revision_arguments
    
      _arguments -S \
        $revision_arguments \
        '-s[do not show differences]' \
        '*:object:__git_objects' && ret=0
    }
    
    (( $+functions[_git-show-index] )) ||
    _git-show-index () {
      _message 'no arguments allowed; accepts index file on standard input'
    }
    
    (( $+functions[_git-tar-tree] )) ||
    _git-tar-tree () {
      _arguments \
        '--remote=-[retrieve a tar archive from a remote repository]:__git_remote_repository' \
        ':tree-ish:__git_tree_ishs' \
        ':base:_files' && ret=0
    }
    
    (( $+functions[_git-unpack-file] )) ||
    _git-unpack-file () {
      _arguments \
        ':blob id:__git_blobs' && ret=0
    }
    
    (( $+functions[_git-var] )) ||
    _git-var () {
      _arguments \
        '(:)-l[show logical variables]' \
        '(-):variable:((GIT_AUTHOR_IDENT\:"name and email of the author" \
                        GIT_COMMITTER_IDENT\:"name and email of committer"))' && ret=0
    }
    
    (( $+functions[_git-verify-pack] )) ||
    _git-verify-pack () {
      _arguments -S \
        '-v[show objects contained in pack]' \
        '*:index file:_files -g "*.idx"' && ret=0
    }
    
    (( $+functions[_git-clone-pack] )) ||
    _git-clone-pack () {
      _arguments \
        $exec_arg \
        ':repository:__git_any_repositories' \
        '*:head:__git_heads' && ret=0
    }
    
    (( $+functions[_git-fetch-pack] )) ||
    _git-fetch-pack () {
      _arguments \
        '--all[fetch all remote refs]' \
        '(-q --quiet)'{-q,--quiet}'[make output less verbose]' \
        '(-k --keep)'{-k,--keep}'[do not invoke git-unpack-objects on received data]' \
        $thin_arg \
        '(--upload-pack --exec)'{--upload-pack=-,--exec=-}'[specify path to git-upload-pack on remote side]:remote path' \
        '--depth=-[limit fetching to ancestor-chains not longer than given number]: :_guard "[[\:digit\:]]#" "maximum ancestor-chain length"' \
        '--no-progress[do not show progress]' \
        $verbose_arg \
        ':repository:__git_any_repositories' \
        '*:references:__git_references' && ret=0
    }
    
    (( $+functions[_git-fast-import] )) ||
    _git-fast-import () {
      _arguments \
        '--date-format=-[specify the types of dates being passed]:((raw\:"native git format"
                                                                    rfc2822\:"standard email format"
                                                                    now\:"use current time and timezone"))' \
        '--max-pack-size=-[maximum size of each packfile]: :_guard "[[\:digit\:]]#" "maximum pack size"' \
        '--depth=-[maximum delta depth for blob and tree deltification]: :_guard "[[\:digit\:]]#" "maximum delta depth"' \
        '--active-branches=-[maximum number of branches to maintain active at once]: :_guard "[[\:digit\:]]#" "maximum number of branches"' \
        '--export-marks=-[dump the internal marks table to given file]:export file:_files' \
        '--export-pack-edges=-[list packfiles and last commit on branches in them in given file]:export file:_files' \
        '--force[force updating modified existing branches]' \
        '--quiet[disable all non-fatal output]' \
        '--stats[display statistics about object created]' && ret=0
    }
    
    (( $+functions[_git-http-fetch] )) ||
    _git-http-fetch () {
      _arguments \
        $fetch_args \
        '(1)--stdin[read commit ids and refs from standard input]' \
        ':commit id:__git_commits' \
        ':URL:_urls' && ret=0
    }
    
    (( $+functions[_git-http-push] )) ||
    _git-http-push () {
      _arguments \
        '--all[verify that all objects in local ref history exist remotely]' \
        '--complete[do not assume that the remote repository is complete]' \
        '--force[allow refs that are not ancestors to be updated]' \
        '--verbose[report the list of objects being walked locally and sent to the remote]' \
        '(   -D)-d[remove refs from remote repository]' \
        '(-d   )-D[forcefully remove refs from remote repository]' \
        ':URL:_urls' \
        '*:remote refs:__git_remote_references' && ret=0
    }
    
    (( $+functions[_git-local-fetch] )) ||
    _git-local-fetch () {
      _arguments \
        $fetch_args \
        '-l[hard-link objects]' \
        '-n[do not copy objects]' \
        '-s[sym-link objects]' \
        '(1)--stdin[read commit ids and refs from standard input]' \
        ':commit id:__git_commits' \
        ':directory:_directories' && ret=0
    }
    
    # TODO: --tags undocumented.
    # TODO: --heads undocumented.
    # TODO: --refs undocumented.
    (( $+functions[_git-peek-remote] )) ||
    _git-peek-remote () {
      _arguments \
        '--upload-pack=-[specify path to git-upload-pack on remote side]:remote path' \
        $exec_arg \
        '--tags[undocumented]' \
        '--heads[undocumented]' \
        '--refs[undocumented]' \
        ':repository:__git_repository' && ret=0
    }
    
    (( $+functions[_git-sh-setup] )) ||
    _git-sh-setup () {
      _message "you probably should not be issuing this command; it is an internal git helper"
    }
    
    # TODO: --dry-run undocumented.
    # TODO: -n undocumented.
    # TODO: --stale-fix undocumented.
    # TODO: --verbose undocumented.
    # TODO: -- undocumented.
    (( $+functions[_git-reflog] )) ||
    _git-reflog () {
      __git_setup_revision_arguments
    
      if (( CURRENT == 2 )); then
        local curcontext=$curcontext state line
        declare -A opt_args
    
        _arguments -C \
          $revision_arguments \
          ':subcommand:->subcommand' && ret=0
    
        case $state in
          (subcommand)
            declare -a reflog_cmds
    
            reflog_cmds=(
            'expire:prune old reflog entries'
            'show:show log of the current branch')
    
            _describe -t subcommands 'subcommands' reflog_cmds && ret=0
            ;;
        esac
      else
        case $words[2] in
          (expire)
            _arguments -S \
              '(-n --dry-run)'{-n,--dry-run}'[undocumented]' \
              '--expire=-[prune entries older than given time]:date' \
              '--expire-unreachable=-[prune entries older than given time and unreachable]:date' \
              '--stale-fix[undocumented]' \
              '--all[prune all refs]' \
              '--verbose' && ret=0
            ;;
          (show|--*)
            _arguments -S \
              $revision_arguments \
              ':subcommand:' && ret=0
            ;;
        esac
      fi
    }
    
    (( $+functions[_git-receive-pack] )) ||
    _git-receive-pack () {
      _arguments \
        ':directory to sync into:_directories' && ret=0
    }
    
    (( $+functions[_git-shell] )) ||
    _git-shell () {
      local curcontext=$curcontext state line
      declare -A opt_args
    
      _arguments -C \
        '-c[command to execute]:command:->commands' \
        ':argument to command:->arguments' && ret=0
    
      case $state in
        (commands)
          declare -a commands
    
          commands=(git-receive-pack git-upload-pack)
    
          _describe -t commands command commands && ret=0
          ;;
        (arguments)
          case $line[1] in
            (git-receive-pack)
              local expl
    
              _description directories expl 'directory to sync into'
              _directories $expl
              ;;
            (git-upload-pack)
              local expl
    
              _description directories expl 'directory to sync from'
              _directories $expl
              ;;
          esac
          ;;
      esac
    }
    
    (( $+functions[_git-upload-archive] )) ||
    _git-upload-archive () {
      _arguments \
        ':directory to get tar archive from:_directories' && ret=0
    }
    
    (( $+functions[_git-send-pack] )) ||
    _git-send-pack () {
      _arguments \
        '(--receive-pack --exec)'{--receive-pack=-,--exec=-}'[specify path to git-receive-pack on remote side]:remote path' \
        '--all[update all refs that exist locally]' \
        '--force[update remote orphaned refs]' \
        $verbose_arg \
        $thin_arg \
        ':repository:__git_any_repositories' \
        '*:remote refs:__git_remote_references' && ret=0
    }
    
    (( $+functions[_git-ssh-fetch] )) ||
    _git-ssh-fetch () {
      _arguments \
        $fetch_args \
        ':commit id:__git_commits' \
        ':URL:_urls' && ret=0
    }
    
    (( $+functions[_git-ssh-upload] )) ||
    _git-ssh-upload () {
      _arguments \
        $fetch_args \
        ':commit id:__git_commits' \
        ':URL:_urls' && ret=0
    }
    
    (( $+functions[_git-update-server-info] )) ||
    _git-update-server-info () {
      _arguments \
        '(-f --force)'{-f,--force}'[update the info files from scratch]' && ret=0
    }
    
    (( $+functions[_git-upload-pack] )) ||
    _git-upload-pack () {
      _arguments \
        '--strict[do not try /.git/ if  is not a git directory' \
        '--timeout=-[interrupt transfer after given number of seconds of inactivity]: :_guard "[[\:digit\:]]" "inactivity timeout"' \
        ':directory:_directories' && ret=0
    }
    
    (( $+functions[_git-add] )) ||
    _git-add () {
      local curcontext=$curcontext state line
      declare -A opt_args
    
      _arguments -C -S \
        '(-n --dry-run)'{-n,--dry-run}'[do not actually add files; only show which ones would be added]' \
        '(-v --verbose)'{-v,--verbose}'[show files as they are added]' \
        '(-f --force)'{-f,--force}'[allow adding otherwise ignored files]' \
        '(-i --interactive : -)'{-i,--interactive}'[add contents interactively to the index]' \
        '(-p --patch)'{-p,--patch}'[like -i but go directly into patch mode for specified files]' \
        '(-u --update -A --all)'{-u,--update}'[update only files git already knows about]' \
        '(-A --all -u --update)'{-A,--all}'[act as both add . and add -u]' \
        '(-N --intent-to-add)'{-N,--intent-to-add}'[record only that the path will be added later]' \
        '--refresh[do not add files, but refresh their stat() info in the index]' \
        '--ignore-errors[continue adding if an error occurs]' \
        '*:file:->files' && ret=0
    
      case $state in
        (files)
          declare -a ignored_files_alternatives
          if (( words[(I)-f] )); then
            ignored_files_alternatives=(
              'ignored-modified-files:ignored modified files:__git_modified_files --ignored'
              'ignored-other-files:ignored other files:__git_other_files --ignored')
          fi
    
          _alternative \
            'modified-files:modified files:__git_modified_files' \
            'other-files:other files:__git_other_files' \
            $ignored_files_alternatives && ret=0
          ;;
      esac
    }
    __git_zstyle_default ':completion::complete:git-add:argument-rest:*' ignore-line yes
    
    (( $+functions[_git-stage] )) ||
    _git-stage () {
      _git-add
    }
    
    (( $+functions[_git-am] )) ||
    _git-am () {
      _arguments \
        '--3way[use 3-way merge if patch does not apply cleanly]' \
        '--abort[restore the original branch and abort the patching operation]' \
        '--binary[pass "--allow-binary-replacement" to "git-apply"]' \
        '--dotest=-[use given directory as working area instead of .dotest]:directory:_directories' \
        '--interactive[apply patches interactively]' \
        '--keep[pass "-k" flag to "git-mailinfo"]' \
        '--resolved[continue after resolving patch failure by hand]' \
        '--signoff[add "Signed-off-by:" line to the commit message]' \
        '--skip[skip the current patch]' \
        '--utf8[pass "-u" flag to "git-mailinfo"]' \
        '--no-utf8[do not pass "-u" flag to "git-mailinfo"]' \
        $common_apply_args \
        '*:mbox file:_files' && ret=0
    }
    
    (( $+functions[_git-archive] )) ||
    _git-archive () {
      local curcontext=$curcontext state line
      declare -A opt_args
    
      declare -a backend_args
    
      if (( words[(I)--format=*] > 0 && words[(I)--format=*] < CURRENT )); then
        case ${words[$words[(I)--format=*]]#--format=} in
          (zip)
            backend_args=(
              '-0[do not deflate files]'
              '-1[minimum compression]'
              '-2[a little more compression]'
              '-3[slightly more compression]'
              '-4[a bit more compression]'
              '-5[even more compression]'
              '-6[slightly even more compression]'
              '-7[getting there]'
              '-8[close to maximum compression]'
              '-9[maximum compression]')
            ;;
        esac
      fi
    
      _arguments -C \
        '--format=-[format of the resulting archive]:archive format:__git_archive_formats' \
        '(- :)'{-l,--list}'[list available archive formats]' \
        '(-v --verbose)'{-v,--verbose}'[report progress to stderr]' \
        '--prefix=-[prepend the given path prefix to to each filename]:path prefix:_directories -r ""' \
        $backend_args \
        '--remote=-[archive remote repository]:remote repository:__git_any_repositories' \
        '--exec=-[path to git-receive-pack on remote]:remote path:_files' \
        ':tree-ish:__git_tree_ishs' \
        '*:tree file:->files' && ret=0
    
      case $state in
        (files)
          __git_tree_files . $line[1] && ret=0
          ;;
      esac
    }
    
    (( $+functions[_git-applymbox] )) ||
    _git-applymbox () {
      _arguments -A '-*' \
        '-k[do not modify "Subject:" header]' \
        '-m[apply patches with "git-apply" and fail if patch is unclean]' \
        '-q[apply patches interactively]' \
        '-u[encode commit information in UTF-8]' \
        '(1)-c[restart command after fixing an unclean patch]:patch:_files -g ".dotest/0*"' \
        ':mbox file:_files' \
        '::signoff file:__git_signoff_file' && ret=0
    }
    
    (( $+functions[_git-bisect] )) ||
    _git-bisect () {
      local bisect_cmds
    
      bisect_cmds=(
        bad:"mark current or given revision as bad"
        good:"mark current or given revision as good"
        log:"show the log of the current bisection"
        next:"find next bisection to test and check it out"
        replay:"replay a bisection log"
        reset:"finish bisection search and return to the given branch (or master)"
        start:"reset bisection state and start a new bisection"
        visualize:"show the remaining revisions in gitk"
        skip:"choose a nearby commit"
        run:"run evaluation script"
      )
    
      if (( CURRENT == 2 )); then
        _describe -t command "git-bisect commands" bisect_cmds && ret=0
      else
        case $words[2] in
          (bad)
            _arguments \
              '2:revision:__git_commits' && ret=0
            ;;
          (good|skip)
            _arguments \
              '*:revision:__git_commits' && ret=0
            ;;
          (replay)
            _arguments \
              '2:file:_files' && ret=0
            ;;
          (reset)
            _arguments \
              '2:branch:__git_heads' && ret=0
            ;;
          (run)
            _arguments \
              '*::arguments: _normal' && ret=0
            ;;
          (start)
            if (( words[(I)--] < CURRENT && words[(I)--] > 0 )); then
              _arguments \
                '*:paths:_files' && ret=0
            else
              _arguments \
                '2:bad revision:__git_commits' \
                '*:good revision:__git_commits' && ret=0
            fi
            ;;
    
          (*)
            _nothing
            ;;
        esac
      fi
    }
    
    # TODO: complete branch names?
    (( $+functions[_git-branch] )) ||
    _git-branch () {
      declare -a dependent_deletion_args
      if (( words[(I)-d] || words[(I)-D] )); then
        dependent_deletion_args=(
          '-r[delete remote-tracking branches]'
          '*:branch-name:__git_branch_names')
      fi
    
      declare -a dependent_modification_args
      if (( words[(I)-m] || words[(I)-M] )); then
        dependent_modification_args=(
          ':old or new branch-name:__git_branch_names'
          '::new branch-name:__git_branch_names')
      fi
    
      # TODO: I’m not happy with having to force a pattern with -A.
      _arguments -S -A "-*" \
        - list \
          '(        --no-color)--color[turn on branch coloring]' \
          '(--color           )--no-color[turn off branch coloring]' \
          '(   -a)-r[list only the remote-tracking branches]' \
          '(-r   )-a[list both remote-tracking branches and local branches]' \
          '-v[show SHA1 and commit subject line for each head]' \
          $abbrev_arg \
          '--no-abbrev[do not abbreviate sha1s]' \
        - create \
          '-l[create the branch'\''s reflog]' \
          '-f[force the creation of a new branch]' \
          '--track[set up configuration so pull merges from the start point]' \
          '--no-track[override the branch.autosetupmerge configuration variable]' \
          '--contains=[only list branches which contain the specified commit]:commit:__git_committishs' \
          '--merged[only list branches which are fully contained by HEAD]' \
          '--no-merged[do not list branches which are fully contained by HEAD]' \
          ':branch-name:__git_branch_names' \
          '::start-point:__git_revisions' \
        - modify \
          '(   -M)-m[rename a branch and the corresponding reflog]' \
          '(-m   )-M[rename a branch even if the new branch-name already exists]' \
          $dependent_modification_args \
        - delete \
          '(   -D)-d[delete a fully merged branch]' \
          '(-d   )-D[delete a branch]' \
          $dependent_deletion_args && ret=0
    }
    __git_zstyle_default ':completion::complete:git-branch:delete-argument-rest:*' ignore-line yes
    
    # TODO: __git_tree_ishs is just stupid.  It should be giving us a list of tags
    # and perhaps also allow all that just with ^{tree} and so on.  Not quite sure
    # how to do that, though.
    (( $+functions[_git-checkout] )) ||
    _git-checkout () {
      local curcontext=$curcontext state line
      declare -A opt_args
    
      local new_branch_reflog_arg
    
      if (( words[(I)-b] > 0 )); then
        new_branch_reflog_arg='-l[create the new branch'\''s reflog]'
      fi
    
      if compset -N '--'; then
        __git_cached_files
      else
        _arguments -C -S \
            '-q[suppress feedback messages]' \
          - switch-branch \
            '-f[force a complete re-read]' \
            '-b[create a new branch based at given branch]: :__git_guard_branch-name' \
            {-t,--track}'[set up configuration so pull merges from the start point]' \
            '--no-track[override the branch.autosetupmerge configuration variable]' \
            '-l[create the branch'\''s reflog]' \
            $new_branch_reflog_arg \
            '-m[3way merge current branch, working tree and new branch]' \
            '::branch:__git_revisions' \
          - update-files \
            '::tree-ish:__git_tree_ishs' \
            '*::file:->files' && ret=0
      fi
    
      #XXX TODO and all that: $line[1] only works if you didn't write any options.
      #What's the variable that holds the tree-ish argument? Is it even reliably possible?
      case $state in
        (files)
          if [[ -n $line[1] ]] && __git_is_treeish $line[1]; then
            __git_tree_files . $line[1] && ret=0
          else
            __git_cached_files && ret=0
          fi
          ;;
      esac
    }
    
    (( $+functions[_git-cherry-pick] )) ||
    _git-cherry-pick () {
      _arguments \
        '(-e --edit)'{-e,--edit}'[edit commit before committing the revert]' \
        '(-n --no-commit)'{-n,--no-commit}'[do not make the actually commit]' \
        '(-r --replay)'{-r,--replay}'[use original commit message intact]' \
        '(-m --mainline)'{-m,--mainline}'[specify mainline when cherry-picking a merge commit]:parent number' \
        '-x[append information about what commit was cherry-picked]' \
        '(-s --signoff)'{-s,--signoff}'[add Signed-off-by line at the end of the commit message]' \
        ':commit:__git_revisions' && ret=0
    }
    
    (( $+functions[_git-clean] )) ||
    _git-clean () {
      _arguments -S -s \
        '-d[also remove untracked directories]' \
        '-n[do a dry run]' \
        '-f[required when clean.requireForce is true (default)]' \
        '-q[run quietly]' \
        '(-X   )-x[also remove ignored files]' \
        '(   -x)-X[remove only ignored files]' \
        '*:file:_files' && ret=0
    }
    
    # TODO: The --no-checkout is undocumented.
    (( $+functions[_git-clone] )) ||
    _git-clone () {
      _arguments -S \
        '--bare[make a bare GIT repository]' \
        '--mirror[clone refs into refs/* instead of refs/remotes/origin/*]' \
        '(-l --local)'{-l,--local}'[clone locally, hardlink refs and objects if possible]' \
        '(-s --shared)'{-s,--shared}'[share the objects with the source repository (warning: see man page)]' \
        '--reference[reference repository]:repository:_directories' \
        '(-q --quiet)'{-q,--quiet}'[operate quietly]' \
        '(-v --verbose)'{-v,--verbose}'[always display the progressbar]' \
        '(-n --no-checkout)'{-n,--no-checkout}'[do not checkout HEAD after clone is complete]' \
        '(-o --origin)'{-o,--origin}'[use given name instead of "origin" as branch name]:name:__git_guard_branch-name' \
        '--no-hardlinks[copy files instead of hardlinking when doing a local clone]' \
        $upload_pack_arg \
        $template_arg \
        '--depth[create a shallow clone, given number of revisions deep]: :_guard "[[\:digit\:]]##" depth' \
        ':repository:__git_any_repositories' \
        ':directory:_directories' && ret=0
    }
    
    (( $+functions[_git-commit] )) ||
    _git-commit () {
      _arguments -S \
        '--allow-empty[allow recording an empty commit]' \
        '(-a --all --interactive)'{-a,--all}'[update all paths in the index file]' \
        '(-a --all --interactive)--interactive[interactively update paths in the index file]' \
        '--author[override the author name used in the commit]:author name' \
        '--cleanup=-[specify how the commit message should be cleaned up]:mode:((verbatim\:"don'\''t change the commit message at all"
                                                                                 whitespace\:"remove leading and trailing whitespace lines"
                                                                                 strip\:"remove both whitespace and commentary lines"
                                                                                 default\:"act as '\''strip'\'' if the message is to be edited and as '\''whitespace'\'' otherwise"))' \
        '(-e --edit)'{-e,--edit}'[edit the commit message before committing]' \
        '(-o --only -i --include)'{-i,--include}'[update the given files and commit the whole index]' \
        '(-o --only -i --include)'{-o,--only}'[commit only the given files]' \
        '(-n --no-verify)'{-n,--no-verify}'[do not look for suspicious lines the commit introduces]' \
        '(-s --signoff)'{-s,--signoff}'[add Signed-off-by line at the end of the commit message]' \
        '(-q --quiet -v --verbose)'{-q,--quiet}'[suppress commit summary message]' \
        '(-q --quiet -v --verbose)'{-v,--verbose}'[show unified diff of all file changes]' \
        '(-u --untracked-files)'{-u,--untracked-files}'[show files in untracked directories]' \
        '*:file:__git_changed_files' \
        - '(message)' \
          '--amend[amend the tip of the current branch]' \
          {-c,--reedit-message=}'[use existing commit object and edit log message]:commit:__git_commits' \
          {-C,--reuse-message=}'[use existing commit object with same log message]:commit:__git_commits' \
          {-F,--file=}'[read commit message from given file]:file:_files' \
          {-m,--message=}'[use the given message as the commit message]:message' && ret=0
    }
    __git_zstyle_default ':completion::complete:git-commit:argument-rest:*' ignore-line yes
    
    
    # TODO: __git_files should be __git_tree_files (do like in git-diff-tree and
    # such)
    (( $+functions[_git-diff] )) ||
    _git-diff () {
      _arguments -S \
        $diff_args \
        '(--cached --staged)'{--cached,--staged}'[show diff between index and named commit]' \
        '::commit range:__git_commit_ranges' \
        '::original revision:__git_objects' \
        '::new revision:__git_objects' \
        '*::index file:__git_files' && ret=0
    }
    
    (( $+functions[_git-fetch] )) ||
    _git-fetch () {
      _arguments \
        $common_fetch_args \
        ':repository:__git_any_repositories' \
        '*:refspec:__git_ref_specs' && ret=0
    }
    
    (( $+functions[_git-format-patch] )) ||
    _git-format-patch () {
      _arguments \
        $diff_args \
        '(-h --help)'{-h,--help}'[display usage information]' \
        '(-k --keep-subject -n --numbered)'{-k,--keep-subject}'[do not strip/add \[PATCH\] from the first line of the commit message]' \
        '(-k --keep-subject -n --numbered)'{-n,--numbered}'[name output in \[PATCH n/m\] format]' \
        '--start-number=[start numbering patches at given number]: :_guard "[[\:digit\:]]" "patch number"' \
        '(-o --output-directory --stdout)'{-o,--output-directory}'[store resulting files in given directory]:directory:_directories' \
        '(-o --output-directory)--stdout[output the generated mbox on standard output (implies --mbox)]' \
        '(-s --signoff)'{-s,--signoff}'[add "Signed-off-by:" line to the commit message]' \
        '--attach=-[create attachments instead of inlining patches]::git version string' \
        '--thread[make the second and subsequent mails refer to the first]' \
        '--in-reply-to=[make the first mail a reply to the given message]:message id' \
        '--ignore-if-in-upstream[do not include a patch that matches a commit in the given range]' \
        '--suffix[use the given suffix for filenames]:filename suffix' \
        '--subject-prefix=[use the given prefix instead of \[PATCH\]]:prefix' \
        '--cc=[add a Cc: header, may be given multiple times]:email address' \
        '--cover-letter[generate a cover letter template]' \
        '--no-binary[do not output contents of changes in binary files, only note that they differ]' \
        ':commit range:__git_commit_ranges' && ret=0
    }
    
    (( $+functions[_git-gc] )) ||
    _git-gc () {
      _arguments \
        '--aggressive[more aggressively optimize]' \
        '--auto[check whether housekeeping is required]' \
        '--quiet[suppress all progress reports]' && ret=0
    }
    
    (( $+functions[_git-grep] )) ||
    _git-grep () {
      local -a pattern_operators
    
      if (( words[(I)-e] == CURRENT - 2 )); then
        pattern_operators=(
          '--and[both patterns must match]'
          '--or[either pattern must match]'
          '--not[the following pattern must not match]')
      fi
    
      local curcontext=$curcontext state line
      declare -A opt_args
    
      _arguments -A '--*' \
        '--cached[grep blobs registered in index file instead of working tree]' \
        '(-a --text)'{-a,--text}'[process binary files as if they were text]' \
        '(-i --ignore-case)'{-i,--ignore-case}'[ignore case when matching]' \
        '(-w --word-regexp)'{-w,--word-regexp}'[match only whole words]' \
        '(-v --invert-match)'{-v,--invert-match}'[select non-matching lines]' \
        '(   -H)-h[supress output of filenames]' \
        '(-h   )-H[show filenames]' \
        '--full-name[output paths relative to the project top directory]' \
        '(-E --extended-regexp -G --basic-regexp)'{-E,--extended-regexp}'[use POSIX extended regexes]' \
        '(-E --extended-regexp -G --basic-regexp)'{-G,--basic-regexp}'[use POSIX basic regexes]' \
        '-n[prefix the line number to matching lines]' \
        '(-l --files-with-matches -L --files-without-match --name-only)'{-l,--files-with-matches,--name-only}'[show only names of matching files]' \
        '(-l --files-with-matches -L --files-without-match)'{-L,--files-without-match}'[show only names of non-matching files]' \
        {-z,--null}'[output \0 after filenames]' \
        '(-c --count)'{-c,--count}'[show number of matching lines in files]' \
        '-A[show trailing context]: :_guard "[[\:digit\:]]#" lines' \
        '-B[show leading context]: :_guard "[[\:digit\:]]#" lines' \
        '-C[show context]: :_guard "[[\:digit\:]]#" lines' \
        '(1)*-f[read patterns from given file]:pattern file:_files' \
        '(1)*-e[use the given pattern for matching]:pattern' \
        $pattern_operators \
        '--all-match[all patterns must match]' \
        ':pattern:' \
        '*::tree-or-file:->files' && ret=0
    
      case $state in
        (files)
          integer first_tree last_tree start end
    
          (( start = words[(I)(-f|-e)] > 0 ? 1 : 2 ))
          (( end = $#line - 1 ))
    
          for (( i = start; i <= end; i++ )); do
            [[ line[i] == '--' ]] && break
            git cat-file -e "${(Q)line[i]}^{tree}" 2>/dev/null || break
            if (( first_tree == 0 )); then
              (( first_tree = last_tree = i ))
            else
              (( last_tree = i ))
            fi
          done
    
          if (( last_tree == 0 || last_tree == end )); then
            if (( first_tree == 0 )); then
              _alternative \
                'tree:tree:__git_trees' \
                "file:file:__git_cached_files" && ret=0
            else
              _alternative \
                'tree:tree:__git_trees' \
                "tree file:tree-files:__git_tree_files .  $line[first_tree,last_tree]" && ret=0
            fi
          else
            if (( first_tree == 0 )); then
              __git_cached_files
            else
              __git_tree_files . $line[first_tree,last_tree]
            fi
          fi
          ;;
      esac
    }
    
    (( $+functions[_git-log] )) ||
    _git-log () {
      local curcontext=$curcontext state line
      declare -A opt_args
    
      __git_setup_revision_arguments
    
      _arguments -S \
        $revision_arguments \
        '--source[show which ref each commit is reached from]' \
        '--decorate[print out ref names of any commits that are shown]' \
        '*:file-or-branch:->files' && ret=0
    
      case $state in
        (files)
          _arguments -S \
            '::branch:__git_commit_ranges2' \
            '*:index file:__git_cached_files' && ret=0
          ;;
      esac
    }
    
    # TODO: repository needs fixing
    (( $+functions[_git-ls-remote] )) ||
    _git-ls-remote () {
      _arguments \
        '(-h --heads)'{-h,--heads}'[show only refs under refs/heads]' \
        '(-t --tags)'{-t,--tags}'[show only refs under refs/tags]' \
        $upload_pack_arg \
        ':repository:__git_any_repositories' \
        '*: :__git_references' && ret=0
    }
    
    (( $+functions[_git-merge] )) ||
    _git-merge () {
      _arguments \
        "$merge_args[@]" \
        '-m:merge message' \
        '*:remote:__git_commits' && ret=0
    }
    
    (( $+functions[_git-mv] )) ||
    _git-mv () {
      _arguments \
        '-f[force renaming/moving even if targets exist]' \
        '-k[skip move/renames that would lead to errors]' \
        '-n[only show what would happen]' \
        '*:source:__git_cached_files' \
        ':destination:_files' && ret=0
    }
    
    (( $+functions[_git-pull] )) ||
    _git-pull () {
      _arguments \
        "$merge_args[@]" \
        $common_fetch_args \
        ':repository:__git_any_repositories' \
        '*:refspec:__git_ref_specs' && ret=0
    }
    
    # NOTE: For --receive-pack we use _files to complete, even though this will
    # only complete files on the local end, not the remote end.  Still, it may be
    # helpful to get some sort of completion going, perhaps modifying the path
    # later on to match the remote end.
    (( $+functions[_git-push] )) ||
    _git-push () {
      _arguments \
        $force_ref_arg \
        '--all[push all refs under refs/heads/]' \
        '--mirror[push all refs under refs/heads/ and refs/tags/ and delete non-existing refs]' \
        '--dry-run[do everything except actually send the updates]' \
        '--tags[all tags under "$GIT_DIR/refs/tags" are pushed]' \
        '(--receive-pack --exec)'{--receive-pack=-,--exec=-}'[path to git-receive-pack on remote]:remote path:_files' \
        '--repo=-[default repository to use]:repository:__git_any_repositories' \
        '(       --no-thin)--thin[try to minimize number of objects to be sent]' \
        '(--thin          )--no-thin[do not try to minimize number of objects to be sent]' \
        $verbose_arg \
        '::repository:__git_any_repositories' \
        '*::refspec:__git_ref_specs' && ret=0
    }
    
    (( $+functions[_git-rebase] )) ||
    _git-rebase () {
      if [[ $words[2] == --(abort|continue|skip) ]]; then
        _message 'no more options'
      else
        _arguments \
          '--onto[start new branch with HEAD equal to "newbase"]:newbase:__git_revisions' \
          '--continue[continue after failure]' \
          '--abort[abort current rebase]' \
          '--skip[skip the current patch]' \
          '--whitespace=-[detect a new or modified line that ends with trailing whitespaces]: :__git_apply_whitespace_strategies' \
          '(-m --merge)'{-m,--merge}'[use merging strategies to rebase]' \
          '*'{-s,--strategy=-}'[use given merge strategy]:merge strategy:__git_merge_strategies' \
          $verbose_arg \
          '--no-verify[bypass the pre-rebase hook]' \
          '-C-[ensure that given lines of surrounding context match]: :_guard "[[\:digit\:]]##" "lines of context"' \
          '(-i --interactive)'{-i,--interactive}'[make a list of commits to be rebased and open in $EDITOR]' \
          '(-p --preserve-merges)'{-p,--preserve-merges}'[try to recreate merges instead of ignoring them]' \
          ':upstream branch:__git_revisions' \
          '::working branch:__git_revisions' && ret=0
      fi
    }
    
    (( $+functions[_git-repack] )) ||
    _git-repack () {
      _arguments -s -w \
        '(-A)-a[pack all objects into a single pack]' \
        '(-a)-A[pack all objects into a single pack, but unreachable objects become loose]' \
        '-d[remove redundant packs after packing]' \
        '-f[pass "--no-reuse-objects" option to "git pack-objects"]' \
        '-l[pass "--local" option to "git pack-objects"]' \
        '-n[do not update server information]' \
        '-q[pass "-q" option to "git pack-objects"]' \
        '--max-pack-size=-[maximum size of each output packfile]:MiB' \
        '--window-memory=-[scale window size dynamically to not use more than N bytes of memory]:bytes' \
        '--window=-[number of objects to consider when doing delta compression]:N' \
        '--depth=-[maximum delta depth]:N' && ret=0
    }
    
    (( $+functions[_git-rerere] )) ||
    _git-rerere () {
      declare -a commands
    
      commands=(
        'clear:reset the metadata used by rerere'
        'diff:output diffs for the current state of the resolution'
        'status:like diff, but only output filesames'
        'gc:prune old records of conflicted merges')
    
      _describe -t commands 'command' commands
    }
    
    (( $+functions[_git-reset] )) ||
    _git-reset () {
      local curcontext=$curcontext state line
      typeset -A opt_args
    
      _arguments -C -S -A '-*' \
          '(-q --quiet)'{-q,--quiet}'[be quiet, only report errors]' \
          '::commit:__git_revisions' \
        - reset-head \
          '(        --soft --hard --merge --keep)--mixed[reset the index but not the working tree (default)]' \
          '(--mixed        --hard --merge --keep)--soft[do not touch the index file nor the working tree]' \
          '(--mixed --soft        --merge --keep)--hard[match the working tree and index to the given tree]' \
          '(--mixed --soft --hard         --keep)--merge[reset out of a conflicted merge]' \
          '(--mixed --soft --hard --merge       )--keep[like --hard, but keep local working tree changes]' \
        - reset-paths \
          '(-p --patch)'{-p,--patch}'[select diff hunks to remove from the index]' \
          '*::file:->files' && ret=0
    
      case $state in
        (files)
          local commit
          if [[ -n $line[1] ]] && __git_is_committish $line[1]; then
            commit=$line[1]
          else
            commit=HEAD
          fi
          __git_tree_files . $commit && ret=0
          ;;
      esac
    }
    
    (( $+functions[_git-revert] )) ||
    _git-revert () {
      _arguments -s -w \
        '(-e --edit)'{-e,--edit}'[edit the commit before committing the revert]' \
        '--no-edit[do not edit the commit message]' \
        '-x[append commit name when cherry-picking]' \
        '(-m --mainline)'{-m+,--mainline=}'[pick which parent is mainline]:parent number' \
        '(-n --no-commit)'{-n,--no-commit}'[do not commit the reversion]' \
        '(-s --signoff)'{-s,--signoff}'[add Signed-off-by line at the end of the commit message]' \
        ':commit:__git_commits' && ret=0
    }
    
    # TODO: should take all arguments found in setup_revisions() (probably more or
    # less what git-rev-list takes).
    (( $+functions[_git-shortlog] )) ||
    _git-shortlog () {
      __git_setup_revision_arguments
    
      _arguments -S \
        $revision_arguments \
        '(: -)'{-h,--help}'[print a short usage message and exit]' \
        '(-n --numbered)'{-n,--numbered}'[sort according to number of commits]' \
        '(-s --summary)'{-s,--summary}'[suppress commit description]' \
        '*::commitish:__git_committishs' && ret=0
    }
    
    # TODO: --date-order is undocumented.
    # TODO: Better completion of --reflog.
    (( $+functions[_git-show-branch] )) ||
    _git-show-branch () {
      _arguments -S \
        '(--more        --independent --merge-base)--list[synonym to "--more=-1"]' \
        - branches \
          '(-a --all)'{-a,--all}'[show both remote-tracking branches and local branches]' \
          '(-r --remotes)'{-r,--remotes}'[show remote-tracking branches]' \
          '(       --list --independent --merge-base)--more=-[go given number of commit beyond common ancestor (no ancestry if negative)]:: :_guard "[[\:digit\:]]" limit' \
          '(--more --list               --merge-base)--independent[show only the reference that can not be reached from any of the other]' \
          '(--more --list --independent             )--merge-base[act like "git-merge-base -a" but with two heads]' \
          '--current[include current branch to the list of revs]' \
          '(          --sha1-name)--no-name[do not show naming strings for each commit]' \
          '(--no-name            )--sha1-name[name commits with unique prefix of object names]' \
          '--topo-order[show commits in topological order]' \
          '--topics[show only commits that are NOT on the first branch given]' \
          '--sparse[output merges that are reachable from multiple tips being shown]' \
          '--date-order[undocumented]' \
          '*:revision:__git_revisions' \
        - reflogs \
          '(-g --reflog)'{-g,--reflog=-}'[show reflog entries for given ref]::number of entries and base' \
          ':reference:__git_references' && ret=0
    }
    
    (( $+functions[_git-status] )) ||
    _git-status () {
      _git-commit
    }
    __git_zstyle_default ':completion::complete:git-status:argument-rest:*' ignore-line yes
    
    
    (( $+functions[__git_stashes] )) ||
    __git_stashes () {
      local expl
      declare -a st_list
    
      st_list=(${${(f)"$(_call_program stashes git stash list 2>/dev/null)"}/: */})
      __git_command_successful || return
    
      _wanted tags expl stash-list compadd $* - $st_list
    }
    
    (( $+functions[_git-stash] )) ||
    _git-stash () {
      local expl
      local -a stash_cmds
    
      stash_cmds=(
        apply:"restore the changes recorded in the stash"
        branch:"branch off at the commit at which the stash was originally created"
        clear:"remove all the stashed states"
        drop:"remove a single stashed state from the stash list"
        list:"list the stashes that you currently have"
        pop:"remove and apply a single stashed state from the stash list"
        save:"save your local modifications to a new stash"
        show:"show the changes recorded in the stash as a diff"
      )
    
      if (( CURRENT == 2 )); then
        _describe -t command "git-stash commands" stash_cmds && ret=0
      else
        case $words[2] in
          (apply)
            _arguments \
              '--index[try to reinstate the index'\''s changes too]' \
              '*:stash:__git_stashes' && ret=0
            ;;
          (branch)
            _arguments \
              '2:branch name:' \
              '*:stash:__git_stashes' && ret=0
            ;;
          (drop|pop|show)
            _arguments \
              '*:stash:__git_stashes' && ret=0
            ;;
          (save)
            _arguments \
              '--keep-index[all changes already added to the index are left intact]' \
              '*: :->end' && ret=0
    
            [[ $state == 'end' ]] && _message 'message'
            ;;
          (*)
            _nothing
            ;;
        esac
      fi
    }
    
    (( $+functions[_git-verify-tag] )) ||
    _git-verify-tag () {
      _arguments \
        ':tag:__git_tags' && ret=0
    }
    
    # TODO: This should take those arguments that git-diff-tree can take, as well.
    (( $+functions[_git-whatchanged] )) ||
    _git-whatchanged () {
      __git_setup_revision_arguments
    
      _arguments -S \
        $revision_arguments \
        '1::commit id:__git_commits2' \
        '*:managed file:__git_cached_files' && ret=0
    }
    
    (( $+functions[_git-applypatch] )) ||
    _git-applypatch () {
      _arguments \
        ':message file:_files' \
        ':patch file:_files' \
        ':info file:_files' \
        '::signoff file:__git_signoff_file' && ret=0
    }
    
    # TODO: Need to combine the list of attributes defined in __git_attributes.
    (( $+functions[_git-check-attr] )) ||
    _git-check-attr () {
      local -a attributes
    
      attributes=(crlf ident filter diff merge)
    
      local only_attributes=1
      for (( i = 2; i < $#words; i++ )); do
        if (( attributes[(I)$words[i]] == 0 )); then
          only_attributes=0
          break
        fi
      done
    
      if (( !only_attributes || words[(I)--] )); then
        __git_files && ret=0
      else
        _alternative \
          'files:file:__git_files' \
          'attributes:attribute:__git_attributes' && ret=0
      fi
    }
    
    # TODO: archive/branch can use _arch_archives perhaps?
    (( $+functions[_git-archimport] )) ||
    _git-archimport () {
      _arguments \
        '-a[auto-register archives at http://mirrors.sourcecontrol.net]' \
        '-D[attempt to import trees that have been merged from]: :_guard "[[\:digit\:]]#" depth' \
        '-f[use the fast patchset import strategy]' \
        $help_arg \
        '-o[use old-style branch names]' \
        '-T[create a tag for every commit]' \
        '-t[use given directory as temporary directory]:directory:_directories' \
        $verbose_arg \
        ':archive/branch' \
        '::archive/branch'
    }
    
    (( $+functions[_git-convert-objects] )) ||
    _git-convert-objects () {
      _nothing
    }
    
    # TODO: Could use _cvs_root from _cvs for completing argument to -d.
    # TODO: -h is undocumented.
    (( $+functions[_git-cvsexportcommit] )) ||
    _git-cvsexportcommit () {
      _arguments \
        '-c[commit automatically if the patch applied cleanly]' \
        '-p[be pedantic (paranoid) when applying patches]' \
        '-a[add authorship information]' \
        '-d[set an alternative CVSROOT to use]:cvsroot' \
        '-f[force the merge, even if the files are not up to date]' \
        '-P[force the parent commit, even if it is not a direct parent]' \
        '-m[prepend the commit message with the provided prefix]:message prefix' \
        $verbose_arg \
        $help_arg \
        '::parent commit id:__git_commits' \
        ':commit id:__git_commits' && ret=0
    }
    
    # TODO: _cvs_root for -d would be nice
    (( $+functions[_git-cvsimport] )) ||
    _git-cvsimport () {
      _arguments \
        $author_conversion_file_arg \
        '-C[specify the git repository to import into]:directory:_directories' \
        '-d[specify the root of the CVS archive]:cvsroot' \
        $help_arg \
        '-i[do not perform a checkout after importing]' \
        '-k[remove keywords from source files in the CVS archive]' \
        '-m[attempt to detect merges based on the commit message]' \
        '*-M[attempt to detect merges based on the commit message with custom pattern]:pattern' \
        '-o[specify the branch into which you wish to import]:branch:__git_branch_names' \
        '-P[read cvsps output file]:file:_files' \
        '-p[specify additional options for cvsps]:cvsps-options' \
        '-r[the git remote to import into]:remote' \
        '-s[substitute the "/" character in branch names with given substitution]:substitute' \
        '-u[convert underscores in tag and branch names to dots]' \
        '-S[skip paths matching given regex]:regex' \
        '-a[import all commits, including recent ones]' \
        '-L[limit the number of commits imported]:limit' \
        $verbose_arg \
        '-z[specify timestamp fuzz factor to cvsps]:fuzz-factor' \
        ':cvsmodule' && ret=0
    }
    
    (( $+functions[_git-cvsserver] )) ||
    _git-cvsserver () {
      _message "you probably should not be issuing this command; it is an internal git helper"
    }
    
    (( $+functions[_git-lost-found] )) ||
    _git-lost-found () {
      _nothing
    }
    
    (( $+functions[_git-pack-refs] )) ||
    _git-pack-refs () {
      _arguments \
        '--all[pack all refs]' \
        '(        --no-prune)--prune[remove loose refs after packing them]' \
        '(--prune           )--no-prune[don'\''t remove loose refs after packing them]' && ret=0
    }
    
    # TODO: something better
    (( $+functions[_git-merge-one-file] )) ||
    _git-merge-one-file () {
      _message "you probably should not be issuing this command"
    }
    
    (( $+functions[_git-prune] )) ||
    _git-prune () {
      _arguments -S \
        '-n[do not remove anything; just report what would have been removed]' \
        '--expire:time:' \
        '*::heads:__git_heads' && ret=0
    }
    
    (( $+functions[_git-relink] )) ||
    _git-relink () {
      _arguments \
        '--safe[stop if two objects with the same hash exist but have different sizes]' \
        ':directory:_directories' \
        ':directory:_directories' \
        '*:directory:_directories' && ret=0
    }
    
    # TODO: import stuff from _svn
    # TODO: Improve completion of -P argument.
    (( $+functions[_git-svnimport] )) ||
    _git-svnimport () {
      _arguments \
        $author_conversion_file_arg \
        '-b[specify the name of the SVN branches directory]:directory:_directories' \
        '-C[specify the git repository to import into]:directory:_directories' \
        '-d[use direct HTTP-requests if possible for logs only]:path' \
        '-D[use direct HTTP-requests if possible]:path' \
        $help_arg \
        '-i[do not perform a checkout after importing]' \
        '-l[limit the number of SVN changesets to pull]: :_guard "[[\:digit\:]]#" number' \
        '-m[attempt to detect merges based on the commit message]' \
        '-M[attempt to detect merges based on the commit message with custom pattern]:pattern' \
        '-o[specify the branch into which you wish to import]:branch' \
        '-r[prepend "rX: " to commit messages, where X is the subversion revision]' \
        '-s[specify the change number to start importing from]:start-revision' \
        '-T[specify the name of the SVN tags directory]:directory:_directories' \
        '-t[specify the name of the SVN trunk]:trunk:_directories' \
        '-I[import svn:ignore directory property to files with given name]:ignored file:_files' \
        '-R[specify how often git repository should be repacked]: :_guard "[[\:digit\:]]#" "number of revisions"' \
        '-P[import only given path of the SVN tree]::_directory' \
        $verbose_arg \
        ':svn-repositry-url:_urls' \
        '::directory:_directories' && ret=0
    }
    
    # TODO: how do we complete argument 1?
    (( $+functions[_git-symbolic-ref] )) ||
    _git-symbolic-ref () {
      _arguments -A '-*' \
        '-q[do not issue error if specified name is not a symbolic ref]' \
        '-m[update reflog for specified name with specied reason]:reason for update' \
        ':symbolic reference' \
        '::reference:__git_references' && ret=0
    }
    
    (( $+functions[_git-tag] )) ||
    _git-tag () {
      local message_args=
    
      if (( words[(I)-[asu]] )); then
        message_args=(
          '(   -F)-m[specify tag message]:message'
          '(-m   )-F[read tag message from given file]:message file:_files')
      fi
    
      _arguments -A '-*' \
        - creation \
          '(   -s -u)-a[create an unsigned, annotated tag]' \
          '(-a    -u)-s[create an signed and annotated tag]' \
          '(-a -s   )-u[create a tag, annotated and signed with the given key]:secret key:__git_gpg_secret_keys' \
          '(   -v)-f[create a new tag even if one with the same name already exists]' \
          '(-f   )-v[verifies the gpg signutare of the given tag]' \
          '--contains=[only list tags which contain the specified commit]:commit:__git_committishs' \
          $message_args \
          ':tag name:__git_tags' \
          '::head:__git_revisions' \
        - deletion \
          '-d[delete tags]:*:tag names:__git_tags' \
        - listing \
          '-l[list tags matching pattern]:pattern' && ret=0
    }
    __git_zstyle_default ':completion::complete:git-tag:deletion-option-d-rest:*' ignore-line yes
    
    (( $+functions[_git-update-ref] )) ||
    _git-update-ref () {
      _arguments \
        '-m[update reflog for specified name with specied reason]:reason for update' \
        '(:)-d[delete given reference after verifying its value]:symbolic reference:__git_revisions:old reference:__git_revisions' \
        ':symbolic reference:__git_revisions' \
        ':new reference:__git_revisions' \
        '::old reference:__git_revisions' && ret=0
    }
    
    (( $+functions[_git-check-ref-format] )) ||
    _git-check-ref-format () {
      _arguments \
        ':reference:__git_revisions' && ret=0
    }
    
    
    (( $+functions[_git-cherry] )) ||
    _git-cherry () {
      _arguments \
        $verbose_arg \
        ':upstream:__git_revisions' \
        '::head:__git_revisions' \
        '::limit:__git_revisions' && ret=0
    }
    
    (( $+functions[_git-count-objects] )) ||
    _git-count-objects () {
      _arguments \
        '-v[also report number of in-pack objects and objects that can be removed]' && ret=0
    }
    
    # TODO: do better than _directories?  The directory needs to be a git-repository,
    # so one could check for a required file in the given directory.
    # TODO: --interpolated-path should complete %H, %CH, %IP, %P, and %D.
    (( $+functions[_git-daemon] )) ||
    _git-daemon () {
      _arguments -S \
        '--strict-paths[match paths exactly]' \
        '--base-path=-[remap all the path requests as relative to the given path]:path:_directories' \
        '--interpolated-path=-[dynamically construct alternate paths]:path:_directories' \
        '--export-all[allow pulling from all repositories without verification]' \
        '(--port --listen --user --group)--inetd[run server as an inetd service]' \
        '(--inetd)--listen=-[listen on a specific IP address or hostname]:hostname:_hosts' \
        '(--inetd)--port=-[specify port to listen to]:port:_ports' \
        '--init-timeout=-[specify timeout between connection and request]: :_guard "[[\:digit\:]]#" timeout' \
        '--timeout=-[specify timeout for sub-requests]: :_guard "[[\:digit\:]]#" timeout' \
        '--syslog[log to syslog instead of stderr]' \
        '--user-path=-[allow ~user notation to be used in requests]::path:_directories' \
        '--verbose[log details about incoming connections and requested files]' \
        '--reuseaddr[reuse addresses when already bound]' \
        '(--syslog)--detach[detach from the shell]' \
        '--pid-file=-[save the process id in given file]:pid file:_files' \
        '--user=-[set uid of daemon]:user:_users' \
        '--group=-[set gid of daemon]:group:_groups' \
        '--enable=-[enable site-wide service]:service:__git_daemon_service' \
        '--disable=-[disable site-wide service]:service:__git_daemon_service' \
        '--allow-override[allow overriding site-wide service]:service:__git_daemon_service' \
        '--forbid-override[forbid overriding site-wide service]:service:__git_daemon_service' \
        '*:repository:_directories' && ret=0
    }
    
    (( $+functions[_git-get-tar-commit-id] )) ||
    _git-get-tar-commit-id () {
      _message 'no arguments allowed; accepts tar-file on standard input'
    }
    
    (( $+functions[_git-instaweb] )) ||
    _git-instaweb () {
      _arguments \
        '(-l --local)'{-l,--local}'[bind the web server to 127.0.0.1]' \
        '(-d --httpd)'{-d,--httpd=}'[HTTP-daemon command-line that will be executed]:command line' \
        '(-m --module-path)'{-m,--module-path=}'[module path for the Apache HTTP-daemon]:module path:_directories' \
        '(-p --port)'{-p,--port=}'[port to bind web server to]: :_guard "[[\:digit\:]]" port' \
        '(-b --browser)'{-b,--browser=}'[web-browser command-line that will be executed]:command line' \
        '--start[start the HTTP-daemon and exit]' \
        '--stop[start the HTTP-daemon and exit]' \
        '--restart[restart the HTTP-daemon and exit]' && ret=0
    }
    
    (( $+functions[_git-mailinfo] )) ||
    _git-mailinfo () {
      _arguments \
        '-k[do not strip/add \[PATCH\] from the first line of the commit message]' \
        '(-u --encoding)-u[encode commit information in UTF-8]' \
        '(-u --encoding)--encoding[encode commit information in given encoding]:encoding:__git_encodings' \
        ':message file:_files' \
        ':patch file:_files' && ret=0
    }
    
    # TODO:
    # /* Backwards compatibility: if no -o specified, accept
    #      or just  */
    (( $+functions[_git-mailsplit] )) ||
    _git-mailsplit () {
      _arguments -S \
        '-b[if file does not begin with "From " line, assume it is a single mail message]' \
        '-d-[specify number of leading zeros]: :_guard "[[\:digit\:]]#" precision' \
        '-f-[skip the first N numbers]: :_guard "[[\:digit\:]]#" number' \
        '-o-[directory in which to place individual messages]:directory:_directories' \
        '*::mbox file:_files' && ret=0
    }
    
    (( $+functions[_git-patch-id] )) ||
    _git-patch-id () {
      _message 'no arguments allowed; accepts patch on standard input'
    }
    
    (( $+functions[_git-request-pull] )) ||
    _git-request-pull () {
      _arguments \
        ':start commit:__git_commits' \
        ':url:_urls' \
        '::end commit:__git_commits'
    }
    
    (( $+functions[_git-rev-parse] )) ||
    _git-rev-parse () {
      _arguments \
        '(--revs-only --no-revs)--revs-only[do not output flags and parameters not meant for "git-rev-list"]' \
        '(--revs-only --no-revs)--no-revs[do not output flags and parameters meant for "git-rev-list"]' \
        '(--flags --no-flags)--flags[do not output non-flag parameters]' \
        '(--flags --no-flags)--no-flags[do not output flag parameters]' \
        '--default[use "arg" if there is no parameter given]:arg' \
        '--verify[verify parameter to be usable]' \
        '--sq[output single shell-quoted line]' \
        '--not[toggle ^ prefix of object names]' \
        '--symbolic[output in a format as true to input as possible]' \
        '--all[show all refs found in $GIT_DIR/refs]' \
        '--branches[show branch refs found in $GIT_DIR/refs/heads]' \
        '--tags[show tag refs found in $GIT_DIR/refs/tags]' \
        '--remotes[show tag refs found in $GIT_DIR/refs/remotes]' \
        '--show-prefix[show path of current directory relative to top-level directory]' \
        '--show-cdup[show path of top-level directory relative to current directory]' \
        '--git-dir[show "$GIT_DIR" if defined else show path to ".git" directory]' \
        '--short=-[show only handful hexdigits prefix]:: :_guard "[[\:digit\:]]#" number' \
        {--after=-,--since=-}'[show "--max-age=" parameter corresponding given date string]:datestring' \
        {--before=-,--until=-}'[show "--min-age=" parameter corresponding given date string]:datestring' \
        '*:objects:__git_objects' && ret=0
    }
    
    (( $+functions[_git-runstatus] )) ||
    _git-runstatus () {
      _arguments \
        '--color[show colored status, highlighting modified files]' \
        '--nocolor[turn of colored output]' \
        '--amend[show status based on HEAD^1 instead of HEAD]' \
        '--verbose[show unified diff of all file changes]' \
        '--untracked[show files in untracked directories]' && ret=0
    }
    
    (( $+functions[_git-rm] )) ||
    _git-rm () {
      _arguments -S -A '-*' \
        '-f[override the up-to-date check]' \
        '-n[don'\''t actually remove the files, just show if they exist in the index]' \
        '-r[allow recursive removal when a leading directory-name is given]' \
        '--cached[only remove files from the index]' \
        '--ignore-unmatch[exit with 0 status even if no files matched]' \
        '(-q --quiet)'{-q,--quiet}'[do not output files deleted]' \
        '*:files:__git_cached_files' && ret=0
    }
    
    (( $+functions[_git-send-email] )) ||
    _git-send-email () {
      _arguments \
        '--bcc=["Bcc:" value for each email]:email address:_email_addresses' \
        '--cc=[starting "Cc:" value for each email]:email address:_email_addresses' \
        '(--no-chain-reply-to)--chain-reply-to[each email will be sent as a reply to the previous one sent]' \
        '(--chain-reply-to)--no-chain-reply-to[all emails after the first will be sent as replies to the first one]' \
        '--compose[use $EDITOR to edit an introductory message for the patch series]' \
        '--from=[specify the sender of the emails]:email address:_email_addresses' \
        '--in-reply-to=[specify the contents of the first In-Reply-To header]:message-id' \
        '--no-signed-off-by-cc[do not add emails foudn in "Signed-off-by:" lines to the "Cc:" list]' \
        '--quiet[be less verbose]' \
        '--smtp-server=[specify the outgoing smtp server]:smtp server:_hosts' \
        '--subject=[specify the initial subject of the email thread]:subject' \
        '--suppress-from[do not add the "From:" address to the "Cc:" list]' \
        '--dry-run[do everything except actually send the emails]' \
        '--envelope-sender[specify the envelope sender used to send the emails]:email address:_email_addresses' \
        '--to=[specify the primary recipient of the emails]:email address:_email_addresses' \
        '*:file:_files' && ret=0
    }
    
    # TODO: --minimize-connections is undocumented.
    # TODO: --remote is undocumented.
    # TODO: --log-window-size is undocumented.
    # TODO: --config-dir is undocumented.
    # TODO: --no-auth-cache is undocumented.
    # TODO: -C and --copy-similarity are undocumented.
    # TODO: --fetch-all and --all are undocumented.
    # TODO: -v and --verbose are undocumented.
    # TODO: -r and --revisions for show-ignore are undocumented.
    # TODO: migrate is undocumented.
    # TODO: --minimize for migrate is undocumented.
    # TODO: -r, --color, --pager, and --non-recursive for log are undocumented.
    # TODO: --message, -m, --file, -F, --revision, and -r for commit-diff are
    # undocumented.
    (( $+functions[_git-svn] )) ||
    _git-svn () {
      local curcontext=$curcontext state line
      declare -A opt_args
    
      _arguments -C \
        '(- :)--version[display version information]' \
        '(- :)--help[display help message]' \
        ':command:->command' \
        '*::options:->options' && ret=0
    
      case $state in
        (command)
          declare -a commands
    
          commands=(
            'init:initialize an empty git repository with additional svn data'
            'fetch:fetch revisions from the SVN remote'
            'clone:same as init, followed by fetch'
            'rebase:fetch revs from SVN parent of HEAD and rebase current work on it'
            'dcommit:commit diffs from given head onto SVN repository'
            'branch:create a branch in the SVN repository'
            'tag:create a tag in the SVN repository'
            'log:output SVN log-messages'
            'blame:show what revision and author last modified each line of a file:'
            'find-rev:output git commit corresponding to the given SVN revision'\''s hash'
            'set-tree:commit given commit or tree to SVN repository'
            'create-ignore:recursively finds the svn:ignore property and creates .gitignore files'
            'show-ignore:output corresponding toplevel .gitignore file of svn:ignore'
            'commit-diff:commit diff of two tree-ishs'
            'info:show information about a file or directory'
            'proplist:list the SVN properties stored for a file or directory'
            'propget:get a given SVN property for a file'
            'show-externals:show the subversion externals')
            _describe -t commands command commands && ret=0
          ;;
        (options)
          declare -a arguments
    
          if [[ $line[1] == (fetch|clone|dcommit|set-tree|rebase|migrate|init) ]]; then
            arguments+=(
              '--username=[username to use for SVN transport]:username:_users'
              '--config-dir=[undocumented]:configuration directory:_directories'
              '--no-auth-cache[undocumented]')
          fi
    
          if [[ $line[1] == (fetch|clone|dcommit|set-tree|rebase|log) ]]; then
            arguments+=(
              '(   --authors-file)'$author_conversion_file_arg
              '(-A               )'$long_author_conversion_file_arg)
          fi
    
          # TODO: --repack-flags can be improved by actually completing the legal
          # flags to git-repack.
          if [[ $line[1] == (fetch|clone|dcommit|set-tree|rebase) ]]; then
            arguments+=(
              '(-q --quiet)'{-q,--quiet}'[make git-svn less verbose]'
              '--repack=[repack files (for given number of revisions)]:: :_guard "[[\:digit\:]]#" "revision limit"'
              '(--repack-flags --repack-args --repack-opts)'{--repack-flags=,--repack-args=,--repack-opts=}'[flags to pass to git-repack]:git-repack flags'
              '(                --no-follow-parent)--follow-parent[follow parent commit]'
              '(--follow-parent                   )--no-follow-parent[do not follow parent commit]'
              '--log-window-size=[undocumented]')
          fi
    
          if [[ $line[1] == (clone|init) ]]; then
            arguments+=(
              $shared_arg
              $template_arg
              '(-T --trunk)'{-T-,--trunk=}'[set trunk sub-directory]:trunk sub-directory:->subdirectory'
              '(-t --tags)'{-t-,--tags=}'[set tags sub-directory]:tags sub-directory:->subdirectory'
              '(-b --branches)'{-b-,--branches=}'[set branches sub-directory]:branches sub-directory:->subdirectory'
              '--stdlayout[shorthand for setting trunk,tags,branches as relative paths, the SVN default]'
              '--no-metadata[set svn-remote.X.noMetadata]'
              '--use-svm-props[set svn-remote.X.useSvmProps]'
              '--use-svnsync-props[set svn-remote.X.useSvnsyncProps]'
              '--rewrite-root=[set svn-remote.X.rewriteRoot]:new root'
              '--use-log-author[use author from the first From: or Signed-Off-By: line, when fetching into git]'
              '--add-author-from[when committing to svn, append a From: line based on the git commit'\''s author string]'
              '--prefix=[prefix to use for names of remotes]:path prefix:_directories -r ""')
          fi
    
          if [[ $line[1] == (dcommit|set-tree|commit-diff) ]]; then
            arguments+=(
              '--rmdir[remove empty directories from SVN tree after commit]'
              '(-e --edit)'{-e,--edit}'[edit commit message before committing]'
              $find_copies_harder_arg
              $diff_l_arg
              '(-C --copy-similarity)'{-C-,--copy-similarity=}'[undocumented]:number')
          fi
    
          if [[ $line[1] == (fetch|clone|log|create-ignore|info|propget|proplist|show-externals) ]]; then
            arguments+=(
              '(-r --revision)'{-r,--revision}'[only fetch given revision or revision range]:revision:->__git_svn_revisions'
              '::svn remote:__git_svn-remotes')
          fi
    
          if [[ $line[1] == (dcommit|rebase) ]]; then
            arguments+=(
              '(-m --merge)'{-m,--merge}'[use merging strategies, if necessary]'
              '*'{-s,--strategy=-}'[use given merge strategy]:merge strategy:__git_merge_strategies')
          fi
    
          if [[ $line[1] == (fetch|dcommit|rebase) ]]; then
            arguments+=(
              '(--fetch-all --all)'{--fetch-all,--all}'[undocumented]')
          fi
    
          if [[ $line[1] == (dcommit|log|rebase) ]]; then
            arguments+=(
              '(-v --verbose)'{-v,--verbose}'[output extra information]')
          fi
    
          case $line[1] in
            (clone)
              arguments+=(
                ':url:_urls'
                '::directory:_directories')
              ;;
            (set-tree)
              arguments+=('--stdin[read list of commits to commit from stdin]')
              ;;
            (show-ignore)
              arguments+=('-r --revision)'{-r,--revision}'[undocumented]:revision:->__git_svn_revisions')
              ;;
            (dcommit)
              arguments+=(
                '(-n --dry-run)'{-n,--dry-run}'[output git-commands that would show diffs that would be committed]'
                '--no-rebase[do not rebase or reset after committing]'
                '--commit-url[commit to a different SVN url]:SVN URL:_url')
              ;;
            (branch)
              arguments+=(
                '(-m --message)'{-m,--message}'[specify the commit message]:message'
                '(-t --tag)'{-t,--tag}'[create a tag]')
              ;;
            (migrate)
              arguments+=(
                '--minimize[undocumented]')
              ;;
            (log)
              __git_setup_revision_arguments
    
              arguments+=(
                $revision_arguments
                '(-r --revision)'{-r-,--revision=}'[revisions to output log information for]: :__git_svn_revision_numbers'
                '--limit=[like --max-count, but not counting merged/excluded commits]: :_guard "[[\:digit\:]]#" limit'
                '--incremental[give output suitable for concatenation]'
                '--show-commit[output git commit SHA-1, as well]'
                '--oneline[similar to --pretty=oneline]'
                '--color[undocumented]'
                '--pager[undocumented]:pager:_files -g *(*)'
                '--non-recursive[undocumented]')
              ;;
            (blame)
              arguments+=(
                '--git-format[produce output in git-blame format, with SVN revision numbers instead of git commit hashes]')
              ;;
            (rebase)
              arguments+=(
                '--local[do not fetch remotely, rebase against the last fetched commit from SVN]')
              ;;
            (commit-diff)
              arguments+=(
                '(-m --message)'{-m-,--message=}'[undocumented]:message'
                '(-F --file)'{-F-,--file=}'[undocumented]:file:_files'
                '(-r --revision)'{-r-,--revision=}'[undocumented]:revision:__git_svn_revisions')
              ;;
          esac
    
          _arguments -C \
            '(-h -H --help)'{-h,-H,--help}'[display usage information]' \
            '(-V --version)'{-V,--version}'[display version information]' \
            '--minimize-connections[undocumented]' \
            '(-R --svn-remote --remote)'{-R,--svn-remote,--remote}'[svn remote to use]:svn remote:__git_svn-remotes' \
            '(-i --id)'{-i,--id}'[set GIT_SVN_ID]:GIT_SVN_ID' \
            $arguments && ret=0
    
          case $state in
            (subdirectory)
              _alternative \
                'sub-directories:sub-directory:_directories' \
                'urls: :_urls' && ret=0
              ;;
          esac
          ;;
      esac
    }
    
    (( $+functions[_git-stripspace] )) ||
    _git-stripspace () {
      _message 'no arguments allowed; accepts input file on standard input'
    }
    
    (( $+functions[_git-mergetool] )) ||
    _git-mergetool () {
      local curcontext=$curcontext state line
      typeset -A opt_args
    
      _arguments -C \
        '(-t --tool)'{-t,--tool=}':merge resolution tool:(kdiff3 tkdiff meld xxdiff emerge vimdiff gvimdiff opendiff)' \
        '*:conflicted file:_files' && ret=0
    }
    
    # ---
    
    (( $+functions[__git_guard] )) ||
    __git_guard () {
      declare -A opts
    
      zparseopts -K -D -A opts M: J: V: 1 2 n F: X:
    
      [[ "$PREFIX$SUFFIX" != $~1 ]] && return 1
    
      if (( $+opts[-X] )); then
        _message -r $opts[-X]
      else
        _message -e $2
      fi
    
      [[ -n "$PREFIX$SUFFIX" ]]
    }
    
    __git_guard_branch-name () {
      if [[ -n "$PREFIX$SUFFIX" ]]; then
        _call_program check-ref-format git check-ref-format "refs/heads/$PREFIX$SUFFIX" &>/dev/null
        (( ${#pipestatus:#0} > 0 )) && return 1
      fi
    
      _message -e 'branch-name'
    
      [[ -n "$PREFIX$SUFFIX" ]]
    }
    
    __git_guard_diff-stat-width () {
      if [[ $PREFIX == *,* ]]; then
        compset -P '*,'
        _guard "[[:digit:]]#" "filename width"
      else
        compset -S ',*'
        _guard "[[:digit:]]#" "width"
      fi
    }
    
    (( $+functions[__git_command_successful] )) ||
    __git_command_successful () {
      if (( ${#pipestatus:#0} > 0 )); then
        _message 'not a git repository'
        return 1
      fi
      return 0
    }
    
    (( $+functions[__git_objects] )) ||
    __git_objects () {
      compset -P '*:'
      if [[ -n $IPREFIX ]]; then
        __git_tree_files "$PREFIX" "${IPREFIX%:}"
      else
        _alternative \
          'revisions:revision:__git_revisions' \
          'files:file:__git_files'
      fi
    }
    
    (( $+functions[__git_trees] )) ||
    __git_trees () {
      __git_objects
    }
    
    (( $+functions[__git_tree_ishs] )) ||
    __git_tree_ishs () {
      __git_commits
    }
    
    (( $+functions[__git_blobs] )) ||
    __git_blobs () {
      __git_objects
    }
    
    (( $+functions[__git_stages] )) ||
    __git_stages () {
      __git_guard $* "[[:digit:]]#" 'stage'
    }
    
    (( $+functions[__git_files_relative] )) ||
    __git_files_relative () {
      local rawfiles files file f_parts prefix p_parts tmp
    
      prefix=$(_call_program gitprefix git rev-parse --show-prefix 2>/dev/null)
      __git_command_successful || return
    
      # Empty prefix, no modifications
      if (( $#prefix == 0 )); then
        print $1
        return
      fi
    
      rawfiles=(${(ps:\0:)1})
      files=()
    
      # Now we assume that we've given "absolute" paths list with "root"
      # being repository top directory.  $prefix is also "absolute" path.
      for file in $rawfiles; do
        # Collapse "/./" and "//", strip "/." and "/" from tail (I know,
        # this is a bit paranoid).
        f_parts=(${(s:/:)"${${${${file//\/\///}//\/.\///}%%/.}%%/}"})
        p_parts=(${(s:/:)"${${${${prefix//\/\///}//\/.\///}%%/.}%%/}"})
        tmp=()
    
        # Strip common path prefix.
        while (( $#f_parts > 0 )) && (( $#p_parts > 0 )) && [[ $f_parts[1] == $p_parts[1] ]]; do
          f_parts[1]=()
          p_parts[1]=()
        done
    
        # If prefix still not empty, ascend up.
        while (( $#p_parts > 0 )); do
    	tmp+=..
    	p_parts[1]=()
        done
    
        # Add remaining path.
        tmp=("$tmp[@]" "$f_parts[@]")
    
        files+=${(j:/:)tmp}
      done
    
      print ${(pj:\0:)files}
    }
    
    (( $+functions[__git_files] )) ||
    __git_files () {
      local expl files ls_opts opts gitdir gitcdup
    
      zparseopts -D -E -a opts -- -cached -deleted -modified -others -ignored -unmerged -killed
    
      gitdir=$(_call_program gitdir git rev-parse --git-dir 2>/dev/null)
      __git_command_successful || return
    
      gitcdup=$(_call_program gitcdup git rev-parse --show-cdup 2>/dev/null)
      __git_command_successful || return
    
      ls_opts=("--exclude-per-directory=.gitignore")
      [[ -f "$gitdir/info/exclude" ]] && ls_opts+="--exclude-from=$gitdir/info/exclude"
    
      files=$(_call_program files git ls-files -z --full-name $ls_opts $opts -- $gitcdup 2>/dev/null)
      __git_command_successful || return
      files=(${(ps:\0:)"$(__git_files_relative $files)"})
      __git_command_successful || return
    
      _wanted files expl 'index file' _multi_parts $@ - / files
    }
    
    (( $+functions[__git_cached_files] )) ||
    __git_cached_files () {
      __git_files $* --cached
    }
    
    (( $+functions[__git_deleted_files] )) ||
    __git_deleted_files () {
      __git_files $* --deleted
    }
    
    (( $+functions[__git_killed_files] )) ||
    __git_killed_files () {
      __git_files $* --killed
    }
    
    (( $+functions[__git_modified_files] )) ||
    __git_modified_files () {
      __git_files $* --modified
    }
    
    (( $+functions[__git_other_files] )) ||
    __git_other_files () {
      __git_files $* --others
    }
    
    (( $+functions[__git_unmerged_files] )) ||
    __git_unmerged_files () {
      __git_files $* --unmerged
    }
    
    #this is for git-commit which can take files both git-added and not
    (( $+functions[__git_changed_files] )) ||
    __git_changed_files () {
      local files
    
      files=$(_call_program files git diff-index -z --name-only --no-color HEAD 2>/dev/null)
      __git_command_successful || return
      files=(${(ps:\0:)"$(__git_files_relative $files)"})
      __git_command_successful || return
    
      _wanted files expl 'index file' _multi_parts $@ - / files
    }
    
    (( $+functions[__git_tree_files] )) ||
    __git_tree_files () {
      local multi_parts_opts
      local tree Path
      integer at_least_one_tree_added
      local -a tree_files compadd_opts
    
      zparseopts -D -E -a compadd_opts V: J: 1 2 n f X: M: P: S: r: R: q F:
    
      [[ "$1" == */ ]] && Path="$1" || Path="${1:h}/"
      shift
      (( at_least_one_tree_added = 0 ))
      for tree in $*; do
        tree_files+=(${(ps:\0:)"$(_call_program tree-files git ls-tree --name-only -z $tree $Path 2>/dev/null)"})
        __git_command_successful && (( at_least_one_tree_added = 1 ))
      done
    
      if (( !at_least_one_tree_added )); then
        return 1
      fi
    
      local expl
      _wanted files expl 'tree file' _multi_parts -f $compadd_opts -- / tree_files
    }
    
    # TODO: deal with things that __git_heads and __git_tags has in common (i.e.,
    # if both exists, they need to be completed to heads/x and tags/x.
    (( $+functions[__git_commits] )) ||
    __git_commits () {
      _alternative \
        'heads::__git_heads' \
        'tags::__git_tags'
    }
    
    (( $+functions[__git_committishs] )) ||
    __git_committishs () {
      __git_commits
    }
    
    # TODO: deal with prefixes and suffixes listed in git-rev-parse
    (( $+functions[__git_revisions] )) ||
    __git_revisions () {
      __git_commits $*
    }
    
    (( $+functions[__git_commits2] )) ||
    __git_commits2 () {
      compset -P '\\\^'
      __git_commits
    }
    
    (( $+functions[__git_commit_ranges] )) ||
    __git_commit_ranges () {
      compset -P '*..'
      __git_commits $*
    }
    
    (( $+functions[__git_commit_ranges2] )) ||
    __git_commit_ranges2 () {
      _alternative \
        'commits::__git_commits2' \
        'ranges::__git_commit_ranges'
    }
    
    # FIXME: these should be imported from _ssh
    # TODO: this should take -/ to only get directories
    _remote_files () {
      # There should be coloring based on all the different ls -F classifiers.
      local expl rempat remfiles remdispf remdispd args suf ret=1
    
      if zstyle -T ":completion:${curcontext}:files" remote-access; then
        zparseopts -D -E -a args p: 1 2 4 6 F:
        if [[ -z $QIPREFIX ]]
        then rempat="${PREFIX%%[^./][^/]#}\*"
        else rempat="${(q)PREFIX%%[^./][^/]#}\*"
        fi
        remfiles=(${(M)${(f)"$(_call_program files ssh $args -a -x ${IPREFIX%:} ls -d1FL "$rempat" 2>/dev/null)"}%%[^/]#(|/)})
        compset -P '*/'
        compset -S '/*' || suf='remote file'
    
    #    remdispf=(${remfiles:#*/})
        remdispd=(${(M)remfiles:#*/})
    
        _tags files
        while _tags; do
          while _next_label files expl ${suf:-remote directory}; do
    #        [[ -n $suf ]] && compadd "$@" "$expl[@]" -d remdispf \
    #	    ${(q)remdispf%[*=@|]} && ret=0
    	compadd ${suf:+-S/} "$@" "$expl[@]" -d remdispd \
    	    ${(q)remdispd%/} && ret=0
          done
          (( ret )) || return 0
        done
        return ret
      else
        _message -e remote-files 'remote file'
      fi
    }
    
    (( $+functions[__git_remote_repository] )) ||
    __git_remote_repository () {
      local service
    
      service= _ssh
    
      if compset -P '*:'; then
        _remote_files
      else
        _ssh_hosts -S:
      fi
    }
    
    (( $+functions[__git_repository] )) ||
    __git_repository () {
      _alternative \
        'directories::_directories' \
        'remote repositories::__git_remote_repository'
    }
    
    # should also be $GIT_DIR/remotes/origin
    (( $+functions[__git_any_repositories] )) ||
    __git_any_repositories () {
      _alternative \
        'directories::_directories' \
        'remotes::__git_remotes' \
        'remote repositories::__git_remote_repository'
    }
    
    (( $+functions[__git_remotes] )) ||
    __git_remotes () {
      local expl gitdir remotes
    
      gitdir=$(_call_program gitdir git rev-parse --git-dir 2>/dev/null)
      __git_command_successful || return
    
    #  zparseopts -a opts X+:
    #
    #  if (( !$opts[(I)-X] )); then
    #    descr=remote
    #  fi
    
      remotes=(${${(f)"$(_call_program remotes git config --get-regexp '"^remote\..*\.url$"')"}//#(#b)remote.(*).url */$match[1]})
      __git_command_successful || return
    
      # TODO: Should combine the two instead of either or.
      if (( $#remotes > 0 )); then
        _wanted remotes expl remote compadd $* - $remotes
      else
        _wanted remotes expl remote _files $* - -W "($gitdir/remotes)" -g "$gitdir/remotes/*"
      fi
    }
    
    (( $+functions[__git_ref_specs] )) ||
    __git_ref_specs () {
      if compset -P '*:'; then
        __git_heads
      else
        compset -P '+'
        if compset -S ':*'; then
          __git_heads
        else
          _alternative \
           'tags:tag:__git_tags' \
           'heads:head:__git_heads -qS :'
        fi
      fi
    }
    
    (( $+functions[__git_signoff_file] )) ||
    __git_signoff_file () {
      _alternative \
        'signoffs:signoff:(yes true me please)' \
        'files:signoff file:_files'
    }
    
    (( $+functions[__git_tag_ids] )) ||
    __git_tag_ids () {
    }
    
    (( $+functions[__git_heads] )) ||
    __git_heads () {
      local expl
      declare -a branch_names
    
      branch_names=(${${(f)"$(_call_program headrefs git for-each-ref --format='"%(refname)"' refs/heads refs/remotes 2>/dev/null)"}#refs/(heads|remotes)/})
      __git_command_successful || return
    
      _wanted heads expl branch-name compadd $* - $branch_names HEAD FETCH_HEAD ORIG_HEAD MERGE_HEAD
    }
    
    (( $+functions[__git_tags] )) ||
    __git_tags () {
      local expl
      declare -a tag_names
    
      tag_names=(${${(f)"$(_call_program tagrefs git for-each-ref --format='"%(refname)"' refs/tags 2>/dev/null)"}#refs/tags/})
      __git_command_successful || return
    
      _wanted tags expl tag-name compadd $* - $tag_names
    }
    
    # TODO: depending on what options are on the command-line already, complete
    # only tags or heads
    # TODO: perhaps caching is unnecessary.  usually won’t contain that much data
    # TODO: perhaps provide alternative here for both heads and tags (and use
    # __git_heads and __git_tags)
    # TODO: instead of "./.", we should be looking in the repository specified as
    # an argument to the command (but default to "./." I suppose (why not "."?))
    (( $+functions[__git_references] )) ||
    __git_references () {
    #  _alternative \
    #    'heads::__git_heads' \
    #    'tags::__git_tags' && ret=0
      local expl
    
      # TODO: deal with GIT_DIR
      if [[ $_git_refs_cache_pwd != $PWD ]]; then
        _git_refs_cache=(${${${(f)"$(_call_program references git ls-remote ./. 2>/dev/null)"}#*$'\t'}#refs/(heads|tags)/})
        __git_command_successful || return
        _git_refs_cache_pwd=$PWD
      fi
    
      _wanted references expl 'references' compadd - $_git_refs_cache
    }
    
    (( $+functions[__git_local_references] )) ||
    __git_local_references () {
      local expl
    
      if [[ $_git_local_refs_cache_pwd != $PWD ]]; then
        _git_local_refs_cache=(${${${(f)"$(_call_program references git ls-remote ./. 2>/dev/null)"}#*$'\t'}#refs/})
        __git_command_successful || return
        _git_local_refs_cache_pwd=$PWD
      fi
    
      _wanted references expl 'references' compadd - $_git_local_refs_cache
    }
    
    (( $+functions[__git_remote_references] )) ||
    __git_remote_references () {
      __git_references
    }
    
    (( $+functions[__git_branch_names] )) ||
    __git_branch_names () {
      local expl
      declare -a branch_names
    
      branch_names=(${${(f)"$(_call_program branchrefs git for-each-ref --format='"%(refname)"' refs/heads 2>/dev/null)"}#refs/heads/})
      __git_command_successful || return
    
      _wanted branch-names expl branch-name compadd $* - $branch_names
    }
    
    # TODO: Add merge.*.(name|driver|recursive) and diff.*.(command|funcname) (see
    # gitattributes(5)).
    (( $+functions[__git_config_name] )) ||
    __git_config_name () {
      local label=names
    
      declare -a names
    
      if [[ -prefix alias.* ]]; then
        _message 'command-alias name'
      elif [[ -prefix branch.*.* ]]; then
        compset -P 'branch.*.'
    
        names=(
          'remote:what remote git-fetch should fetch'
          'merge:default refspec to be marked for merging')
      elif [[ -prefix branch.* ]]; then
        compset -P 'branch.'
    
        __git_branch_names -S '.' -r '.'
        return
      elif [[ -prefix remote.*.* ]]; then
        compset -P 'remote.*.'
    
        names=(
          'url:URL of a remote repository'
          'fetch:default set of refspecs for git-fetch'
          'push:default set of refspecs for git-push'
          'skipDefaultUpdate:whether to skip this remote when running git-remote'
          'receivepack:default program to execute on remote when pushing'
          'uploadpack:default program to execute on remote when fetching'
          'tagopt:options for retrieving remote tags')
      elif [[ -prefix remote.* ]]; then
        compset -P 'remote.'
    
        __git_remotes -S '.' -r '.'
        return
      elif [[ -prefix remotes.* ]]; then
        compset -P 'remotes.'
    
        __git_remote-groups
        return
      elif [[ -prefix gitcvs.* ]]; then
        names=(
          'enabled:whether the cvs pserver interface is enabled'
          'logfile:name of log file for cvs pserver'
          'allbinary:whether to treat all files from CVS as binary')
    
        if [[ -prefix gitcvs.*.* ]]; then
          compset -P 'gitcvs.*.'
    
          label="gitcvs ${${words[CURRENT]#gitcvs.}%.*}-specific setting"
        else
          compset -P 'gitcvs.'
    
          label='gitcvs setting'
    
          names+=(
            'dbname:name of database to use'
            'dbdriver:name of DBI driver to use'
            'dbuser:username to connect to database as'
            'dbpass:password to use when connecting to database')
    
          declare -a suffixed_names
          suffixed_names=(
            'ext:ext-connection-method-specific settings'
            'pserver:pserver-connection-method-specific settings')
    
          _describe -t suffixed-names 'gitcvs connection-specific setting' suffixed_names -M 'm:{a-zA-Z}={A-Za-z}' -M 'r:|.=* r:|=*' -S '.' -r '.' && ret=0
        fi
      elif [[ -prefix svn-remote.*.* ]]; then
        compset -P 'svn.*.'
    
        label="git-svn ${${words[CURRENT]#svn.}%.*}-specific setting"
    
        names=(
          'noMetadata:disable git-svn-id\: lines at end of commits (fetch, clone, dcommit, set-tree, rebase)'
          'useSvmProps:whether to use remappings of URLs and UUIDs from mirrors (fetch, clone, dcommit, set-tree, rebase)'
          'useSvnsyncProps:similar to useSvmProps, but for the svnsync command (fetch, clone, dcommit, set-tree, rebase)'
          'rewriteRoot:alternate root URL to use')
    
      elif [[ -prefix svn-remote.* ]]; then
        compset -P 'svn-remote.'
    
        __git_svn-remotes -M 'm:{a-zA-Z}={A-Za-z}' -M 'r:|.=* r:|=*' -S '.' -r '.' && ret=0
        return
      else
        names=(
          'core.fileMode:whether differences in the executable bit is relevant'
          'core.autocrlf:what type of conversion of CRLF'\''s git should do'
          'core.symlinks:whether symlinks are treated as special files or not'
          'core.gitProxy:command to execute to establish a connection to remote server'
          'core.ignoreStat:whether modification times of files are ignored'
          'core.preferSymlinkRefs:whether symbolic-reference files should be symlinks'
          'core.bare:whether this repository has a working tree or not'
          'core.logAllRefUpdates:whether to log updates of references'
          'core.repositoryFormatVersion:internal variable determining the repository version'
          'core.sharedRepository:what kind of sharing is done for this repository'
          'core.warnAmbiguousRefs:whether to warn if a ref name is ambiguous'
          'core.compression:level of compression to apply to packs'
          'core.legacyheaders:whether to use the legacy object-header-format'
          'core.packedGitWindowSize:size of mappings of pack files'
          'core.packedGitLimit:maximum number of bytes to map from pack files'
          'core.deltaBaseCacheLimit:maximum size of cache for base objects'
          'apply.whitespace:default value for the --whitespace option to git-apply'
          'color.branch:when to color output of git-branch'
          'color.branch.current:color of the current branch'
          'color.branch.local:color of a local branch'
          'color.branch.remote:color of a remote branch'
          'color.branch.plain:color of other branches'
          'color.diff:when to color diff output'
          'color.diff.plain:color of context text'
          'color.diff.meta:color of metainformation'
          'color.diff.frag:color of hunk headers'
          'color.diff.old:color of removed lines'
          'color.diff.new:color of added lines'
          'color.diff.commit:color of commit headers'
          'color.diff.whitespace:color of dubious whitespace'
          'color.interactive:when to color in interactive mode'
          'color.interactive.header:color of header'
          'color.interactive.help:color of help'
          'color.interactive.prompt:color of prompt'
          'color.pager:whether the pager is fed colored output'
          'color.status:when to color output of git-status'
          'color.status.header:color of header text'
          'color.status.added:color of added, but not yet committed, files'
          'color.status.updated:color of updated, but not yet committed, files'
          'color.status.changed:color of changed, but not yet added in the index, files'
          'color.status.untracked:color of files not currently being tracked'
          'commit.template:template file for commit messages'
          'color.ui:when to color if output is capable; most generic option, overriding by more specific ones'
          'diff.renameLimit:number of files to consider when detecting copy/renames'
          'diff.renames:how hard to try to detect renames'
          'fetch.unpackLimit:maximum number of objects to unpack when fetching'
          'format.headers:additional email headers to include in email patches'
          'format.suffix:default suffix for output files from git-format-patch'
          'gc.packrefs:whether to allow git-gc to run git-pack-refs or not'
          'gc.reflogexpire:default age for "git reflog expire"'
          'gc.reflogexpireunreachable:default age for "git reflog expire" for unreachable'
          'gc.rerereresolved:number of days to keep records of resolved merges'
          'gc.rerereunresolved:number of days to keep records of unresolved merges'
          'http.sslVerify:whether to verify the SSL certificate for HTTPS'
          'http.sslCert:file containing SSL certificates for HTTPS'
          'http.sslKey:file containing the SSL private key for HTTPS'
          'http.sslCAInfo:file containing CA certificates to verify against for HTTPS'
          'http.sslCAPath:path containing files with CA certificates to verify against for HTTPS'
          'http.maxRequests:how many HTTP requests to launch in parallel'
          'http.lowSpeedLimit:lower limit for HTTP transfer-speed'
          'http.lowSpeedTime:duration for http.lowSpeedLimit'
          'http.noEPSV:whether to disable the use of the EPSV ftp-command'
          'i18n.commitEncoding:character encoding commit messages are stored in'
          'i18n.logOutputEncoding:character encoding commit messages are output in'
          'log.showroot:whether to show initial commit as a diff against an empty tree or not'
          'merge.summary:whether to include summaries of merged commits'
          'merge.tool:tool to use for merges (by git-mergetool)'
          'merge.verbosity:amount of output shown by recursive merge strategy'
          'pack.window:size of window used by git-pack-objects'
          'pull.octopus:default merge strategy to use when pulling multiple branches'
          'pull.twohead:default merge strategy to use when pulling a single branch'
          'repack.usedeltabaseoffset:whether to allow git-repack to use delta-base offsets'
          'show.difftree:default git-diff-tree options for git-show'
          'showbranch.default:default set of branches for git-show-branch'
          'tar.umask:umask to apply for git-tar-tree'
          'user.email:email address used for commits'
          'user.name:full name used for commits'
          'user.signingkey:default GPG key to use when creating signed tags'
          'whatchanged.difftree:default git-diff-tree arguments for git-whatchanged'
          'receive.unpackLimit:maximum number of objects to unpack when pushing'
          'receive.denyNonFastforwards:whether git-receive-pack denies ref updates which are not fast-forwards'
          'transfer.unpackLimit:default value for fetch.unpackLimit and receive.unpackLimit'
          'imap.Folder:IMAP folder to use with git-imap-send'
          'imap.Tunnel:tunneling command to use for git-imap-send'
          'imap.Host:host git-imap-send should connect to'
          'imap.User:user git-imap-send should log in as'
          'imap.Pass:password git-imap-send should use when logging in'
          'imap.Port:port git-imap-send should connect on'
          'instaweb.local:whether instaweb should bind to 127.0.0.1'
          'instaweb.httpd:HTTP-daemon command-line to execute for instaweb'
          'instaweb.port:port to bind HTTP daemon to for instaweb'
          'instaweb.browser:web-browser command-line to execute for instaweb'
          'instaweb.modulepath:module path for the Apache HTTP-daemon for instaweb'
          'svn.noMetadata:disable git-svn-id\: lines at end of commits (fetch, clone, dcommit, set-tree, rebase)'
          'svn.useSvmProps:whether to use remappings of URLs and UUIDs from mirrors (fetch, clone, dcommit, set-tree, rebase)'
          'svn.useSvnsyncProps:similar to useSvmProps, but for the svnsync command (fetch, clone, dcommit, set-tree, rebase)'
          'svn.followparent:whether to follow parent commit (fetch, clone, dcommit, set-tree, rebase)'
          'svn.authorsfile:default authors file to use (fetch, clone, dcommit, set-tree, rebase)'
          'svn.username:username to use for SVN transport (fetch, clone, dcommit, set-tree, rebase, init)'
          'svn.configdir:configuration directory to use (fetch, clone, dcommit, set-tree, rebase, init)'
          'svn.noauthcache:undocumented (fetch, clone, dcommit, set-tree, rebase, init)'
          'svn.quiet:make git-svn less verbose (fetch, clone, dcommit, set-tree, rebase)'
          'svn.repack:repack files (for given number of revisions) (fetch, clone, dcommit, set-tree, rebase)'
          'svn.repackflags:flags to pass to git-repack (fetch, clone, dcommit, set-tree, rebase)'
          'svn.logwindowsize:undocumented (fetch, clone, dcommit, set-tree, rebase)'
          'svn.shared:share repository amongst several users (init, clone)'
          'svn.template:directory to use as a template for the object database (init, clone)'
          'svn.trunk:trunk sub-directory to use (init, clone)'
          'svn.tags:tags sub-directory to use (init, clone)'
          'svn.branches:branches sub-directory to use (init, clone)'
          'svn.prefix:prefix to use for names on remotes (init, clone)'
          'svn.rmdir:remove empty directories from SVN tree after commit (dcommit, set-tree, commit-diff)'
          'svn.edit:edit commit message before committing (dcommit, set-tree, commit-diff)'
          'svn.findcopiesharder:try harder to find copies (dcommit, set-tree, commit-diff)'
          'svn.l:limit number of rename/copy targets to run (dcommit, set-tree, commit-diff)'
          'svn.copysimilarity:undocumented (dcommit, set-tree, commit-diff)'
          'svn.revision:only use given revision or revision range (fetch, clone, show-ignore, log, commit-diff)'
          'svn.merge:use merging strategies, if necessary (dcommit, rebase)'
          'svn.fetch-all:undocumented (fetch, dcommit, rebase)'
          'svn.stdin:read list of commits to commit from stdin (set-tree)'
          'svn.strategy:use given merge strategy (dcommit, rebase)'
          'svn.verbose:output extra information (dcommit, log, rebase)'
          'svn.dryrun:output git-commands that would show diffs that would be committed (dcommit)'
          'svn.minimize:undocumented (migrate)'
          'svn.limit:like --max-count, but not counting merged/excluded commits (log)'
          'svn.incremental:give output suitable for concatenation (log)'
          'svn.showcommit:output git commit SHA-1, as well (log)'
          'svn.oneline:similar to --pretty=oneline (log)'
          'svn.color:undocumented (log)'
          'svn.pager:undocumented (log)'
          'svn.nonrecursive:undocumented (log)'
          'svn.local:undocumented (rebase)'
          'svn.message:undocumented (commit-diff)'
          'svn.file:(commit-diff) undocumented')
    
        declare -a suffixed_names
    
        suffixed_names=(
          'alias:command aliases'
          'branch:prefix for branch-specific variables'
          'remote:prefix for remote-repository variables'
          'remotes:prefix for remote-groups'
          'gitcvs:prefix for git-cvsserver-specific variables'
          'svn-remote:prefix for git-svn remote-repository variables')
    
        _describe -t suffixed-names 'special name' suffixed_names -M 'm:{a-zA-Z}={A-Za-z}' -M 'r:|.=* r:|=*' -S '.' -r '.' && ret=0
      fi
    
      _describe -t names $label names -M 'm:{a-zA-Z}={A-Za-z}' -M 'r:|.=* r:|=*' && ret=0
    }
    
    (( $+functions[__git_config_gettable_name] )) ||
    __git_config_gettable_name () {
      local expl
      declare -a names
    
      # TODO: This is strictly not correct, as names can have equal signs in them
      # as well.  However, there’s no good way to tell from the output of
      # git-config, so this’ll have to do until we write our own .git/config
      # parser (which will never happen because it’s not worth the trouble).
      names=(${${(f)"$(_call_program names git config --list)"}%%\=*})
      __git_command_successful || return
    
      _wanted names expl 'names' compadd $names
    }
    
    (( $+functions[__git_config_filtered_gettable_name] )) ||
    __git_config_filtered_gettable_name () {
      local expl
      declare -a names
    
      # TODO: See __git_config_gettable_name for discussion on how to actually get
      # out the names, skipping the values.
      names=(${${(M)${${(f)"$(_call_program $2 git config --list)"}%%\=*}:#$1.*}#$1.})
      __git_command_successful || return
    
      _wanted $2 expl $3 compadd $names
    }
    
    (( $+functions[__git_remote-groups] )) ||
    __git_remote-groups () {
      __git_config_filtered_gettable_name 'remotes' remote-groups 'remote-groups'
    }
    
    (( $+functions[__git_svn-remotes] )) ||
    __git_svn-remotes () {
      local expl
      declare -a names
    
      # TODO: See __git_config_gettable_name for discussion on how to actually get
      # out the names, skipping the values.
      names=(${${${(M)${${(f)"$(_call_program $2 git config --list)"}%%\=*}:#svn-remote.*}#svn-remote.}%%.*})
      __git_command_successful || return
    
      _wanted svn-remotes expl 'svn remote' compadd $names
    }
    
    # TODO: It’d be really cool if both the default and the current value could be
    # shown for all values.
    (( $+functions[__git_config_values] )) ||
    __git_config_values () {
      local compadd_opts
    
      zparseopts -D -E -a compadd_opts M: J: V: 1 2 n F: X:
    
      case $1 in
        ((#i)core.fileMode)
          declare -a booleans
    
          booleans=(
            {true,yes}':track changes to executable bit of files'
            {false,no}':ignore changes to executable bit of files')
    
          _describe -t boolean 'boolean' booleans
          ;;
        ((#i)core.autocrlf)
          declare -a modes
    
          modes=(
            {true,yes}':convert CRLF to LF when reading and LF to CRLF when writing'
            {false,no}':leave CRLF at the end of lines in text files as is'
            'input:convert CRLF to LF when reading')
    
          _describe -t crlfmode 'crlf mode' modes
          ;;
        ((#i)core.symlinks)
          declare -a booleans
    
          booleans=(
            {true,yes}':record symlink files as such'
            {false,no}':check out symlinks as plain files that contain the link text')
    
          _describe -t boolean 'boolean' booleans
          ;;
        ((#i)core.gitProxy)
          _message 'proxy command'
          ;;
        ((#i)core.ignoreStat)
          declare -a booleans
    
          booleans=(
            {true,yes}':working-copy files are unchanged until marked as changed'
            {false,no}':use lstat() to determine if a file has changed')
    
          _describe -t boolean 'boolean' booleans
          ;;
        ((#i)core.preferSymlinkRefs)
          declare -a booleans
    
          booleans=(
            {true,yes}':use symbolic links for symbolic reference files'
            {false,no}':use "symref" files for symbolic reference files')
    
          _describe -t boolean 'boolean' booleans
          ;;
        ((#i)core.bare)
          declare -a booleans
    
          booleans=(
            {true,yes}':the repository does not have a working directory'
            {false,no}':the repository has a working directory')
    
          _describe -t boolean 'boolean' booleans
          ;;
        ((#i)core.logAllRefUpdates)
          declare -a booleans
    
          booleans=(
            {true,yes}':create ref files for branch heads'
            {false,no}':don'\''t automatically create ref files')
    
          _describe -t boolean 'boolean' booleans
          ;;
        ((#i)core.repositoryFormatVersion)
          _message 'repository format version string (internal)'
          ;;
        ((#i)core.sharedRepository)
          __git_repository_permissions
          ;;
        ((#i)core.warnAmbiguousRefs)
          declare -a booleans
    
          booleans=(
            {true,yes}':warn if a ref name matches multiple refs'
            {false,no}':ignore ambiguous ref names')
    
          _describe -t boolean 'boolean' booleans
          ;;
        ((#i)core.compression)
          declare -a levels
    
          levels=(
            '-1:default level of compression'
            '0:do not deflate files'
            '1:minimum compression'
            '2:a little more compression'
            '3:slightly more compression'
            '4:a bit more compression'
            '5:even more compression'
            '6:slightly even more compression'
            '7:getting there'
            '8:close to maximum compression'
            '9:maximum compression')
    
          _describe -t compression-level 'compression level' levels
          ;;
        ((#i)core.legacyheaders)
          declare -a booleans
    
          booleans=(
            {true,yes}':use compatiblity format for loose objects'
            {false,no}':use new, more efficient, format for loose objects')
    
          _describe -t boolean 'boolean' booleans
          ;;
        ((#i)core.(packedGit(WindowSize|Limit)|deltaBaseCacheLimit))
          _guard '[[:digit:]]#([kmg]|)' 'number of bytes'
          ;;
        ((#i)alias.*)
          _message 'git sub-command with arguments'
          ;;
        ((#i)apply.whitespace)
          __git_apply_whitespace_strategies
          ;;
        ((#i)branch.*.remote)
          __git_remotes
          ;;
        ((#i)branch.*.merge)
          __git_references
          ;;
        ((#i)color.(branch|diff|pager|status))
          declare -a booleans
    
          booleans=(
            {always,true}':always output in color'
            {never,false}':never output in color'
            'auto:output in color if to a terminal')
    
          _describe -t boolean 'boolean' booleans
          ;;
        ((#i)color.*.*)
          compset -P '* '
    
          case ($words[CURRENT]) in
            (?*' '?*' '*)
              if [[ $words[CURRENT] == *(bold|dim|ul|blink|reverse)* ]]; then
                __git_colors
              else
                __git_color_attributes
              fi
              ;;
            (*)
              local suffix q_flag
              if [[ $words[CURRENT] == [\"\']* ]]; then
                suffix=' '
                q_flag=-q
              else
                suffix='\ '
              fi
    
              if [[ $words[CURRENT] == *(bold|dim|ul|blink|reverse)* ]]; then
                __git_colors -S $suffix $q_flag
              else
                _alternative \
                  'colors:color:__git_colors -S $suffix $q_flag' \
                  'attributes:attribute:__git_color_attributes -S $suffix $q_flag'
              fi
              ;;
          esac
          ;;
        ((#i)diff.renameLimit)
          _guard "[[:digit:]]#" number
          ;;
        ((#i)diff.renames)
          declare -a settings
    
          settings=(
            {true,yes}':enable basic rename detection'
            {false,no}':don'\''t try to detect renames'
            {copies,copy}':detect file renames and copies')
    
          _describe -t values 'rename-detection setting' settings
          ;;
        ((#i)(fetch|receive|transfer).unpackLimit)
          _guard "[[:digit:]]#" 'maximum number of objects to unpack'
          ;;
        ((#i)format.headers)
          _message 'email header'
          ;;
        ((#i)format.suffix)
          _message 'filename suffix'
          ;;
        ((#i)gc.packrefs)
          declare -a values
    
          values=(
            {true,yes}':pack references when collecting garbage'
            {false,no}':leave references alone when collecting garbage'
            'notbare:pack references if the repository has a working directory')
    
          _describe -t values 'value' values
          ;;
        ((#i)gc.(reflogexpire(unreachable|)|rerere(un|)resolved))
          # TODO: It would be nice if the default value was shown under a separate
          # description/tag.
          __git_datetimes
          ;;
        ((#i)gitcvs.(*.|)enabled)
          declare -a booleans
    
          booleans=(
            {true,yes}':enable the cvs server interface'
            {false,no}':don'\''t enable the cvs server interface')
    
          _describe -t booleans 'boolean' booleans
          ;;
        ((#i)gitcvs.(*.|)logfile)
          _files
          ;;
        ((#i)gitcvs.(*.|)allbinary)
          declare -a booleans
    
          booleans=(
            {true,yes}':tell the client to treat all files as binary'
            {false,no}':treat files normally')
    
          _describe -t booleans 'boolean' booleans
          ;;
        ((#i)gitcvs.dbname)
          # TODO: In the future, when computers are self-aware and this won’t
          # really matter anymore, one could inspect what gitcvs.dbdriver is set to
          # and complete possible databases for that DBI driver.
          _message -e 'database name'
          ;;
        ((#i)gitcvs.dbdriver)
          declare -a drivers
    
          # TODO: Would be nice to only include those that are installed, but I
          # couldn’t figure out a good way of doing that when I wrote this code.
          drivers=(
            'SQLite:use the SQLite database driver (default)'
            'Pg:use the Pg database driver')
    
          _describe -t dbi-drivers 'DBI driver' drivers
          ;;
        ((#i)gitcvs.dbuser)
          local expl
    
          _description users expl 'database user'
          _users $expl
          ;;
        ((#i)gitcvs.dbpass)
          _message -e 'database password'
          ;;
        ((#i)http.sslVerify)
          declare -a booleans
    
          booleans=(
            {true,yes}':verify SSL certificates when fetching or pushing over HTTP'
            {false,no}':skip verification of SSL certificates')
    
          _describe -t booleans 'boolean' booleans
          ;;
        ((#i)http.sslCert)
          local expl
    
          _wanted files expl 'SSL certificate file' _files
          ;;
        ((#i)http.sslKey)
          local expl
    
          _wanted files expl 'SSL private-key file' _files
          ;;
        ((#i)http.sslCAInfo)
          local expl
    
          _wanted files expl 'certificates file' _files
          ;;
        ((#i)http.sslCAPath)
          local expl
    
          _wanted files expl 'CA certificates file' _files
          ;;
        ((#i)http.maxRequests)
          _guard "[[:digit:]]#" 'maximum number of requests'
          ;;
        ((#i)http.lowSpeedLimit)
          # TODO: Need a better description
          _guard "[[:digit:]]#([kmg]|)" number
          ;;
        ((#i)http.lowSpeedTime)
          _guard "[[:digit:]]#" seconds
          ;;
        ((#i)http.noEPSV)
          declare -a booleans
    
          booleans=(
            {true,yes}':don'\''t use EPSV mode over FTP (for stupid servers)'
            {false,no}':use EPSV mode over FTP')
    
          _describe -t booleans 'boolean' booleans
          ;;
        ((#i)i18n.(commitEncoding|logOutputEncoding))
          __git_encodings
          ;;
        ((#i)log.showroot)
          declare -a booleans
    
          booleans=(
            {true,yes}':show initial commit as a diff against an empty tree'
            {false,no}':hide initial commit')
    
          _describe -t booleans 'boolean' booleans
          ;;
        ((#i)merge.summary)
          declare -a booleans
    
          # TODO: Use (default) in more descriptions.
          booleans=(
            {true,yes}':include summaries in merge commit messages'
            {false,no}':don'\''t add summaries to merge commit messages (default)')
    
          _describe -t booleans 'boolean' booleans
          ;;
        ((#i)merge.tool)
          declare -a tools
    
          tools=(kdiff3 tkdiff meld xxdiff emerge vimdiff)
    
          _describe -t merge-tools 'merge tool' tools
          ;;
        ((#i)merge.verbosity)
          declare -a levels
    
          levels=(
            '0:only final error message if conflicts were detected'
            '1:conflicts'
            '2:conflicts and file changes'
            '5:debugging information')
    
          _describe -t verbosity-levels 'verbosity level' levels
          ;;
        ((#i)pack.window)
          _guard '[[:digit:]]#' 'window size'
          ;;
        ((#i)pull.(octopus|twohead))
          __git_merge_strategies
          ;;
        ((#i)remote.*.url)
          _urls
          ;;
        ((#i)remote.*.fetch)
          : TODO
          ;;
        ((#i)remote.*.push)
          : TODO
          ;;
        ((#i)remote.*.skipDefaultUpdate)
          declare -a booleans
    
          booleans=(
            {true,yes}':skip this remote by default'
            {false,no}':update this remote by default')
    
          _describe -t booleans 'boolean' booleans
          ;;
        ((#i)remote.*.(receivepack|uploadpack))
          # TODO: Perhaps actually use SSH here?
          local expl
    
          _wanted files expl "remote git-${${1##*.}%pack}-pack program" _files -g *(*)
          ;;
        ((#i)remote.*.tagopt)
          declare -a opts
    
          opts=(
            '--no-tags:don'\''t fetch tags automatically'
            '"":fetch tags as usual')
    
          _describe -t tag-options 'tag retrieval' opts
          ;;
        ((#i)remotes.*)
          compset -P '* '
    
          local suffix
          if [[ $words[CURRENT] == [\"\']* ]]; then
            suffix=' '
          else
            suffix='\ '
          fi
    
          # TODO: Should really only complete unique remotes, that is, not the same
          # remote more than once in the list.
          __git_remotes -S $suffix -q
          ;;
        ((#i)repack.usedeltabaseoffset)
          declare -a booleans
    
          booleas=(
            {true,yes}':allow creation of delta-base-offset packs'
            {false,no}':don'\''t create delta-base-offset packs')
    
          _describe -t booleans 'boolean' booleans
          ;;
        ((#i)show.difftree)
          # TODO: This should complete the options available to these two commands.
          _message 'default options to git-diff-tree and git-show'
          ;;
        ((#i)showbranch.default)
          __git_branch_names
          ;;
        ((#i)tar.umask)
          _alternative \
            'number: :_guard "[0-7]#" "numeric mode"' \
            'values:special value:((user:"use user'\''s current umask"))'
          ;;
        ((#i)user.email)
          _email_addresses
          ;;
        ((#i)user.name)
          _users
          ;;
        ((#i)user.signingkey)
          __git_gpg_secret_keys
          ;;
        ((#i)whatchanged.difftree)
          # TODO: This should complete the options available to git-diff-tree.
          _message 'default options to git-diff-tree when invoking git-whatchanged'
          ;;
        ((#i)receive.denyNonFastForwards)
          declare -a booleans
    
          booleans=(
            {true,yes}':git-receive-pack will deny a ref update that isn'\''t a fast forward'
            {false,no}':allow a ref update that isn'\''t a fast forward')
    
          _describe -t booleans 'boolean' booleans
          ;;
        ((#i)imap.folder)
          _mailboxes
          ;;
        ((#i)imap.tunnel)
          _message -e commands 'imap tunneling command'
          ;;
        ((#i)imap.host)
          _hosts
          ;;
        ((#i)imap.user)
          # TODO: If imap.host is set, complete users on that system?
          _users
          ;;
        ((#i)imap.pass)
          _message -e passwords 'imap password'
          ;;
        ((#i)imap.port)
          _ports
          ;;
        ((#i)instaweb.local)
          declare -a booleans
    
          booleans=(
            {true,yes}':bind the HTTP daemon to 127.0.0.1'
            {false,no}':don'\''t bind the HTTP daemon to a specific address')
    
          _describe -t booleans 'boolean' booleans
          ;;
        ((#i)instaweb.httpd)
          _message -e command-lines 'HTTP-daemon command-line'
          ;;
        ((#i)instaweb.port)
          _ports
          ;;
        ((#i)instaweb.browser)
          _message -e command-lines 'web-browser command-line'
          ;;
        ((#i)instaweb.modulepath)
          local expl
    
          _description directories expl 'module path'
          _directories $expl
          ;;
        ((#i)(svn.|svn-remote.*.)noMetaData)
          declare -a booleans
    
          booleans=(
            {true,yes}':disable git-svn-id: lines at end of commits'
            {false,no}':add git-svn-id: lines at end of commits')
    
          _describe -t booleans 'boolean' booleans
          ;;
        ((#i)(svn.|svn-remote.*.)(useSvmProps|useSvnsyncProps))
          declare -a booleans
    
          booleans=(
            {true,yes}':remap URLs and UUIDs for mirrors'
            {false,no}':don'\''t remap URLs and UUIDs for mirrors')
    
          _describe -t booleans 'boolean' booleans
          ;;
        ((#i)svn.followparent)
          __git_boolean_settings true 'follow parent commit'
          ;;
        ((#i)svn.authorsfile)
          local expl
    
          _description files expl 'authors-conversion file'
          _files $expl
          ;;
        ((#i)svn.username)
          _users
          ;;
        ((#i)svn.configdir)
          _directories
          ;;
        ((#i)svn.noauthcache)
          # TODO: Update description once this gets documented.
          __git_boolean_settings false 'use auth cache'
          ;;
        ((#i)svn.quiet)
          __git_boolean_settings false 'make git-svn less verbose' 'let git-svn produce verbose output'
          ;;
        ((#i)svn.repack)
          _guard '[[:digit:]]#' 'revision limit'
          ;;
        ((#i)svn.repackflags)
          # TODO: Should complete git-repack arguments
          _message -e 'git-repack flags'
          ;;
        ((#i)svn.logwindowsize)
          # TODO: Update description once this gets documented.
          _guard '[[:digit:]]#' 'log-window size'
          ;;
        ((#i)svn.shared)
          __git_repository_permissions
          ;;
        ((#i)svn.template)
          # NOTE: This is of course ridiculous, as this can never be useful.  Only
          # here for completeness.
          _directories
          ;;
        ((#i)svn.(trunk|tags|branches))
          _alternative \
            'sub-directories:sub-directory:_directories' \
            'urls: :_urls' && ret=0
          ;;
        ((#i)svn.prefix)
          _message -e 'prefix'
          ;;
        ((#i)svn.rmdir)
          __git_boolean_settings false 'remove empty directories from SVN tree after commit' 'leave empty directories from SVN tree after commit'
          ;;
        ((#i)svn.edit)
          __git_boolean_settings false 'edit commit message before committing' 'use commit message from SVN'
          ;;
        ((#i)svn.findcopiesharder)
          __git_boolean_settings false 'try harder to find copies' 'use simple copy-finding algorithm'
          ;;
        ((#i)svn.l)
          _guard "[[:digit:]]#" number
          ;;
        ((#i)svn.copysimilarity)
          __git_boolean_settings false 'undocumented'
          ;;
        ((#i)svn.revision)
          __git_svn_revisions
          ;;
        ((#i)svn.merge)
          __git_boolean_settings false 'use merging strategies' 'don'\''t try to merge'
          ;;
        ((#i)svn.fetch-all)
          __git_boolean_settings false 'undocumented'
          ;;
        ((#i)svn.stdin)
          __git_boolean_settings false 'read list of commits to commit from stdin' 'don'\''t necessarily read list of commits to commit from stdin'
          ;;
        ((#i)svn.strategy)
          __git_merge_strategies
          ;;
        ((#i)svn.verbose)
          __git_boolean_settings false 'output extra information'
          ;;
        ((#i)svn.dryrun)
          __git_boolean_settings false 'output git-commands that would show diffs that would be committed' 'actually run the git commands'
          ;;
        ((#i)svn.minimize)
          __git_boolean_settings false 'undocumented'
          ;;
        ((#i)svn.limit)
          _guard "[[:digit:]]#" limit
          ;;
        ((#i)svn.incremental)
          __git_boolean_settings false 'give output suitable for concatenation'
          ;;
        ((#i)svn.showcommit)
          __git_boolean_settings false 'output git commit SHA-1, as well' 'don'\''t output git commit SHA-1'
          ;;
        ((#i)svn.online)
          __git_boolean_settings false 'produce output similar to --pretty=oneline'
          ;;
        ((#i)svn.color)
          __git_boolean_settings false 'undocumented'
          ;;
        ((#i)svn.pager)
          _message -e 'undocumented'
          ;;
        ((#i)svn.nonrecursive)
          __git_boolean_settings false 'undocumented'
          ;;
        ((#i)svn.local)
          __git_boolean_settings false 'undocumented'
          ;;
        ((#i)svn.message)
          _message -e 'undocumented'
          ;;
        ((#i)svn.file)
          _message -e 'undocumented'
          ;;
        ((#i)svn-remote.*.rewriteRoot)
          _message -e 'new root'
          ;;
        (*)
          _message 'value'
          ;;
      esac
    }
    
    # __git_boolean_settings [-t TAG] [-l LABEL] DEFAULT 'follow parent commit' ['follow HEAD commit']
    #
    # -t can be used to specify a tag to use (default: booleans).
    # -l can be used to specify a label to use (default: 'boolean').
    #
    # The first argument is the default value, so that the description of the
    # default value can be suffixed with " (default)".  The second argument
    # is the description for the true value.  If a third argument is given,
    # it is used as the description for the false value.  If it is not given,
    # the description will be the true value's description with the prefix
    # "don't ".
    (( $+functions[__git_boolean_settings] )) ||
    __git_boolean_settings () {
      local tag label garbage
    
      zparseopts -D -E -a garba S: M: J: V: 1 2 n F: X: -t=tag -l=label
    
      declare -A descriptions
    
      descriptions=(true $2 false 'don'\''t '"$2")
    
      if (( $# > 2 )); then
        descriptions[false]=$3
      fi
    
      descriptions[$1]+=" (default)"
    
      declare -a booleans
    
      booleans=(
        {true,yes}':'$descriptions[true]
        {false,no}':'$descriptions[false])
    
      _describe -t ${tag:-booleans} ${label:-boolean} booleans
    }
    
    # TODO: Use this function in other places.
    (( $+functions[__git_colors] )) ||
    __git_colors () {
      declare -a colors
    
      colors=(black red green yellow blue magenta cyan white)
    
      _describe -t colors 'color' colors $*
    }
    
    # TODO: Use this function in other places.
    (( $+functions[__git_color_attributes] )) ||
    __git_color_attributes () {
      declare -a attributes
    
      attributes=(bold dim ul blink reverse)
    
      _describe -t attributes 'attribute' attributes $*
    }
    
    (( $+functions[__git_config_section_names] )) ||
    __git_config_section_names () {
      # TODO: Come up with a good way of extracting this information.
      _guard "?#" "section name"
    }
    
    (( $+functions[__git_archive_formats] )) ||
    __git_archive_formats () {
      local expl
      declare -a formats
    
      formats=(${${(f)"$(_call_program archive-formats git archive --list)"}})
      __git_command_successful || return
    
      _wanted archive-formats expl 'archive format' compadd $formats
    }
    
    (( $+functions[__git_gpg_secret_keys] )) ||
    __git_gpg_secret_keys () {
      local expl
    
      _wanted secret-keys expl 'secret key' compadd \
        ${${(Mo)$(_call_program secret-keys gpg --list-secret-keys 2>/dev/null):%<*>}//(<|>)/}
    }
    
    (( $+functions[__git_merge_strategies] )) ||
    __git_merge_strategies () {
      local expl
      local -a merge_strategies
    
      if ! merge_strategies=(${=${${(M)${(f)"$(_call_program strategies git merge -s '' 2>&1)"}:#[Aa]vailable (custom )#strategies are: *}#[Aa]vailable (custom )#strategies are: }%.}); then
        merge_strategies=(${=${${(M)${(f)"$(<$(git --exec-path)/git-merge)"}:#all_strategies*}##all_strategies=\'}%%\'})
      fi
    
      _wanted merge-strategies expl 'merge strategy' compadd -a merge_strategies "$@"
    }
    
    # TODO: Use this in more places.
    (( $+functions[__git_datetimes] )) ||
    __git_datetimes () {
      _guard "*" 'time specification'
    }
    
    # TODO: Use this in more places.
    # TODO: Use better algorithm, as shown in iconv completer (separate it to a new
    # Type).
    (( $+functions[__git_encodings] )) ||
    __git_encodings () {
      local expl
      _wanted encodings expl 'encoding' compadd "$@" \
        -M 'm:{a-zA-Z}={A-Za-z} r:|-=* r:|=*' \
        ${${${(f)"$(_call_program encodings iconv --list)"}## #}%//}
    }
    
    (( $+functions[__git_repository_permissions] )) ||
    __git_repository_permissions () {
      declare -a permissions
    
      permissions=(
        {group,true,yes}':files and objects are group-writable'
        {all,world,everybody}':files and objects are readable by all users and group-shareable'
        {umask,false}':use permissions reported by umask()')
    
      _describe -t permissions 'permission' permissions
    }
    
    (( $+functions[__git_apply_whitespace_strategies] )) ||
    __git_apply_whitespace_strategies () {
      declare -a strategies
    
      strategies=(
        'nowarn:turn off the trailing-whitespace warning'
        'warn:output trailing-whitespace warning, but apply patch'
        'error:output trailing-whitespace warning and refuse to apply patch'
        'error-all:same as "error", but output warnings for all files'
        'strip:output trailing-whitespace warning and strip trailing whitespace')
    
      _describe -t strategies 'trailing-whitespace resolution strategy' strategies
    }
    
    (( $+functions[__git_svn_revisions] )) ||
    __git_svn_revisions () {
      if [[ -prefix *: ]]; then
        compset -P '*:'
    
        _alternative \
          'revision-numbers: :__git_svn_revision_numbers' \
          'symbolic-revisions:symbolic revision:((HEAD\:"the topmost revision of the SVN repository"))'
      else
        _alternative \
          'revision-numbers: :__git_svn_revision_numbers' \
          'symbolic-revisions:symbolic revision:__git_svn_base_revisions'
      fi
    }
    
    (( $+functions[__git_svn_revision_numbers] )) ||
    __git_svn_revision_numbers () {
      _guard "[[:digit:]]#" "revision number"
    }
    
    (( $+functions[__git_svn_base_revisions] )) ||
    __git_svn_base_revisions () {
      declare -a revisions
    
      revisions=(
        'BASE:the bottommost revision of the SVN repository')
    
      # TODO: How do we deal with $*?
      _describe -t symbolic-revisions 'symbolic revision' revisions -S ':' -r ': '
    }
    
    # TODO: numparent is undocumented.
    (( $+functions[__git_ref_sort_keys] )) ||
    __git_ref_sort_keys () {
      compset -P '-'
    
      local -a keys
    
      keys=(
        'refname:the name of the ref'
        'objecttype:the type of the object'
        'objectsize:the size of the object'
        'objectname:the object name (SHA-1)'
        'tree:the tree header-field'
        'parent:the parent header-field'
        'numparent:undocumented'
        'object:the object header-field'
        'type:the type header-field'
        'tag:the tag header-field'
        'author:the author header-field'
        'authorname:the name component of the author header-field'
        'authoremail:the email component of the author header-field'
        'authordate:the date component of the author header-field'
        'committername:the name component of the committer header-field'
        'committeremail:the email component of the committer header-field'
        'committerdate:the date component of the committer header-field'
        'taggername:the name component of the tagger header-field'
        'taggeremail:the email component of the tagger header-field'
        'taggerdate:the date component of the tagger header-field'
        'creatorname:the name component of the creator header-field'
        'creatordate:the date component of the creator header-field'
        'subject:the subject of the message'
        'body:the body of the message'
        'body:the contents of the message (subject and body)')
    
      _describe -t sort-keys 'sort key' keys
    }
    
    (( $+functions[__git_daemon_service] )) ||
    __git_daemon_service () {
      local -a services
    
      services=(
        'upload-pack:serve git-fetch-pack and git-peek-remote clients'
        'upload-archive:serve git-archive --remote clients')
    
      _describe -t services 'service' services
    }
    
    (( $+functions[__git_attributes] )) ||
    __git_attributes () {
      local -a attributes
    
      attributes=(
        'crlf:line-ending convention'
        'ident:ident substitution'
        'filter:filters'
        'diff:textual diff'
        'merge:merging strategy')
    
      _describe -t attributes 'attribute' attributes
    }
    
    # ---
    
    # TODO: How do we do -/n/ here?
    # --reflog undocumented
    # -m undocumented
    # -v undocumented
    # --root undocumented
    # --no-commit-id undocumented
    # --always undocumented
    # --abbrev undocumented
    # --abbrev-commit undocumented
    # --full-diff undocumented
    # --full-history undocumented
    # --all-match undocumented
    # optional argument to --unpacked undocumented
    (( $+functions[__git_setup_revision_arguments] )) ||
    __git_setup_revision_arguments () {
      revision_arguments=(
        '(-n --max-count -)'{-n+,--max-count=-}'[maximum number of commits to output]: :_guard "[[\:digit\:]]#" number'
        '--skip=-[skip given number of commits before output]: :_guard "[[\:digit\:]]#" number'
        '(          --since --after)--max-age=-[maximum age of commits to output]: :_guard "[[\:digit\:]]#" timestamp'
        '(--max-age --since --after)'{--since=-,--after=-}'[show commits more recent than given date]:date'
        '(          --until --before)--min-age[minimum age of commits to output]: :_guard "[[\:digit\:]]#" timestamp'
        '(--min-age --until --before)'{--until=-,--before=-}'[show commits older than given date]: :_guard "[[\:digit\:]]#" timestamp'
        '--all[show all commits from refs]'
        '--branches[show all commits from refs/heads]'
        '--tags[show all commits from refs/tags]'
        '--remotes[show all commits from refs/remotes]'
        '--cherry-pick[omit any same-change commits]'
        '--graph[draw a graphical representation of the commit history]'
        '--reflog[show all commits from reflogs]'
        '(-g --walk-reflogs --reverse)'{-g,--walk-reflogs}'[walk reflog entries from most recent to oldest]'
        '*--not[reverses meaning of ^ prefix for revisions that follow]'
        '--default[use argument as default revision]:default revision:__git_revisions'
        '--merge[after a failed merge, show refs that touch files having a conflict]'
        '(             --date-order)--topo-order[show commits in topological order]'
        '(--topo-order             )--date-order[show commits in date order]'
        '(-g --walk-reflogs)--reverse[show commits in reverse order]'
        '--parents[show parent commits]'
        '(        --sparse)--dense[this is the inverse of --sparse, and is also the default]'
        '(--dense         )--sparse[when paths are given, output only commits that changes any of them]'
        '--remove-empty[stop when a given path disappears from the tree]'
        '--no-merges[do not print commits with more than one parent]'
        '--first-parent[follow only the first parent from merge commits]'
        '--boundary[output uninteresting commits at the boundary]'
        '--left-right[mark which side of a symmetric diff a commit is reachable from]'
        '(          --objects-edge)--objects[show object ids of objects referenced by the listed commits]'
        '(--objects               )--objects-edge[show object ids of objects referenced by the listed and excluded commits]'
        '(   -t)-r[show recursive diffs]'
        '(-r   )-t[show the tree objects in the diff output]'
        '-m[do not ignore merges]'
        '(   --cc --full-diff)-c[show merge diffs from parents simultaneously]'
        '(-c      --full-diff)--cc[show merge diffs from parents simultaneously without one-parent diffs]'
        '(-c --cc            )--full-diff[undocumented]'
        '(   --pretty --header)-v[show verbose header]'
        '(-v          --header)'$pretty_arg
        '--root[show root diff]'
        '--no-commit-id[do not show commit ids]'
        '--always[always show header]'
        $abbrev_arg
        '--abbrev-commit[undocumented]'
        '--simplify-merges[milder version of --full-history]'
        '--full-history[undocumented]'
        '--simplify-by-decoration[show only commits that are referenced by a ref]'
        '--relative-date[show dates relative to the current time]'
        '--date=-[format of date output]:date format:((relative\:"show dates relative to the current time"
                                                       local\:"show timestamps in user'\''s local timezone"
                                                       iso\:"show timestamps in ISO 8601 format"
                                                       rfc\:"show timestamps in RFC 2822 format"
                                                       short\:"show only date but not time"
                                                       default\:"show timestamp in the original timezone"))'
        '--author=-[limit commits to those by the given author]:author'
        '--committer=-[limit commits to those by the given committer]:committer'
        '--grep=-[limit commits to those with log messages matching the given pattern]:pattern'
        '--all-match[undocumented]'
        '--encoding=-[output log messages in given encoding]::encoding:__git_encodings'
        $diff_args)
    
      if (( words[(I)--objects(|-edge)] )); then
        revision_arguments+=('--unpacked=-[print object IDs that are not in packs]::object')
      fi
    }
    
    # ---
    
    (( $+functions[__git_is_type] )) ||
    __git_is_type () {
      local sha1
      sha1="$(git rev-parse $2 2> /dev/null)" &&
      [[ "$(git cat-file -t "${sha1}^{$1}" 2> /dev/null)" == $1 ]]
    }
    
    (( $+functions[__git_is_committish] )) ||
    __git_is_committish () {
      __git_is_type commit $1
    }
    
    (( $+functions[__git_is_treeish] )) ||
    __git_is_treeish () {
      __git_is_type tree $1
    }
    
    (( $+functions[__git_is_indexed] )) ||
    __git_is_indexed () {
      [[ -n $(git ls-files $REPLY) ]]
    }
    
    local curcontext=$curcontext ret=1
    
    # fun with $words[] and $CURRENT to enable completion for args
    # to git aliases (eg. git co )
    local -A git_aliases
    local -a git_aliases__
    git_aliases__=(${(f)${${${(f)"$(_call_program alias_expansion git config --get-regexp '\^alias\.')"}#alias.}/ /$'\n'}/(#e)/$'\n'})
    if (( ( ${#git_aliases__} % 2 ) == 0 )) ; then
        git_aliases=(${git_aliases__})
    fi
    unset git_aliases__
    
    if (( CURRENT >= 3 )) && [[ -n ${git_aliases[$words[2]]} ]] ; then
      local -a tmpwords expalias
      expalias=(${(z)git_aliases[$words[2]]})
      tmpwords=(${words[1]} ${expalias})
      if [[ -n "${words[3,-1]}" ]] ; then
          tmpwords+=(${words[3,-1]})
      fi
      [[ -n ${words[$CURRENT]} ]] || tmpwords+=('')
      (( CURRENT += ${#expalias} - 1 ))
      words=("${tmpwords[@]}")
      unset tmpwords expalias
    fi
    
    if [[ $service == git ]]; then
      local state line
      declare -A opt_args
      _arguments -C \
        '(- :)--version[display version information]' \
        '(- :)--help[display help message]' \
        '--exec-path=-[path containing core git-programs]::directory:_directories' \
        '(-p --paginate)'{-p,--paginate}'[pipe output into $PAGER]' \
        '--no-pager[do not pipe git output into a pager]' \
        '--git-dir=-[path to repository]:directory:_directories' \
        '--work-tree=-[path to working tree]:directory:_directories' \
        '--bare[use $PWD as repository]' \
        '*::arg:->cmd_or_options' && return
      case $state in
        (cmd_or_options)
          if (( CURRENT == 1 )); then
            __git_aliases_and_commands
          else
            curcontext="${curcontext%:*:*}:git-$words[1]:"
    	if (( $+functions[_git-$words[1]] )); then
              _call_function ret _git-$words[1]
    	else
    	  _files
    	fi
            return ret
          fi
          ;;
      esac
    else
      _call_function ret _$service
      return ret
    fi
    }
    
    _git
    PK[z8cccfunctions/run-helpnuW+A#!/bin/zsh
    #
    # Figure out where to get the best help, and get it.
    #
    # Install this function by placing it in your FPATH and then
    # adding to your .zshrc the lines:
    #	unalias run-help
    #	autoload -Uz run-help
    #
    
    emulate -RL zsh
    
    local HELPDIR="${HELPDIR:-/usr/share/zsh/$ZSH_VERSION/help}"
    
    [[ $1 == "." ]] && 1="dot"
    [[ $1 == ":" ]] && 1="colon"
    
    # Check whether Util/helpfiles has been used to generate zsh help
    if [[ $# == 0 || $1 == "-l" ]]
    then
        if [[ -d $HELPDIR ]]
        then
    	echo "Here is a list of topics for which special help is available:"
    	echo ""
    	print -rc $HELPDIR/*(:t)
        else
    	echo "There is no list of special help topics available at this time."
        fi
        return 0
    elif [[ -n "${HELPDIR:-}" && -r $HELPDIR/$1 && $1 != compctl ]]
    then
        ${=PAGER:-more} $HELPDIR/$1
        return $?
    fi
    
    # No zsh help; use "whence" to figure out where else we might look
    local what places noalias newline='
    '
    integer i=0 didman=0
    
    places=( "${(@f)$(builtin whence -va $1)}" )
    if [[ $places = *"not found"* && $1 != ${(Q)1} ]]; then
      # Different when unquoted, so try stripping quotes.
      places=( "${(@f)$(builtin whence -va ${(Q)1})}" )
      if (( ${#places} )); then
          set -- "${(Q)@}"
      fi
      # Quotation is significant to aliases, so suppress lookup.
      noalias=1
    fi
    
    {
    while ((i++ < $#places))
    do
        what=$places[$i]
        [[ -n $noalias && $what = *" is an alias "* ]] && continue
        builtin print -r $what
        case $what in
        (*( is an alias)*)
    	[[ ${what[(w)6]:t} != ${what[(w)1]} ]] &&
    	  run_help_orig_cmd=${what[(w)1]} run-help ${what[(w)6]:t}
    	;;
        (*( is a * function))
    	case ${what[(w)1]} in
    	(comp*) man zshcompsys;;
    	(zf*) man zshftpsys;;
    	(run-help) man zshcontrib;;
    	(*) builtin functions ${what[(w)1]} | ${=PAGER:-more};;
    	esac;;
        (*( is a * builtin))
    	case ${what[(w)1]} in
    	(compctl) man zshcompctl;;
    	(comp*) man zshcompwid;;
    	(bindkey|vared|zle) man zshzle;;
    	(*setopt) man zshoptions;;
    	(cap|getcap|setcap) ;&
    	(clone) ;&
    	(ln|mkdir|mv|rm|rmdir|sync) ;&
    	(sched) ;&
    	(echotc|echoti|sched|stat|zprof|zpty|zsocket|zstyle|ztcp) man zshmodules;;
    	(zftp) man zshftpsys;;
    	(*) man zshbuiltins;;
    	esac
    	;;
        (*( is hashed to *))
    	man ${what[(w)-1]:t}
    	;;
        (*( is a reserved word))
    	man zshmisc
    	;;
        (*)
    	if ((! didman++))
    	then
    	    if whence "run-help-$1:t" >/dev/null
    	    then
    		local cmd_args
    		builtin getln cmd_args
    		builtin print -z "$cmd_args"
    		cmd_args=( ${(z)cmd_args} )
    		# Discard environment assignments, etc.
    		while [[ $cmd_args[1] != ${run_help_orig_cmd:-$1} ]]
    		do
    		    shift cmd_args || return 1
    		done
    		eval "run-help-$1:t ${(q@)cmd_args[2,-1]}"
    	    else
    		POSIXLY_CORRECT=1 man $@:t
    	    fi
    	fi
    	;;
        esac
        if ((i < $#places && ! didman))
        then
    	builtin print -nP "%SPress any key for more help or q to quit%s"
    	builtin read -k what
    	[[ $what != $newline ]] && echo
    	[[ $what == [qQ] ]] && break
        fi
    done
    } always {
      unset run_help_orig_cmd
    }
    PK[p!functions/quote-and-complete-wordnuW+A#autoload
    
    # This widget uses the completion system to double-quote the current word
    # if it is not already quoted, then attempts to complete normally.  If the
    # normal completion fails, the quotes are removed again.
    #
    # To use it:
    #   autoload -Uz quote-and-complete-word
    #   zle -N quote-and-complete-word
    #   bindkey '\t' quote-and-complete-word
    #
    # BUG: The "undo" mechanism is confused by multiple calls to completion
    # widgets from the same normal widget.
    
    # Note: It's important that this function's name ends in "complete-word".
    # The _oldlist completer does nothing unless the widget has that suffix.
    
    quote-and-complete-word () {
        setopt localoptions unset noshwordsplit noksharrays
        local lbuf=$LBUFFER rbuf=$RBUFFER last=$LASTWIDGET
        if [[ $last != $WIDGET ]]
        then
            local oldcontext=$curcontext
            local curcontext="${WIDGET}:${${curcontext:-:::}#*:}"
            zle complete-word
            curcontext=$oldcontext
        fi
        zle complete-word
        local ret=$?
        if [[ _lastcomp[nmatches] -eq 0 && $last != $WIDGET ]]
        then
            LBUFFER=$lbuf RBUFFER=$rbuf
        fi
        return ret
    }
    
    _force_quote () {
        [[ -z $compstate[quoting] ]] &&
        compstate[to_end]='' &&
        compadd -U -S "$SUFFIX" -I "$ISUFFIX"\" -i \""$IPREFIX" "${(Q)PREFIX}"
    }
    zstyle ':completion:quote-and-complete-word:*' completer _force_quote
    
    # Handle zsh autoloading conventions
    
    [[ -o kshautoload ]] || quote-and-complete-word "$@"
    PK[{%%functions/_parameternuW+A#compdef -parameter-
    
    _parameters -e
    PK[functions/_enscriptnuW+A#compdef enscript
    
    local state context line curcontext="$curcontext" match
    typeset -A opt_args
    
    _arguments -C -s \
      '(   -2 --columns)-1' \
      '(-1    --columns)-2' \
      '(-1 -2          )--columns=:columns:' \
      '(--pages)-a+:pages:(even odd)' \
      '(-a)--pages=:pages:(even odd)' \
      '(--file-align)-A+:align:' \
      '(-A)--file-align=:align:' \
      '(--header)-b+:page header:' \
      '(-b)--header=:page header:' \
      '(--no-header)-B' \
      '(-B)--no-header' \
      '(--truncate-lines)-c' \
      '(-c)--truncate-lines' \
      '(--line-numbers)-C-:start line:' \
      '(-C)--line-numbers=-:start line:' \
      '(--printer -d   )-P+:printer name: _printers' \
      '(--printer    -P)-d+:printer name: _printers' \
      '(          -d -P)--printer=:printer name: _printers' \
      '*-D+:key\:value:' \
      '*--setpagedevice=:key\:value:' \
      '(--escapes)-e-:escape character:' \
      '(-e)--escapes=-:escape character:' \
      '(--pretty-print)-E-:input language:->inputlang' \
      '(-E)--pretty-print=-:input language:->inputlang' \
      '(--font)-f+:fontname:' \
      '(-f)--font=:fontname:' \
      '(--header-font)-F+:fontname:' \
      '(-F)--header-font=:fontname:' \
      '(--print-anyway)-g' \
      '(-g)--print-anyway' \
      '(--fancy-header)-G' \
      '(-G)--fancy-header=-:name:' \
      '(--no-job-header)-h' \
      '(-h)--no-job-header' \
      '(--highlight-bars)-H-:lines:' \
      '(-H)--highlight-bars=-:lines:' \
      '(--indent)-i+:indent length:' \
      '(-i)--indent=:indent length:' \
      '(--filter)-I+:input filter:->commandline' \
      '(-I)--filter=:input filter:->commandline' \
      '(--borders)-j' \
      '(-j)--borders' \
      '(--page-prefeed)-k' \
      '(-k)--page-prefeed' \
      '(--no-page-prefeed)-K' \
      '(-K)--no-page-prefeed' \
      '(--lineprinter)-l' \
      '(-l)--lineprinter' \
      '(--lines-per-page)-L+:lines per page:' \
      '(-L)--lines-per-page=:lines per page:' \
      '(--mail)-m' \
      '(-m)--mail' \
      '(--media)-M+:media name:(A4)' \
      '(-M)--media=:media name:(A4)' \
      '(--copies -n   )-#+:number of copies:' \
      '(--copies    -#)-n+:number of copies:' \
      '(         -n -#)--copies=:number of copies:' \
      '(--newline)-N+:newline type:((n\:unix r\:mac))' \
      '(-N)--newline=:newline type:((n\:unix r\:mac))' \
      '(--output -p   )-o+:output file:' \
      '(--output    -o)-p+:output file:_files' \
      '(         -p -o)--output=:output file:_files' \
      '(--missing-characters)-O' \
      '(-O)--missing-characters' \
      '(--quiet --silent)-q' \
      '(-q --silent)--quiet' \
      '(-q --quiet)--silent' \
      '(--landscape)-r' \
      '(-r)--landscape' \
      '(--portrait)-R' \
      '(-R)--portrait' \
      '(--baselineskip)-s+:baseline skip:' \
      '(-s)--baselineskip=:baseline skip:' \
      '*-S+:key\:value:' \
      '*--statusdict=:key\:value:' \
      '(--title -t   )-J+:banner title:' \
      '(--title    -J)-t+:banner title:' \
      '(        -t -J)--title=:banner title:' \
      '(--tabsize)-T+:tabsize:(8)' \
      '(-T)--tabsize=:tabsize:(8)' \
      '(--underlay)-u-:underlay text:' \
      '(-u)--underlay=-:underlay text:' \
      '(--nup)-U+:pages:(4)' \
      '(-U)--nup=:pages:(4)' \
      '(--verbose)-v' \
      '(-v)--verbose=-:level:' \
      '(--version)-V' \
      '(-V)--version' \
      '(--language)-W+:output language:(PostScript html overstrike rtf)' \
      '(-W)--language=:output language:(PostScript html overstrike rtf)' \
      '(--encoding)-X+:character encoding:(88591 latin1 88592 latin2 88593 latin3 88594 latin4 88595 cyrillic 88597 greek 88599 latin5 885910 latin6 ascii asciifise asciifi asciise asciidkno asciidk asciino ibmpc pc dos mac vms hp8 koi8 ps PS pslatin1 ISOLatin1Encoding)' \
      '(-X)--encoding=:character encoding:(88591 latin1 88592 latin2 88593 latin3 88594 latin4 88595 cyrillic 88597 greek 88599 latin5 885910 latin6 ascii asciifise asciifi asciise asciidkno asciidk asciino ibmpc pc dos mac vms hp8 koi8 ps PS pslatin1 ISOLatin1Encoding)' \
      '(--no-formfeed)-z' \
      '(-z)--no-formfeed' \
      '(--pass-through)-Z' \
      '(-Z)--pass-through' \
      '--color=-:use color:(false true)' \
      '--download-font=:fontname:' \
      '--filter-stdin=:stdin name:(-)' \
      '--h-column-height=:horizontal column height:' \
      '--help' \
      '--help-pretty-print' \
      '--highlight-bar-gray=:gray level:' \
      '--list-media' \
      '--list-options' \
      '--margins=:left\:right\:top\:bottom:' \
      '--mark-wrapped-lines=-:wrapped line style:(none plus box arrow)' \
      '--non-printable-format=:format to visualze non printable characters:(caret octal questionmark space)' \
      '--nup-xpad=:x-padding:(10)' \
      '--nup-ypad=:y-padding:(10)' \
      '--page-label-format=:page label format:(short long)' \
      '--ps-level=:PostScript language level:(1 2)' \
      '--printer-options=:extra options:' \
      '--rotate-even-pages' \
      '--slice=:virtical slice number:' \
      '--style=:highlighting style:' \
      '--toc' \
      '--word-wrap' \
      '--ul-angle=:underlay text'\''s angle:(45)' \
      '--ul-font=:underlay text'\''s fontname:(Times-Roman200)' \
      '--ul-gray=:underlay text'\''s gray level:(.8)' \
      '--ul-position=:underlay text'\''s position:(+0+0 -0-0)' \
      '--ul-style=:underlay text'\''s style:(outline filled)' \
      '*:filename:_files' && return 0
    
    case "$state" in
    commandline)
      compset -q
      _normal
      ;;
    
    inputlang)
      if (( ! $+_enscript_input_languages )); then
        _enscript_input_languages=(${${(f)${(F)${(M)${(f)"$(enscript --help-pretty-print)"}:#(Name|Description):*}}//(#b)Name: ([^
    ]##)(
    Description: ([^
    ]##)|)/$match[1]:$match[3]}%:})
      fi
      _describe 'input language' _enscript_input_languages -- 
      ;;
    esac
    PK[[P--functions/calendarnuW+Aemulate -L zsh
    setopt extendedglob
    
    local line showline restline REPLY REPLY2 userange nobackup datefmt
    local calendar donefile sched newfile warnstr mywarnstr newdate
    integer time start stop today ndays y m d next=-1 shown done nodone
    integer verbose warntime mywarntime t tcalc tsched i rstat remaining
    integer showcount icount repeating repeattime resched showall brief
    local -a calendar_entries calendar_addlines
    local -a times calopts showprog lockfiles match mbegin mend tmplines
    local -A reply
    
    zmodload -i zsh/datetime || return 1
    zmodload -i zsh/zutil || return 1
    
    autoload -Uz calendar_{add,parse,read,scandate,show,lockfiles}
    
    # Read the calendar file from the calendar-file style
    zstyle -s ':datetime:calendar:' calendar-file calendar || calendar=~/calendar
    newfile=$calendar.new.$HOST.$$
    zstyle -s ':datetime:calendar:' done-file donefile || donefile="$calendar.done"
    # Read the programme to show the message from the show-prog style.
    zstyle -a ':datetime:calendar:' show-prog showprog ||
      showprog=(calendar_show)
    # Amount of time before an event when it should be flagged.
    # May be overridden in individual entries
    zstyle -s ':datetime:calendar:' warn-time warnstr || warnstr="0:05"
    # default to standard ctime date/time format
    zstyle -s ':datetime:calendar:' date-format datefmt ||
      datefmt="%a %b %d %H:%M:%S %Z %Y"
    
    if [[ -n $warnstr ]]; then
      if [[ $warnstr = <-> ]]; then
        (( warntime = warnstr ))
      elif ! calendar_scandate -ar $warnstr; then
        print >&2 \
          "warn-time value '$warnstr' not understood; using default 5 minutes"
        warnstr="5 mins"
        (( warntime = 5 * 60 ))
      else
        (( warntime = REPLY ))
      fi
    fi
    
    [[ -f $calendar ]] || return 1
    
    # We're not using getopts because we want +... to refer to a
    # relative time, not an option, and allow some other additions
    # like handling -<->.
    integer opti=0
    local opt optrest optarg
    
    while [[ ${argv[opti+1]} = -* ]]; do
      (( opti++ ))
      opt=${argv[opti][2]}
      optrest=${argv[opti][3,-1]}
      [[ -z $opt || $opt = - ]] && break
      while [[ -n $opt ]]; do
        case $opt in
          ########################
          # Options with arguments
          ########################
          ([BCnS])
          if [[ -n $optrest ]]; then
    	optarg=$optrest
    	optrest=
          elif (( opti < $# )); then
    	optarg=$argv[++opti]
    	optrest=
          else
    	print -r "$0: option -$opt requires an argument." >&2
    	return 1
          fi
          case $opt in
    	(B)
    	# Brief, with number of lines to show.
    	brief=$optarg
    	if (( brief <= 0 )); then
    	  print -r "$0: option -$opt requires a positive integer." >&2
    	  return 1
    	fi
    	;;
    
    	(C)
    	# Pick the calendar file, overriding style and default.
    	calendar=$optarg
    	;;
    
    	(n)
    	# Show this many remaining events regardless of date.
    	showcount=$optarg
    	if (( showcount <= 0 )); then
    	  print -r "$0: option -$opt requires a positive integer." >&2
    	  return 1
    	fi
    	;;
    
    	(S)
    	# Explicitly specify a show programme, overriding style and default.
    	# Colons in the argument are turned into space.
    	showprog=(${(s.:.)optarg})
    	;;
          esac
          ;;
    
          ###########################
          # Options without arguments
          ###########################
          (a)
          # Show all entries
          (( showall = 1 ))
          ;;
    
          (b)
          # Brief: don't show continuation lines
          (( brief = 1 ))
          ;;
    
          (d)
          # Move out of date items to the done file.
          (( done = 1 ))
          ;;
    
          (D)
          # Don't use done; needed with sched
          (( nodone = 1 ))
          ;;
    
          (r)
          # Show all remaining options in the calendar, i.e.
          # respect start time but ignore end time.
          # Any argument is treated as a start time.
          (( remaining = 1 ))
          ;;
    
          (s)
          # Use the "sched" builtin to scan at the appropriate time.
          sched=sched
          (( done = 1 ))
          ;;
    
          (v)
          # Verbose
          verbose=1
          ;;
    
          (<->)
          # Shorthand for -n <->
          showcount=$opt
          ;;
    
          (*)
          print "$0: unrecognised option: -$opt" >&2
          return 1
          ;;
        esac
        opt=$optrest[1]
        optrest=$optrest[2,-1]
      done
    done
    calopts=($argv[1,opti])
    shift $(( opti ))
    
    # Use of donefile requires explicit or implicit option request, plus
    # no explicit -D.  It may already be empty because of the style.
    (( done && !nodone )) || donefile=
    
    if (( $# > 1 || ($# == 1 && remaining) )); then
      if [[ $1 = now ]]; then
        start=$EPOCHSECONDS
      elif [[ $1 = <-> ]]; then
        start=$1
      else
        if ! calendar_scandate -a $1; then
          print "$0: failed to parse date/time: $1" >&2
          return 1
        fi
        start=$REPLY
      fi
      shift
    else
      # Get the time at which today started.
      y=${(%):-"%D{%Y}"} m=${(%):-"%D{%m}"} d=${(%):-"%D{%d}"}
      strftime -s today -r "%Y/%m/%d" "$y/$m/$d"
      start=$today
    fi
    # day of week of start time
    strftime -s wd "%u" $start
    
    if (( $# && !remaining )); then
      if [[ $1 = +* ]]; then
        if ! calendar_scandate -a -R $start ${1[2,-1]}; then
          print "$0: failed to parse relative time: $1" >&2
          return 1
        fi
        (( stop = REPLY ))
      elif [[ $1 = <-> ]]; then
        stop=$1
      else
        if ! calendar_scandate -a $1; then
          print "$0: failed to parse date/time: $1" >&2
          return 1
        fi
        stop=$REPLY
      fi
      if (( stop < start )); then
        strftime -s REPLY $datefmt $start
        strftime -s REPLY2 $datefmt $stop
        print "$0: requested end time is before start time:
      start: $REPLY
      end: $REPLY2" >&2
        return 1
      fi
      shift
    else
      # By default, show 2 days.  If it's Friday (5) show up to end
      # of Monday (4) days; likewise on Saturday show 3 days.
      # If -r, this is calculated but not used.  This is paranoia,
      # to avoid an unusable value of stop; but it shouldn't get used.
      case $wd in
        (5)
        ndays=4
        ;;
    
        (6)
        ndays=3
        ;;
    
        (*)
        ndays=2
        ;;
      esac
      stop=$(( start + ndays * 24 * 60 * 60 ))
    fi
    
    if (( $# )); then
      print "Usage: $0 [ start-date-time stop-date-time ]" >&2
      return 1
    fi
    
    autoload -Uz matchdate
    
    [[ -n $donefile ]] && rm -f $newfile
    
    if (( verbose )); then
      print -n "start: "
      strftime $datefmt $start
      print -n "stop: "
      if (( remaining )); then
        print "none"
      else
        strftime $datefmt $stop
      fi
    fi
    
    local mycmds="${TMPPREFIX:-/tmp/zsh}.calendar_cmds.$$"
    touch $mycmds
    chmod 600 $mycmds
    
    # start of subshell for OS file locking
    (
    # start of block for following always to clear up lockfiles.
    # Not needed but harmless if OS file locking is used.
    {
      if [[ -n $donefile ]]; then
        # Attempt to lock both $donefile and $calendar.
        # Don't lock $newfile; we've tried our best to make
        # the name unique.
        if zmodload -F zsh/system b:zsystem && zsystem supports flock &&
          zsystem flock $calendar 2>/dev/null &&
          zsystem flock $donefile 2>/dev/null; then
          # locked OK
          :
        else
          calendar_lockfiles $calendar $donefile || exit 1
        fi
      fi
    
      calendar_read $calendar
      for line in $calendar_entries; do
        calendar_parse $line  ||  continue
    
        # Extract returned parameters from $reply
        # Time of event
        (( t = ${reply[time]} ))
        # Remainder of line including RPT and WARN stuff:  we need
        # to keep these for rescheduling.
        restline=$reply[text1]
        # Look for specific warn time.
        if [[ -n ${reply[warntime]} ]]; then
          (( mywarntime = t - ${reply[warntime]} ))
          mywarnstr=${reply[warnstr]}
        else
          (( mywarntime = warntime ))
          mywarnstr=$warnstr
        fi
        # Look for a repeat time.
        if [[ -n ${reply[rpttime]} ]]; then
          # The actual time of the next event, which appears as text
          (( repeattime = ${reply[rpttime]} ))
          (( repeating = 1 ))
        else
          (( repeating = 0 ))
        fi
        # Finished extracting parameters from $reply
    
        if (( verbose )); then
          print "Examining: $line"
          print -n "  Date/time: "
          strftime $datefmt $t
          if [[ -n $sched ]]; then
    	print "  Warning $mywarntime seconds ($mywarnstr) before"
          fi
        fi
        (( shown = 0 ))
        if (( brief )); then
          tmplines=("${(f)line}")
          showline=${(F)${${tmplines[1,brief]}}}
        else
          showline=$line
        fi
        match=()
        # Strip continuation lines starting " #".
        while [[ $showline = (#b)(*$'\n')[[:space:]]##\#[^$'\n']##(|$'\n'(*)) ]]; do
          showline="$match[1]$match[3]"
        done
        # Strip trailing empty lines
        showline=${showline%%[[:space:]]#}
        if (( showall || (t >= start && (remaining || t <= stop || icount < showcount)) ))
        then
          print -r -- ${(qq)showprog} $start $stop ${(qq)showline} >>$mycmds
          (( icount++ ))
          # Doesn't count as "shown" unless the event has now passed.
          (( t <= EPOCHSECONDS )) && (( shown = 1 ))
        elif [[ -n $sched ]]; then
          (( tsched = t - mywarntime ))
          if (( tsched >= start && tsched <= stop)); then
    	showline="due in ${mywarnstr}: $showline"
    	print -r -- ${(qq)showprog} $start $stop ${(qq)showline} >>$mycmds
          elif (( tsched < start )); then
    	# We haven't actually shown it, but it's in the past,
    	# so treat it the same.  Should probably rename this variable.
    	(( shown = 1 ))
          fi
        fi
        if [[ -n $sched ]]; then
          if (( shown && repeating )); then
    	# Done and dusted, but a repeated event is due.
    	strftime -s newdate $datefmt $repeattime
    	if [[ $newdate != *[[:space:]] && $restline != [[:space:]]* ]]; then
    	  newdate+=" "
    	fi
    	calendar_addlines+=("$newdate$restline")
    
    	# We'll add this back in below, but we check in case the
    	# repeated event is the next one due.  It's not
    	# actually a disaster if there's an error and we fail
    	# to add the time.  Always try to reschedule this event.
    	(( tcalc = repeattime, resched = 1 ))
          else
    	(( tcalc = t ))
          fi
    
          if (( tcalc - mywarntime > EPOCHSECONDS )); then
    	# schedule for a warning
    	(( tsched = tcalc - mywarntime, resched = 1 ))
          else
    	# schedule for event itself
    	(( tsched = tcalc ))
    	# but don't schedule unless the event has not yet been shown.
    	(( !shown )) && (( resched = 1 ))
          fi
          if (( resched && (next < 0 || tsched < next) )); then
    	(( next = tsched ))
          fi
        fi
        if [[ -n $donefile ]]; then
          if (( shown )); then
    	# Done and dusted.
    	if ! print -r $line >>$donefile; then
    	  if (( done != 3 )); then
    	    (( done = 3 ))
    	    print "Failed to append to $donefile" >&2
    	  fi
    	elif (( done != 3 )); then
    	  (( done = 2 ))
    	fi
          else
    	# Still not over.
    	if ! print -r $line >>$newfile; then
    	  if (( done != 3 )); then
    	    (( done = 3 ))
    	    print "Failed to append to $newfile" >&2
    	  fi
    	elif (( done != 3 )); then
    	  (( done = 2 ))
    	fi
          fi
        fi
      done
    
      if [[ -n $sched ]]; then
        if [[ $next -ge 0 ]]; then
          # Remove any existing calendar scheduling.
          i=${"${(@)zsh_scheduled_events#*:*:}"[(I)calendar -s*]}
          {
            (( i )) && print sched -$i
            print -r -- ${(qq)sched} $next calendar "${calopts[@]}" $next $next
          } >>$mycmds
        else
          showline="No more calendar events: calendar not rescheduled.
    Run \"calendar -s\" again if you add to it."
          print -r -- ${(qq)showprog} $start $stop ${(qq)showline} >>$mycmds
        fi
      fi
    
      if (( done == 2 )); then
        if ! mv $calendar $calendar.old; then
          print "Couldn't back up $calendar to $calendar.old.
    New calendar left in $newfile." >&2
          (( rstat = 1 ))
        elif ! mv $newfile $calendar; then
          print "Failed to rename $newfile to $calendar.
    Old calendar left in $calendar.old." >&2
          (( rstat = 1 ))
        fi
        nobackup=-B
      elif [[ -n $donefile ]]; then
        rm -f $newfile
      fi
    
      # Reschedule repeating events.
      for line in $calendar_addlines; do
        calendar_add -L $nobackup $line
      done
    } always {
      (( ${#lockfiles} )) && rm -f $lockfiles
    }
    
    exit $rstat
    ) && {
      # Tasks that need to be in the current shell
      [[ -s $mycmds ]] && . $mycmds
      rm -f $mycmds
    }
    PK[áLOT
    T
    functions/_svn-buildpackagenuW+A#compdef svn-buildpackage
    
    _arguments \
      '--svn-builder=[use CMD as build command instead of dpkg-buildpackage]:build command: _command_names -e' \
      '--svn-ignore-new[do not stop on svn conflicts or new/changed files]' \
      '--svn-dont-clean[do not run debian/rules clean (default: clean first)]' \
      '--svn-no-links[do not use file links (default: use links where possible)]' \
      '--svn-dont-purge[do not wipe the build directory (default: purge after build)]' \
      '--svn-reuse[reuse an existing build directory, copy trunk over it]' \
      '--svn-export[just prepares the build directory and exits]' \
      '--svn-tag[final build: Export && build && tag && dch -i]' \
      '--svn-retag[replace an existing tag directory if found while tagging]' \
      '--svn-only-tag[tags the current trunk directory without building]' \
      '--svn-noautodch[do not add a new Debian changelog entry when done]' \
      '--svn-lintian[run lintian after the build]' \
      '--svn-linda[like --svn-lintian, run linda instead]' \
      '--svn-move[move package files to .. after successful build]' \
      '--svn-move-to=:target dir:_files -/' \
      '--svn-pkg:package name:_deb_packages avail' \
      '--svn-override[override config variables]:list:' \
      '--svn-prebuild:hook: _command_names -e' \
      '--svn-postbuild:hook: _command_names -e' \
      '--svn-pretag:hook: _command_names -e' \
      '--svn-posttag:hook: _command_names -e' \
      '--svn-verbose[more verbose program output]' \
      '--svn-noninteractive[turn off interactive mode]' \
      '-b[binary-only build, no source]' \
      '-B[binary-only build, no source or arch-indep binaries]' \
      '-S[source-only build, no binaries]' \
      '-s-:source generation:((i\:default a\:force\ inclusion\ of\ original\ source d\:force\ exclusion\ of\ original\ source))' \
      '-a-:architecture:(alpha amd64 arm hppa hurd-i386 i386 ia64 m68k mips mipsel powerpc s390 sparc)' \
      '-v-:version:' \
      '-C-:changes description:_files' \
      '-m-:maintainer address:_email_addresses' \
      '-e-:maintainer address:_email_addresses' \
      '(-d)-D[check build dependencies and conflicts]' \
      '(-D)-d[do not check build dependencies and conflicts]' \
      '-W[turn certain errors into warnings]' \
      '-E[negates previously-set -W]' \
      '-nc[do not clean source tree]' \
      '-tc[clean the source tree after build]' \
      '-r-:gain-root command: _command_names -e' \
      '-p-:sign command: _command_names -e' \
      '-k-:key ID:' \
      '-us[do not sign source package]' \
      '-uc[do not sign .changes file]' \
      '*-i-:ignore regexp:' \
      '*-I-:ignore filename:_files' \
      '--admindir=:dpkg database dir:_files -/' \
      '(-h --help)'{-h,--help}'[show usage message]' \
      '--version[show version]'
    PK[%functions/_vncnuW+A#compdef vncserver vncviewer xvncviewer xtightvncviewer xvnc4viewer
    
    local displays args
    displays=( ~/.vnc/$HOST:<->.pid(N:r:t:s/$HOST//) )
    displays=( \\${^displays} ) 
    
    case $service in
      vncserver)
        # currently lacking Xvnc arguments
        _arguments \
          - start \
    	'-name:desktop name:_x_name' \
    	'-geometry:geometry:(1600x1200 1280x1024 1152x864 1024x768 800x600 640x480)' \
    	'-depth:pixel depth:(8 16 24 32)' \
    	'-pixelformat:pixel format' \
    	'1:: :_guard "(|:[0-9]#)" "display number"' \
          - kill \
    	"-kill:display number:($displays)" \
          - help \
    	'-help'
      ;;
      *vncviewer) 
        _xt_arguments -shared -viewonly -fullscreen -bgr233 -owncmap -truecolour \
          '-encodings:encodings:_values -s " " encoding copyrect hextile corre rre raw' \
          '-depth:depth' \
          '-passwd:file:_files' \
          '(1)-listen:display number' \
          '(-listen)1::display:_x_display'
      ;;
    esac
        
    PK[(AAfunctions/_xrandrnuW+A#compdef xrandr
    
    _arguments \
      '(-d -display)'{-d,-display}':X display:_x_display' \
      '-help[display help]' \
      '(-o --orientation)'{-o,--orientation}':rotation:(normal inverted left right 0 1 2 3)' \
      '(-q --query)'{-q,--query}'[display current state]' \
      '(-s --size)'{-s,--size}':size:' \
      '(-r --rate --refresh)'{-r,--rate,--refresh}':target refresh rate:' \
      '(-v --version)'{-v,--version}'[display version]' \
      '-x[reflect across X axis]' \
      '-y[reflect across Y axis]' \
      '--screen:X screen number' \
      '--verbose[be more verbose]' \
      '--dryrun' \
      '(--prop --properties)'{--prop,--properties}'[display the contents of properties for each output]' \
      '--fb:size:' \
      '--fbmm:size:' \
      '--dpi:dpi:' \
      '--output:output to reconfigure:' \
      '--auto' \
      '--mode:mode:' \
      '--preferred' \
      '--pos:position:' \
      '--reflect:axes:(normal x y xy)' \
      '--rotate:rotation:(normal inverted left right)' \
      '--left-of:output' \
      '--right-of:output' \
      '--above:output' \
      '--below:output' \
      '--same-as:output' \
      '--off[disable the output]' \
      '--crtc:crtc to use:'
    PK[6functions/_texnuW+A#compdef tex latex slitex pdflatex jadetex pdfjadetex xetex=tex xelatex=latex latexmk
    
    local expl
    
    _description files expl 'TeX or LaTeX file'
    _files "$@" "$expl[@]" -g '*.(tex|TEX|texinfo|texi)(-.)'
    PK[kgcfunctions/_tmuxnuW+A#compdef tmux
    
    # tmux  completion for zsh .
    #
    # Configuration:
    #
    # - On some OSs, the directory for tmux's server sockets may not be
    #   the default (which is /tmp/tmux-/), but say
    #   /var/run/tmux/tmux-, in which case the completion for
    #   'tmux -L ' will not be able to find the sockets in the default
    #   location (debian does this, for instance); tell _tmux the right place
    #   to look:
    #       % zstyle ':completion:*:*:tmux:*:sockets' socketdir "/var/run/tmux/tmux-${UID}"
    #
    # - tmux knows a *lot* of sub-commands, hence 'tmux ' returns a lot
    #   of possible completions. _tmux knows about all commands and their aliases.
    #   By default, both are offered. If you do not care about the aliases, do this:
    #       % zstyle ':completion:*:*:tmux:*:subcommands' mode 'commands'
    #
    #   The same can be done to only return aliases by setting the above style
    #   to 'aliases'. The default value is 'both' (but actually every value
    #   different from 'commands' and 'aliases' will have the same effect).
    #
    #   'lsw' is an alias for 'list-windows' for example; note that not all
    #   commands have aliases. So probably, either the default 'both' or
    #   'commands' makes most sense for this style.
    #
    # - For finer grained control over what is suggested as possible completions,
    #   the 'ignored-patterns' style may be used; suppose you think that only
    #   '*-window' or '*-windows' are worth being completed. You would get that
    #   behaviour like this:
    #       % zstyle ':completion:*:*:tmux:*:subcommands' ignored-patterns '^*-window(|s)'
    #
    #   Some tmux commands currently do not work if called from a shell prompt,
    #   so it would make sense to ignore them per default (at the time of writing,
    #   those commands are choose-{session,client,window}, confirm-before and
    #   find-window. This would ignore them:
    #       % zstyle ':completion:*:*:tmux:*:subcommands' ignored-patterns \
    #                'choose-*' 'confirm-before' 'find-window'
    #
    # The configuration for subcommand completions may be done in
    # this context: ':completion:*:*:tmux-:*:*'
    
    # Global variables; setup the first time _tmux is called.
    # For $_tmux_commands[] generation, see the very end of this file.
    typeset -ga _tmux_commands _tmux_aliases
    typeset -gA _tmux_aliasmap
    
    _tmux_aliasmap=(
        # clients and sessions
        attach      attach-session
        detach      detach-client
        has         has-session
        lsc         list-clients
        lscm        list-commands
        ls          list-sessions
        new         new-session
        refresh     refresh-client
        rename      rename-session
        showmsgs    show-messages
        source      source-file
        start       start-server
        suspendc    suspend-client
        switchc     switch-client
    
        # windows and panes
        breakp      break-pane
        capturep    capture-pane
        displayp    display-panes
        downp       down-pane
        findw       find-window
        joinp       join-pane
        killp       kill-pane
        killw       kill-window
        last        last-window
        linkw       link-window
        lsp         list-panes
        lsw         list-windows
        movew       move-window
        neww        new-window
        nextl       next-layout
        next        next-window
        pipep       pipe-pane
        prev        previous-window
        renamew     rename-window
        resizep     resize-pane
        respawnw    respawn-window
        rotatew     rotate-window
        selectl     select-layout
        selectp     select-pane
        selectw     select-window
        splitw      split-window
        swapp       swap-pane
        swapw       swap-window
        unlinkw     unlink-window
        upp         up-pane
    
        # key bindings
        bind        bind-key
        lsk         list-keys
        send        send-keys
        unbind      unbind-key
    
        # options
        set         set-option
        setw        set-window-option
        show        show-options
        showw       show-window-options
    
        # environment
        setenv      set-environment
        showenv     show-environment
    
        # status line
        confirm     confirm-before
        display     display-message
    
        # buffers
        clearhist   clear-history
        copyb       copy-buffer
        deleteb     delete-buffer
        lsb         list-buffers
        loadb       load-buffer
        pasteb      paste-buffer
        saveb       save-buffer
        setb        set-buffer
        showb       show-buffer
    
        # miscellaneous
        if          if-shell
        lock        lock-server
        run         run-shell
        info        server-info
    )
    
    # --- Sub-command functions ---
    # These *must* be called _tmux-*(); The description generation relies on
    # them being names that way. *No* other functions may match that pattern.
    # Other utility functions should be named __tmux-*() (see below).
    #
    # Another thing, the description generation needs, is handling of
    # $tmux_describe: If that parameter is non-empty, the sub-command function
    # should only print a description of the sub-command it handles and return
    # immidiately after doing so.
    #
    # To add support for a new sub-command, you only have to add a new
    # _tmux-() function below (preferably alphabetically sorted), that
    # behaves like described above; and add a alias->command pair in the
    # _tmux_aliasmap associative array above (if the comand in fact has an
    # alias). The rest should just work[tm].
    
    function _tmux-attach-session() {
        [[ -n ${tmux_describe} ]] && print "Attach or switch to a session" && return
        local -a args
    
        args=(
            '-d[detach other clients attached to target session]'
            '-r[put the client into read-only mode]'
            '-t[choose a target session]:target session:__tmux-sessions'
        )
        _arguments ${args}
    }
    
    function _tmux-bind-key() {
        [[ -n ${tmux_describe} ]] && print "Bind a key to a command" && return
        local curcontext="${curcontext}" state
        local -a args
    
        args=(
            '-c[bind to command mode instead of normal mode]'
            '-n[make the binding work without the need for the prefix key]'
            '-r[the key may repeat]'
            '-t[choose a key table for the binding]:key tables:__tmux-key-tables'
            '1: :->key'
            '*:: :->command_and_args'
        )
        _arguments -C ${args} && return
    
        if [[ ${state} == 'key' ]]; then
            _message "key"
        else
            # quite cool, that this works. :-)
            _tmux
        fi
    }
    
    function _tmux-break-pane() {
        [[ -n ${tmux_describe} ]] && print "Break a pane from an existing into a new window" && return
        local -a args
        args=(
            '-d[do not make the new window become the active one]'
            '-t[choose a target pane]:panes:__tmux-panes'
        )
        _arguments ${args}
    }
    
    function _tmux-capture-pane() {
        [[ -n ${tmux_describe} ]] && print "Capture the contents of a pane to a buffer" && return
        local -a args
        args=(
            '-b[choose target buffer]:target buffer:__tmux-buffers'
            '-t[choose source pane]:source pane:__tmux-panes'
        )
        _arguments ${args}
    }
    
    function _tmux-choose-client() {
        [[ -n ${tmux_describe} ]] && print "Put a window into client choice mode" && return
        __tmux-choose-stuff
    }
    
    function _tmux-choose-session() {
        [[ -n ${tmux_describe} ]] && print "Put a window into session choice mode" && return
        __tmux-choose-stuff
    }
    
    function _tmux-choose-window() {
        [[ -n ${tmux_describe} ]] && print "Put a window into window choice mode" && return
        __tmux-choose-stuff
    }
    
    function _tmux-clear-history() {
        [[ -n ${tmux_describe} ]] && print "Remove and clear history for a pane" && return
        local -a args
        args=('-t[choose a target pane]:panes:__tmux-panes')
        _arguments ${args}
    }
    
    function _tmux-clock-mode() {
        [[ -n ${tmux_describe} ]] && print "Enter clock mode" && return
        local -a args
        args=('-t[choose a target pane]:panes:__tmux-panes')
        _arguments ${args}
    }
    
    function _tmux-command-prompt() {
        [[ -n ${tmux_describe} ]] && print "Open the tmux command prompt in a client" && return
        local state
        local -a args
        args=(
            '-p[list of prompts]:prompts:->plist'
            '-t[choose a target client]:clients:__tmux-clients'
            '*:: :->tmpl'
        )
        _arguments -C ${args} && return
        if [[ ${state} == 'plist' ]]; then
            _message "comma seperated list of prompts"
            return
        fi
        __tmux-lastarg ${state} 'tmpl' 1 "command template"
    }
    
    function _tmux-confirm-before() {
        [[ -n ${tmux_describe} ]] && print "Run a command but ask for confirmation before" && return
        local state
        local -a args
        args=(
            '-t[choose a target client]:clients:__tmux-clients'
            '*:: :->command_and_args'
        )
        _arguments -C ${args} && return
        __tmux-lastarg ${state} 'command_and_args' 1 "command string"
    }
    
    function _tmux-copy-buffer() {
        [[ -n ${tmux_describe} ]] && print "Copy session paste buffers" && return
        local state session
        local -a args
        local -ax bopts
    
        args=(
            '-a[choose a source buffer index]:buffer:->srcbuf'
            '-b[choose a destination buffer index]:buffer:->dstbuf'
            '-s[choose a source session]:session:->srcsession'
            '-t[choose a destination session]:session:->dstsession'
        )
        _arguments ${args}
    
        case ${state} in
            ((src|dst)session)
                __tmux-sessions
                return
                ;;
            (srcbuf)
                session="$(__tmux-get-optarg -s "${words[@]}")"
                ;;
            (srcbuf)
                session="$(__tmux-get-optarg -t "${words[@]}")"
                ;;
        esac
        if [[ -n ${session} ]]; then
            bopts=( -t ${session} )
            __tmux-buffers
            return
        fi
        bopts=()
        __tmux-buffers
    }
    
    function _tmux-copy-mode() {
        [[ -n ${tmux_describe} ]] && print "Enter copy mode" && return
        local -a args
        args=(
            '-t[choose a target pane]:panes:__tmux-panes'
            '-u[scroll up one page]'
        )
        _arguments ${args}
    }
    
    function _tmux-delete-buffer() {
        [[ -n ${tmux_describe} ]] && print "Delete a paste buffer" && return
        local state session
        local -a args
        local -ax bopts
    
        args=(
            '-b[choose a target buffer index]:panes:->buffer'
            '-t[choose a target session]:panes:->session'
        )
        _arguments ${args}
    
        case ${state} in
            (session)
                __tmux-sessions
                return
                ;;
            (buffer)
                session="$(__tmux-get-optarg -t "${words[@]}")"
                ;;
            (*) return ;;
        esac
        if [[ -n ${session} ]]; then
            bopts=( -t ${session} )
            __tmux-buffers
            return
        fi
        bopts=()
        __tmux-buffers
    }
    
    function _tmux-detach-client() {
        [[ -n ${tmux_describe} ]] && print "Detach a client from the server" && return
        local -a args
        args=('-t[choose a target client]:clients:__tmux-clients')
        _arguments ${args}
    }
    
    function _tmux-display-message() {
        [[ -n ${tmux_describe} ]] && print "Display a message in the status line" && return
        local -a args
        args=(
            '-p[print message to stdout]'
            '-t[choose a target client]:clients:__tmux-clients'
            '*:: :->msg'
        )
        _arguments ${args} && return
        __tmux-lastarg ${state} 'msg' 1 "message"
    }
    
    function _tmux-display-panes() {
        [[ -n ${tmux_describe} ]] && print "Display an indicator for each visible pane" && return
        local -a args
        args=('-t[choose a target client]:clients:__tmux-clients')
        _arguments ${args}
    }
    
    function _tmux-down-pane() {
        [[ -n ${tmux_describe} ]] && print "Move down a pane" && return
        local -a args
        args=('-t[choose a target pane]:panes:__tmux-panes')
        _arguments ${args}
    }
    
    function _tmux-find-window() {
        [[ -n ${tmux_describe} ]] && print "Search for a pattern in windows" && return
        local curcontext="${curcontext}" state
        local -a args
        args=(
            '-t[choose a target window]:windows:__tmux-windows'
            '*:: :->pattern'
        )
        _arguments ${args} && return
        __tmux-lastarg ${state} 'pattern' 1 "window search pattern"
    }
    
    function _tmux-has-session() {
        [[ -n ${tmux_describe} ]] && print "Check and report if a session exists on the server" && return
        local -a args
        args=('-t[choose a target session]:sessions:__tmux-sessions')
        _arguments ${args}
    }
    
    function _tmux-if-shell() {
        [[ -n ${tmux_describe} ]] && print "Execute a tmux command if a shell-command succeeded" && return
        local -a args
        args=(
            '1:shell command:'
            '2:tmux command:'
        )
        _arguments ${args}
    }
    
    function _tmux-join-pane() {
        [[ -n ${tmux_describe} ]] && print "Split a pane and move an existing one into the new space" && return
        local -a args
        args=(
            '-d[do not make the new window become the active one]'
            '-h[split horizontally]'
            '-v[split vertically]'
            '-l[define new pane'\''s size]: :_guard "[0-9]#" "numeric value"'
            '-p[define new pane'\''s size in percent]: :_guard "[0-9]#" "numeric value"'
            '-s[choose source pane]:window:__tmux-panes'
            '-t[choose target pane]:window:__tmux-panes'
        )
        _arguments ${args} && return
    }
    
    function _tmux-kill-pane() {
        [[ -n ${tmux_describe} ]] && print "Destroy a given pane" && return
        local -a args
        args=(
            '-a[kill all panes, except current]'
            '-t[choose a target pane]:panes:__tmux-panes'
        )
        _arguments ${args}
    }
    
    function _tmux-kill-server() {
        [[ -n ${tmux_describe} ]] && print "Kill clients, sessions and server" && return
        __tmux-nothing-else
    }
    
    function _tmux-kill-session() {
        [[ -n ${tmux_describe} ]] && print "Destroy a given session" && return
        local -a args
        args=('-t[choose a target session]:sessions:__tmux-sessions')
        _arguments ${args}
    }
    
    function _tmux-kill-window() {
        [[ -n ${tmux_describe} ]] && print "Destroy a given window" && return
        local -a args
        args=('-t[choose a target window]:windows:__tmux-windows')
        _arguments ${args}
    }
    
    function _tmux-last-window() {
        [[ -n ${tmux_describe} ]] && print "Select the previously selected window" && return
        local -a args
        args=('-t[choose a session]:sessions:__tmux-sessions')
        _arguments ${args} && return
    }
    
    function _tmux-link-window() {
        [[ -n ${tmux_describe} ]] && print "Link a window to another" && return
        local -a args
        args=(
            '-d[do not make the new window become the active one]'
            '-k[kill the target window if it exists]'
            '-s[choose source window]:window:__tmux-windows'
            '-t[choose destination window]:window:__tmux-windows'
        )
        _arguments ${args}
    }
    
    function _tmux-list-buffers() {
        [[ -n ${tmux_describe} ]] && print "List paste buffers of a session" && return
        local -a args
        args=('-t[choose a session]:sessions:__tmux-sessions')
        _arguments ${args} && return
    }
    
    function _tmux-list-clients() {
        [[ -n ${tmux_describe} ]] && print "List clients attached to server" && return
        __tmux-nothing-else
    }
    
    function _tmux-list-commands() {
        [[ -n ${tmux_describe} ]] && print "List supported sub-commands" && return
        __tmux-nothing-else
    }
    
    function _tmux-list-keys() {
        [[ -n ${tmux_describe} ]] && print "List all key-bindings" && return
        local -a args
        args=('-t[choose a key table]:key table:__tmux-key-tables')
        _arguments ${args} && return
    }
    
    function _tmux-list-panes() {
        [[ -n ${tmux_describe} ]] && print "List panes of a window" && return
        local -a args
        args=('-t[choose a window]:windows:__tmux-windows')
        _arguments ${args} && return
    }
    
    function _tmux-list-sessions() {
        [[ -n ${tmux_describe} ]] && print "List sessions managed by server" && return
        __tmux-nothing-else
    }
    
    function _tmux-list-windows() {
        [[ -n ${tmux_describe} ]] && print "List windows of a session" && return
        local -a args
        args=('-t[choose a session]:sessions:__tmux-sessions')
        _arguments ${args} && return
    }
    
    function _tmux-load-buffer() {
        [[ -n ${tmux_describe} ]] && print "Load a file into a paste buffer" && return
        local state session
        local -a args
        local -ax bopts
    
        args=(
            '-b[choose a target buffer index]:panes:->buffer'
            '-t[choose a target session]:panes:->session'
            '1:file name:_files -g "*(-.)"'
        )
        _arguments ${args}
    
        case ${state} in
            (session)
                __tmux-sessions
                return
                ;;
            (buffer)
                session="$(__tmux-get-optarg -t "${words[@]}")"
                ;;
            (*) return ;;
        esac
        if [[ -n ${session} ]]; then
            bopts=( -t ${session} )
            __tmux-buffers
            return
        fi
        bopts=()
        __tmux-buffers
    }
    
    function _tmux-lock-client() {
        [[ -n ${tmux_describe} ]] && print "Lock a client" && return
        local -a args
        args=('-t[choose a client]:clients:__tmux-clients')
        _arguments ${args} && return
    }
    
    function _tmux-lock-server() {
        [[ -n ${tmux_describe} ]] && print "Lock all clients attached to the server" && return
        __tmux-nothing-else
    }
    
    function _tmux-lock-session() {
        [[ -n ${tmux_describe} ]] && print "Lock all clients attached to a session" && return
        local -a args
        args=('-t[choose a session]:sessions:__tmux-sessions')
        _arguments ${args} && return
    }
    
    function _tmux-move-window() {
        [[ -n ${tmux_describe} ]] && print "Move a window to another" && return
        local -a args
        args=(
            '-d[do not make the new window become the active one]'
            '-s[choose source window]:window:__tmux-windows'
            '-t[choose destination window]:window:__tmux-windows'
        )
        _arguments ${args}
    }
    
    function _tmux-new-session() {
        [[ -n ${tmux_describe} ]] && print "Create a new session" && return
        local -a args
        args=(
            '-d[attach the new session the current terminal]'
            '-n[name the initial window]:window name'
            '-s[name the session]:session name'
            '-t[specify target session]:sessions:__tmux-sessions'
            '*:: :_command'
        )
        _arguments ${args}
    }
    
    function _tmux-new-window() {
        [[ -n ${tmux_describe} ]] && print "Create a new window" && return
        local -a args
        args=(
            '-d[do not make the new window become the active one]'
            '-k[destroy it if the specified window exists]'
            '-n[specify a window name]:window name:'
            '-t[specify target window]:windows:__tmux-windows'
            '*:: :_command'
        )
        _arguments ${args}
    }
    
    function _tmux-next-layout() {
        [[ -n ${tmux_describe} ]] && print "Move a window to the next layout" && return
        local -a args
        args=('-t[choose target window]:window:__tmux-windows')
        _arguments ${args}
    }
    
    function _tmux-next-window() {
        [[ -n ${tmux_describe} ]] && print "Move to the next window in a session" && return
        local -a args
        args=(
            '-a[move to the next window with activity]'
            '-t[choose target session]:session:__tmux-sessions'
        )
        _arguments ${args}
    }
    
    function _tmux-paste-buffer() {
        [[ -n ${tmux_describe} ]] && print "Insert a paste buffer into the window" && return
        local -a args
        args=(
            '-d[remove buffer from stack after pasting]'
            '-r[do not replace LF with CR when pasting]'
            '-b[choose buffer]:source buffer:__tmux-buffers'
            '-t[choose target window]:window:__tmux-windows'
        )
        _arguments ${args}
    }
    
    function _tmux-pipe-pane() {
        [[ -n ${tmux_describe} ]] && print "Pipe output from a pane to a shell command" && return
        local state
        args=(
            '-o[only open a pipe if none is currently opened]'
            '-t[choose target pane]:pane:__tmux-panes'
            '*:: :->cmd'
        )
        _arguments ${args} && return
        __tmux-lastarg ${state} 'cmd' 1 "command string"
    }
    
    function _tmux-previous-layout() {
        [[ -n ${tmux_describe} ]] && print "Move a window to the previous layout" && return
        local -a args
        args=('-t[choose target window]:window:__tmux-windows')
        _arguments ${args}
    }
    
    function _tmux-previous-window() {
        [[ -n ${tmux_describe} ]] && print "Move to the previous window in a session" && return
        local -a args
        args=(
            '-a[move to the previous window with activity]'
            '-t[choose target session]:session:__tmux-sessions'
        )
        _arguments ${args}
    }
    
    function _tmux-refresh-client() {
        [[ -n ${tmux_describe} ]] && print "Refresh a client" && return
        local -a args
        args=('-t[choose target client]:client:__tmux-clients')
        _arguments ${args}
    }
    
    function _tmux-rename-session() {
        [[ -n ${tmux_describe} ]] && print "Rename a session" && return
        local state
        args=(
            '-t[choose target session]:session:__tmux-sessions'
            '*:: :->name'
        )
        _arguments ${args} && return
        __tmux-lastarg ${state} 'name' 1 "new session name"
    }
    
    function _tmux-rename-window() {
        [[ -n ${tmux_describe} ]] && print "Rename a window" && return
        local state
        args=(
            '-t[choose target window]:window:__tmux-windows'
            '*:: :->name'
        )
        _arguments ${args} && return
        __tmux-lastarg ${state} 'name' 1 "new window name"
    }
    
    function _tmux-resize-pane() {
        [[ -n ${tmux_describe} ]] && print "Resize a pane" && return
        args=(
            '-D[resize downward]'
            '-L[resize to the left]'
            '-R[resize to the right]'
            '-U[resize upward]'
            '-t[choose target pane]:pane:__tmux-panes'
            '1::adjustment (defaults to one):_guard "[0-9]#" "numeric value"'
        )
        _arguments ${args}
    }
    
    function _tmux-respawn-window() {
        [[ -n ${tmux_describe} ]] && print "Reuse a window in which a command has exited" && return
        local -a args
        args=(
            '-k[kill window if it is in use]'
            '-t[choose target window]:window:__tmux-windows'
            '*::command:_command'
        )
        _arguments ${args}
    }
    
    function _tmux-rotate-window() {
        [[ -n ${tmux_describe} ]] && print "Rotate positions of panes in a window" && return
        local -a args
        args=(
            '-D[rotate downward]'
            '-U[rotate upward]'
            '-t[choose target window]:window:__tmux-windows'
        )
        _arguments ${args}
    }
    
    function _tmux-run-shell() {
        [[ -n ${tmux_describe} ]] && print "Execute a command without creating a new window" && return
        _command
    }
    
    function _tmux-save-buffer() {
        [[ -n ${tmux_describe} ]] && print "Save a paste buffer to a file" && return
        local state session
        local -a args
        local -ax bopts
    
        args=(
            '-b[choose a target buffer index]:buffer:->buffer'
            '-t[choose a target session]:buffer:->session'
        )
        _arguments ${args}
    
        case ${state} in
            (session)
                __tmux-sessions
                return
                ;;
            (buffer)
                session="$(__tmux-get-optarg -t "${words[@]}")"
                ;;
            (*) return ;;
        esac
        if [[ -n ${session} ]]; then
            bopts=( -t ${session} )
            __tmux-buffers
            return
        fi
        bopts=()
        __tmux-buffers
    }
    
    function _tmux-select-layout() {
        [[ -n ${tmux_describe} ]] && print "Choose a layout for a window" && return
        args=(
            '-t[choose a target window]:target window:__tmux-windows'
            '*::layout name:__tmux-layouts'
        )
        _arguments ${args}
    }
    
    function _tmux-select-pane() {
        [[ -n ${tmux_describe} ]] && print "Make a pane the active one in the window" && return
        local -a args
        args=('-t[choose a target pane]:panes:__tmux-panes')
        _arguments ${args} && return
    }
    
    function _tmux-select-prompt() {
        [[ -n ${tmux_describe} ]] && print "Open a prompt to enter a window index" && return
        local -a args
        args=('-t[choose a target client]:clients:__tmux-clients')
        _arguments ${args} && return
    }
    
    function _tmux-select-window() {
        [[ -n ${tmux_describe} ]] && print "Select a window" && return
        local -a args
        args=('-t[choose a target window]:windows:__tmux-windows')
        _arguments ${args} && return
    }
    
    function _tmux-send-keys() {
        [[ -n ${tmux_describe} ]] && print "Send key(s) to a window" && return
        local curcontext="${curcontext}" state
        local -a args
        args=(
            '-t[choose a target pane]:panes:__tmux-panes'
            '*:: :->key'
        )
        _arguments ${args} && return
        __tmux-lastarg ${state} 'key' 1 "key"
    }
    
    function _tmux-send-prefix() {
        [[ -n ${tmux_describe} ]] && print "Send the prefix key to a window" && return
        local -a args
        args=('-t[choose a target pane]:panes:__tmux-panes')
        _arguments ${args}
    }
    
    function _tmux-server-info() {
        [[ -n ${tmux_describe} ]] && print "Show server information" && return
        __tmux-nothing-else
    }
    
    function _tmux-set-buffer() {
        [[ -n ${tmux_describe} ]] && print "Set contents of a paster buffer" && return
        local state session
        local -a args
        local -ax bopts
    
        args=(
            '-b[choose a target buffer index]:panes:->buffer'
            '-t[choose a target session]:panes:->session'
        )
        _arguments ${args}
    
        case ${state} in
            (session)
                __tmux-sessions
                return
                ;;
            (buffer)
                session="$(__tmux-get-optarg -t "${words[@]}")"
                ;;
            (*) return ;;
        esac
        if [[ -n ${session} ]]; then
            bopts=( -t ${session} )
            __tmux-buffers
            return
        fi
        bopts=()
        __tmux-buffers
    }
    
    function _tmux-set-environment() {
        [[ -n ${tmux_describe} ]] && print "(Un)Set an environment variable" && return
        local state
        local -a args
        args=(
            '-g[modify global environment]'
            '-r[remove variable before starting new processes]'
            '-u[unset a variable]'
            '-t[choose a target session]:target session:__tmux-sessions'
            '*:: :->name_or_value'
        )
        _arguments -C ${args}
    
        case ${state} in
            name_or_value)
                if (( CURRENT == 1 )); then
                    _message 'name'
                elif (( CURRENT == 2 )); then
                    _message 'value'
                else
                    __tmux-nothing-else
                fi
                ;;
        esac
    }
    
    function _tmux-set-option() {
        [[ -n ${tmux_describe} ]] && print "Set a session option" && return
        local mode
        local -a args
        args=(
            '-a[append to string options]'
            '-g[set a global session option]'
            '-u[unset a non-global option]'
            '-w[change window (not session) options]'
            '-s[change server (not session) options]'
            '-t[choose a target session]:target session:__tmux-sessions'
            '*:: :->name_or_value'
        )
        if __tmux-got-option-already -w; then
            mode=window
        elif __tmux-got-option-already -s; then
            mode=server
        else
            mode=session
        fi
        _arguments -C ${args}
        __tmux-options-complete ${mode} ${state}
    }
    
    function _tmux-set-window-option() {
        [[ -n ${tmux_describe} ]] && print "Set a window option" && return
        local -a args
        args=(
            '-a[append to string options]'
            '-g[set a global window option]'
            '-u[unset a non-global option]'
            '-t[choose a target window]:target window:__tmux-windows'
            '*:: :->name_or_value'
        )
        _arguments -C ${args}
        __tmux-options-complete window ${state}
    }
    
    function _tmux-show-buffer() {
        [[ -n ${tmux_describe} ]] && print "Display the contents of a paste buffer" && return
        local state session
        local -a args
        local -ax bopts
    
        args=(
            '-b[choose a target buffer index]:panes:->buffer'
            '-t[choose a target session]:panes:->session'
        )
        _arguments ${args}
    
        case ${state} in
            (session)
                __tmux-sessions
                return
                ;;
            (buffer)
                session="$(__tmux-get-optarg -t "${words[@]}")"
                ;;
            (*) return ;;
        esac
        if [[ -n ${session} ]]; then
            bopts=( -t ${session} )
            __tmux-buffers
            return
        fi
        bopts=()
        __tmux-buffers
    }
    
    function _tmux-show-environment() {
        [[ -n ${tmux_describe} ]] && print "Display the environment" && return
        local -a args
        args=(
            '-g[show global environment]'
            '-t[choose a target session]:target session:__tmux-sessions'
        )
        _arguments ${args}
    }
    
    function _tmux-show-messages() {
        [[ -n ${tmux_describe} ]] && print "Show client"\'"s message log" && return
        args=('-t[choose target client]:client:__tmux-clients')
        _arguments ${args}
    }
    
    function _tmux-show-options() {
        [[ -n ${tmux_describe} ]] && print "Show session options" && return
        local -a args
        args=(
            '-g[show global options]'
            '-t[choose a target session]:target session:__tmux-sessions'
        )
        _arguments ${args}
    }
    
    function _tmux-show-window-options() {
        [[ -n ${tmux_describe} ]] && print "Show window options" && return
        local -a args
        args=(
            '-g[show global options]'
            '-t[choose a target window]:target window:__tmux-windows'
        )
        _arguments ${args}
    }
    
    function _tmux-source-file() {
        [[ -n ${tmux_describe} ]] && print "Execute tmux commands from a file" && return
        _files -g "*(-.)"
    }
    
    function _tmux-split-window() {
        [[ -n ${tmux_describe} ]] && print "Splits a pane into two" && return
        local -a args
        args=(
            '-d[do not make the new window become the active one]'
            '-h[split horizontally]'
            '-v[split vertically]'
            '-l[define new pane'\''s size]: :_guard "[0-9]#" "numeric value"'
            '-p[define new pane'\''s size in percent]: :_guard "[0-9]#" "numeric value"'
            # Yes, __tmux_pane is correct here. The behaviour was changed
            # in recent tmux versions and makes more sense. Except that
            # changing the command's name might annoy users. So it stays like
            # this.
            '-t[choose target pane]:window:__tmux-panes'
            '*:: :_command'
        )
        _arguments ${args} && return
    }
    
    function _tmux-start-server() {
        [[ -n ${tmux_describe} ]] && print "Start a tmux server" && return
        __tmux-nothing-else
    }
    
    function _tmux-suspend-client() {
        [[ -n ${tmux_describe} ]] && print "Suspend a client" && return
        local -a args
        args=('-t[choose destination client]:client:__tmux-clients')
        _arguments ${args}
    }
    
    function _tmux-swap-pane() {
        [[ -n ${tmux_describe} ]] && print "Swap two panes" && return
        local -a args
        args=(
            '-D[move pane down]'
            '-U[move pane up]'
            '-d[do not change the active pane]'
            '-s[choose source pane]:pane:__tmux-panes'
            '-t[choose destination pane]:pane:__tmux-panes'
        )
        _arguments ${args}
    }
    
    function _tmux-swap-window() {
        [[ -n ${tmux_describe} ]] && print "Swap two windows" && return
        local -a args
        args=(
            '-d[do not make the new window become the active one]'
            '-s[choose source window]:window:__tmux-windows'
            '-t[choose destination window]:window:__tmux-windows'
        )
        _arguments ${args}
    }
    
    function _tmux-switch-client() {
        [[ -n ${tmux_describe} ]] && print "Switch the client to another session" && return
        local -a args
        args=(
            '-c[choose a target client]:client:__tmux-clients'
            '-t[choose a target window]:window:__tmux-windows'
        )
        _arguments ${args}
    }
    
    function _tmux-unbind-key() {
        [[ -n ${tmux_describe} ]] && print "Unbind a key" && return
        local state keytable
        local -a args ow
    
        ow=( "${words[@]}" )
        args=(
            '-c[kill the window if it is only in one session]'
            '-n[remove a non-prefix binding]'
            '-t[choose a key table]:key table:__tmux-key-tables'
            '*:: :->boundkeys'
        )
        _arguments ${args} && return
        [[ ${state} != 'boundkeys' ]] && return
        keytable="$(__tmux-get-optarg -t "${ow[@]}")"
        if [[ -n ${keytable} ]]; then
            __tmux-bound-keys -t ${keytable}
            return
        fi
        __tmux-bound-keys
    }
    
    function _tmux-unlink-window() {
        [[ -n ${tmux_describe} ]] && print "Unlink a window" && return
        local -a args
        args=(
            '-k[kill the window if it is only in one session]'
            '-t[choose a target window]:target window:__tmux-windows'
        )
        _arguments ${args}
    }
    
    function _tmux-up-pane() {
        [[ -n ${tmux_describe} ]] && print "Move up a pane" && return
        local -a args
        args=('-t[choose a target pane]:panes:__tmux-panes')
        _arguments ${args}
    }
    
    # --- Utility functions ---
    # They should be called __tmux-*() and kept seperate from the
    # sub-command functions.
    
    function __tmux-attributes() {
        local -a attr already
        attr=( default bright bold dim underscore blink reverse hidden italics )
        compset -P '*,'
        already=(${(s<,>)IPREFIX})
        _describe -t tmux-attribute 'tmux attribute' attr -S, -F already -q
    }
    
    function __tmux-buffers() {
        local expl
        local -a buffers
    
        if [[ ${(t)bopts} != *array* ]]; then
            local -a bopts; bopts=()
        fi
    
        buffers=( ${${(f)"$(command tmux list-buffers "${bopts[@]}")"}/:[ $'\t']##/:} )
        _describe -t buffers 'buffers' buffers
    }
    
    function __tmux-bound-keys() {
        local expl
        local -a keys
    
        keys=( ${${${${(f)"$(command tmux list-keys "$@")"}/:[ $'\t']##/:}/(#s)[ $'\t']##/}/(#s):/\\:} )
        _describe -t keys 'keys' keys
    }
    
    function __tmux-choose-stuff() {
        # choose-{client,session,window} accept exactly the same arguments, so...
        local curcontext="${curcontext}" state
        local -a args
        args=(
            '-t[choose a target pane]:panes:__tmux-panes'
            '*:: :->tmpl'
        )
        _arguments ${args} && return
        __tmux-lastarg ${state} 'tmpl' 1 "tmux command template"
    }
    
    function __tmux-clients() {
        local expl
        local -a clients
        clients=( ${${(f)"$(command tmux list-clients)"}/:[ $'\t']##/:} )
        _describe -t clients 'clients' clients
    }
    
    function __tmux-colours() {
        local -a colnames
        colnames=( default black red green yellow blue magenta cyan white colourN:"replace N by a number between 0 and 255" )
        compset -P 'colour*'
        if [[ -z ${IPREFIX} ]]; then
            _describe -t tmux-colours 'colour' colnames
        else
            _message 'colour number 0..255'
        fi
    }
    
    function __tmux-get-optarg() {
        local opt="$1"
        local -i i
        shift
    
        for (( i = 1; i <= $#; i++ )); do
            if [[ ${argv[$i]} == ${opt} ]]; then
                if [[ ${argv[$(( i + 1 ))]} != -* ]]; then
                    print -- ${argv[$(( i + 1 ))]}
                fi
                return
            fi
        done
    }
    
    function __tmux-got-option-already() {
        [[ -n ${(M)words:#$1} ]] && return 0
        return 1
    }
    
    function __tmux-key-tables() {
        local expl
        local -a tables
        tables=( vi-edit emacs-edit vi-choice emacs-choice vi-copy emacs-copy )
        _wanted keytable expl 'key tables' compadd ${expl} -- ${tables}
    }
    
    function __tmux-lastarg() {
        local got_state="$1" want_state="$2" pos="$3" msg="$4"
    
        if [[ ${want_state} == ${got_state} ]] && (( CURRENT == ${pos} )); then
            _message ${msg}
        else
            __tmux-nothing-else
        fi
    }
    
    function __tmux-layouts() {
        local expl
        local -a layouts
        layouts=( even-horizontal even-vertical main-horizontal main-vertical )
        _wanted layout expl 'layouts' compadd ${expl} -- ${layouts}
    }
    
    function __tmux-nothing-else() {
        _message "no further arguments"
    }
    
    function __tmux-option-guard() {
        local mode opt guard int_guard
        mode="$1"
        opt="$2"
        shift; shift
        local -a options desc
        int_guard='_guard "[0-9]#" "'${opt}': numeric value"'
        if [[ ${mode} == 'session' ]]; then
            options=(
                'base-index:'${int_guard}
                'bell-action:DESC:any none current'
                'buffer-limit:'${int_guard}
                'default-command:MSG:command string'
                'default-path:MSG:path name'
                'default-shell:MSG:shell executable'
                'default-terminal:MSG:terminal string'
                'display-panes-colour:__tmux-colours'
                'display-panes-active-colour:__tmux-colours'
                'display-panes-time:'${int_guard}
                'display-time:'${int_guard}
                'history-limit:'${int_guard}
                'lock-after-time:'${int_guard}
                'lock-command:MSG:command string'
                'lock-server:DESC:on off'
                'message-attr:__tmux-attributes'
                'message-bg:__tmux-colours'
                'message-fg:__tmux-colours'
                'message-limit:'${int_guard}
                'mouse-select-pane:DESC:on off'
                'pane-border-bg:__tmux-colours'
                'pane-border-fg:__tmux-colours'
                'pane-active-border-bg:__tmux-colours'
                'pane-active-border-fg:__tmux-colours'
                'prefix:MSG:comma-seperated key list'
                'repeat-time:'${int_guard}
                'set-remain-on-exit:DESC:on off'
                'set-titles:DESC:on off'
                'set-titles-string:MSG:title format string'
                'status:DESC:on off'
                'status-attr:__tmux-attributes'
                'status-bg:__tmux-colours'
                'status-fg:__tmux-colours'
                'status-interval:'${int_guard}
                'status-justify:DESC:left centre right'
                'status-keys:DESC:vi emacs'
                'status-left:MSG:format string'
                'status-left-attr:__tmux-attributes'
                'status-left-bg:__tmux-colours'
                'status-left-fg:__tmux-colours'
                'status-left-length:'${int_guard}
                'status-right:MSG:format string'
                'status-right-attr:__tmux-attributes'
                'status-right-bg:__tmux-colours'
                'status-right-fg:__tmux-colours'
                'status-right-length:'${int_guard}
                'status-utf8:DESC:on off'
                'terminal-overrides:MSG:overrides string'
                'update-environment:MSG:string listing env. variables'
                'visual-activity:DESC:on off'
                'visual-bell:DESC:on off'
                'visual-content:DESC:on off'
            )
        elif [[ ${mode} == 'server' ]]; then
            options=(
                'escape-time:'${int_guard}
                'quiet:DESC:on off'
            )
        else
            options=(
                'aggressive-resize:DESC:on off'
                'alternate-screen:DESC:on off'
                'automatic-rename:DESC:on off'
                'clock-mode-colour:__tmux-colours'
                'clock-mode-style:DESC:12 24'
                'force-height:'${int_guard}
                'force-width:'${int_guard}
                'main-pane-height:'${int_guard}
                'main-pane-width:'${int_guard}
                'mode-attr:__tmux-attributes'
                'mode-bg:__tmux-colours'
                'mode-fg:__tmux-colours'
                'mode-keys:DESC:vi emacs'
                'mode-mouse:DESC:on off'
                'monitor-activity:DESC:on off'
                'monitor-content:MSG:fnmatch(3) pattern'
                'remain-on-exit:DESC:on off'
                'synchronize-panes:DESC:on off'
                'utf8:DESC:on off'
                'window-status-attr:__tmux-attributes'
                'window-status-bg:__tmux-colours'
                'window-status-current-attr:__tmux-attributes'
                'window-status-current-bg:__tmux-colours'
                'window-status-current-fg:__tmux-colours'
                'window-status-current-format:MSG:status format string'
                'window-status-fg:__tmux-colours'
                'window-status-format:MSG:status format string'
                'xterm-keys:DESC:on off'
            )
        fi
    
        guard=${(M)options:#$opt:*}
        if [[ -z ${guard} ]]; then
            _message "unknown ${mode} option: ${opt}"
            return
        fi
        _message "${mode} option value"
        guard=${guard#*:}
        case ${guard} in
            ('') ;;
            (MSG:*)
                _message ${guard#*:}
                ;;
            (DESC:*)
                eval "desc=( ${guard#*:} )"
                _describe -t "tmux-${mode}-option-value" "${opt}" desc
                ;;
            (*)
                eval ${guard}
                ;;
        esac
    }
    
    function __tmux-options() {
        local -a tmux_options
        tmux_options=(
            'base-index:define where to start numbering'
            'bell-action:set action on window bell'
            'buffer-limit:number of buffers kept per session'
            'default-command:default command for new windows'
            'default-path:default working directory'
            'default-shell:default shell executable'
            'default-terminal:default terminal definition string'
            'display-panes-colour:colour used for display-panes'
            'display-panes-active-colour:colour for active pane in display-panes'
            'display-panes-time:time (in msecs) of display-panes output'
            'display-time:time (in msecs) messages are displayed'
            'history-limit:number of copy-mode lines per window'
            'lock-after-time:lock sessions after N seconds'
            'lock-command:command to run for locking a client'
            'lock-server:make lock-after-time lock the server instead of sessions'
            'message-attr:set status line message attributes'
            'message-bg:set status line message background colour'
            'message-fg:set status line message foreground colour'
            'message-limit:set size of message log per client'
            'mouse-select-pane:make mouse clicks select window panes'
            'pane-border-bg:set pane border foreground colour'
            'pane-border-fg:set pane border background colour'
            'pane-active-border-bg:set active pane border foreground colour'
            'pane-active-border-fg:set active pane border background colour'
            'prefix:comma seperated line of keys accepted as prefix key'
            'repeat-time:time for multiple commands without prefix-key presses'
            'set-remain-on-exit:set remain-on-exit window option'
            'set-titles:try to set xterm window titles'
            'set-titles-string:format used by set-titles'
            'status:show or hide the status bar'
            'status-attr:status bar attributes'
            'status-bg:status bar background colour'
            'status-fg:status bar foreground colour'
            'status-interval:interval (in seconds) for status bar updates'
            'status-justify:position of the window list in status bar'
            'status-keys:mode to use in status bar modes (vi/emacs)'
            'status-left:format to use left in status bar'
            'status-left-attr:attribute for the left part of the status bar'
            'status-left-bg:background colour of the left part of the status bar'
            'status-left-fg:foreground colour of the left part of the status bar'
            'status-left-length:maximum length of the left part of the status bar'
            'status-right:format to use right in status bar'
            'status-right-attr:attribute for the right part of the status bar'
            'status-right-bg:background colour of the right part of the status bar'
            'status-right-fg:foreground colour of the right part of the status bar'
            'status-right-length:maximum length of the right part of the status bar'
            'status-utf8:assume UTF-8 sequences to appear in status bar'
            'terminal-overrides:override terminal descriptions'
            'update-environment:list of variables to be copied to a session'\''s environment'
            'visual-activity:display status line messages upon activity'
            'visual-bell:use visual bell instead of audible'
            'visual-content:display status line messages upon content changes'
        )
        _describe -t tmux-options 'tmux option' tmux_options
    }
    
    function __tmux-options-complete() {
        local mode="$1" state="$2"
    
        case ${state} in
            name_or_value)
                if (( CURRENT == 1 )) && [[ ${mode} == 'session' ]]; then
                    __tmux-options
                elif (( CURRENT == 1 )) && [[ ${mode} == 'server' ]]; then
                    __tmux-server-options
                elif (( CURRENT == 1 )) && [[ ${mode} == 'window' ]]; then
                    __tmux-window-options
                elif (( CURRENT == 2 )); then
                    __tmux-option-guard ${mode} ${words[1]}
                else
                    __tmux-nothing-else
                fi
                ;;
        esac
    }
    
    function __tmux-panes() {
        local expl line
        local -i num
        local -a panes opts
    
        compset -P '*.'
        if [[ -n ${IPREFIX} ]]; then
            opts=( -t "${IPREFIX%.}" )
        else
            opts=( )
        fi
        num=0
        command tmux list-panes "${opts[@]}" | while IFS= read -r line; do
            panes+=( $(( num++ )):${line//:/} )
        done
        _describe -t panes 'panes' panes "$@"
        if [[ ${IPREFIX} != *. ]]; then
            _wanted windows expl 'windows' __tmux-windows -S.
        fi
    }
    
    function __tmux-server-options() {
        local -a tmux_server_options
        tmux_server_options=(
            'escape-time:set timeout to detect single escape characters (in msecs)'
            'quiet:enable/disable the display of various informational messages'
        )
        _describe -t tmux-server-options 'tmux server option' tmux_server_options
    }
    
    function __tmux-sessions() {
        local expl
        local -a sessions
        sessions=( ${${(f)"$(command tmux list-sessions)"}/:[ $'\t']##/:} )
        _describe -t sessions 'sessions' sessions "$@"
    }
    
    function __tmux-socket-name() {
        local expl sdir
        local curcontext="${curcontext}"
        local -a socks
        zstyle -s ":completion:${curcontext}:sockets" socketdir sdir || sdir="/tmp/tmux-${UID}"
        socks=(${sdir}/*(=:t))
        _wanted socket expl 'socket name' compadd ${expl} -- ${socks}
    }
    
    function __tmux-window-options() {
        local -a tmux_window_options
        tmux_window_options=(
            'aggressive-resize:aggressively resize windows'
            'alternate-screen:allow alternate screen feature to be used'
            'automatic-rename:attempt to automatically rename windows'
            'clock-mode-colour:set clock colour'
            'clock-mode-style:set clock hour format (12/24)'
            'force-height:force a windows to a certain height'
            'force-width:force a windows to a certain width'
            'main-pane-height:set height for main-* layouts'
            'main-pane-width:set width for main-* layouts'
            'mode-attr:set window modes attributes'
            'mode-bg:set window modes background colour'
            'mode-fg:set window modes foreground colour'
            'mode-keys:mode to use in copy and choice modes (vi/emacs)'
            'mode-mouse:use mouse in modes'
            'monitor-activity:monitor window activity'
            'monitor-content:monitor window contents for a fnmatch(3) pattern'
            'remain-on-exit:do not destroy windows after the program exits'
            'synchronize-panes:send input to all panes of a window'
            'utf8:assume UTF-8 sequences to appear in a window'
            'window-status-attr:set status line attributes for a window'
            'window-status-bg:set status line background for a window'
            'window-status-current-attr:set status line attributes for active window'
            'window-status-current-bg:set status line background for active window'
            'window-status-current-fg:set status line foreground for active window'
            'window-status-current-format:set status line format for active window'
            'window-status-fg:set status line foreground for a window'
            'window-status-format:set status line format for all but the active window'
            'xterm-keys:generate xterm-style function key sequences'
        )
        _describe -t tmux-window-options 'tmux window option' tmux_window_options
    }
    
    function __tmux-windows() {
        local expl
        local -a wins opts
    
        compset -P '*:'
        if [[ -n ${IPREFIX} ]]; then
            opts=( -t "${IPREFIX%:}" )
        else
            opts=( )
        fi
        wins=( ${${(M)${(f)"$(command tmux list-windows "${opts[@]}")"}:#<->*}/:[ $'\t']##/:} )
        _describe -t windows 'windows' wins "$@"
        if [[ ${IPREFIX} != *: ]]; then
            _wanted sessions expl 'sessions' __tmux-sessions -S:
        fi
    }
    
    # And here is the actual _tmux(), that puts it all together:
    function _tmux() {
        local curcontext="${curcontext}"
        local mode state ret
        local -a args
        local -x tmuxcommand
        unset tmux_describe
    
        args=(
            '-2[force using 256 colours]'
            '-8[force using 88 colours]'
            '-c[execute a shell command]:command name:_command_names'
            '-f[specify configuration file]:tmux config file:_files -g "*(-.)"'
            '-l[behave like a login shell]'
            '-L[specify socket name]:socket name:__tmux-socket-name'
            '-q[do not send informational messages]'
            '-S[specify socket path]:server socket:_path_files -g "*(=,/)"'
            '-u[force using UTF-8]'
            '-v[request verbose logging]'
            '*:: :->subcommand_or_options'
        )
        _arguments -C -s -w ${args} && return
    
        if [[ ${state} == "subcommand_or_options" ]]; then
            if (( CURRENT == 1 )) ; then
                zstyle -s ":completion:${curcontext}:subcommands" mode mode || mode='both'
                if [[ ${mode} == 'commands' ]]; then
                    _describe -t subcommands 'tmux commands' _tmux_commands
                elif [[ ${mode} == 'aliases' ]]; then
                    _describe -t subcommands 'tmux aliases' _tmux_aliases
                else
                    _describe -t subcommands 'tmux commands and aliases' _tmux_commands -- _tmux_aliases
                fi
            else
                tmuxcommand="${words[1]}"
                if [[ -n ${_tmux_aliasmap[$tmuxcommand]} ]] ; then
                    tmuxcommand="${_tmux_aliasmap[$tmuxcommand]}"
                fi
                curcontext="${curcontext%:*:*}:tmux-${tmuxcommand}:"
                _call_function ret _tmux-${tmuxcommand}
            fi
        fi
    }
    
    # description generation follows; only done on 1st _tmux call.
    local f desc
    local -A rev
    local -x tmux_describe
    tmux_describe='yes, please'
    for f in ${(k)_tmux_aliasmap} ; do
        rev+=( ${_tmux_aliasmap[$f]} $f )
    done
    for f in ${(M)${(k)functions}:#_tmux-*} ; do
        desc="$($f)"
        _tmux_commands+=( "${f#_tmux-}${desc:+:$desc}" )
        [[ -n ${rev[${f#_tmux-}]} ]] && _tmux_aliases+=( "${rev[${f#_tmux-}]}${desc:+:$desc}" )
    done
    unset desc f rev tmux_describe
    
    _tmux
    PK[8ZZfunctions/_nothingnuW+A#compdef true false log times clear logname whoami sync
    
    _message 'no argument or option'
    PK[~.functions/_tcpdumpnuW+A#compdef tcpdump
    
    typeset -A opt_args
    
    _interfaces () {
    	_wanted interfaces expl 'network interface' \
    		_net_interfaces
    	_values "Pseudo-device that captures on all interfaces" "any"
    }
    
    _esp_secrets () {
    	_values -S : 'ESP algorithm' \
    		'des-cbc:secret' \
    		'3des-cbc:secret' \
    		'blowfish-cbc:secret' \
    		'rc3-cbc:secret' \
    		'cast128-cbc:secret' \
    		none
    }
    
    _packet_types () {
    	_values 'Packets type' \
    		'aodv[Ad-hoc On-demand Distance Vector protocol]' \
    		'cnfp[Cisco NetFlow protocol]' \
    		'rpc[Remote Procedure Call]' \
    		'rtp[Real-Time  Applications  protocol]' \
    		'rtcp[Real-Time Applications control protocol]' \
    		'snmp[Simple Network Management Protocol]' \
    		'tftp[Trivial File Transfer Protocol]' \
    		'vat[Visual Audio Tool]' \
    		'wb[distributed White Board]'
    }
    
    _data_link_types () {
    	if (( $+opt_args[-i] )); then
    		vals=( ${${${(s:  :)"$(_call_program data-link-types tcpdump -L -i $opt_args[-i] 2>&1)"}[2,-1]}/ /:} )
    		_describe -t data-link-types "data link types ($opt_args[-i])" vals && ret=0
    	else
    		_values "Data link types (general)" \
    			"EN10MB" \
    			"LINUX_SLL"
    	fi
    }
    
    _bpf_filter () {
    }
    
    _arguments \
      '()-A[print each packet in ASCII]' \
      -c'[exit after receiving specified number of packets]:number of packets' \
      -C'[specify output file size in MB (10e6 bytes)]:output file size' \
      '(-ddd)-d[dump the compiled packet-matching code in a human readable form]' \
      '(-ddd)-dd[dump packet-matching code as a C program fragment]' \
      '(-d -dd)-ddd[dump packet-matching code as decimal numbers (preceded with a count)]' \
      '(-A -c -C -d -dd -ddd -e -E -f -F -i -l -L -m -M -n -N -O -p -q -R -r -S -s -T -t -tt -ttt -tttt -u -U -v -vv -vvv -w -W -x -xx -X -XX -y -Z *)'-D'[print the list of the network interfaces available on the system]' \
      -e'[print the link-level header on each dump line]' \
      -E"[decrypting IPsec ESP packets]:spi@ipaddr::algo\:secret:_esp_secrets" \
      -f"[print 'foreign' IPv4 addresses numerically]" \
      -F'[input file for the filter expression]:filter expression file:_files' \
      -i'[interface]:interface:_interfaces' \
      -l'[make stdout line buffered]' \
      '(-A -c -C -d -dd -ddd -e -E -f -F -l -D -m -M -n -N -O -p -q -R -r -S -s -T -t -tt -ttt -tttt -u -U -v -vv -vvv -w -W -x -xx -X -XX -y -Z *)'-L'[list the known data link types for the interface]' \
      '*-m[load SMI MIB module definitions]:SMI MIB module definitions:_files' \
      -M'[shared secret for validating the digests in TCP segments with the TCP-MD5 option]:secret' \
      -n"[don't convert addresses to names]" \
      -N"[don't print domain name qualification of host names]" \
      -O"[don't run the packet-matching code optimizer]" \
      -p"[don't put the interface into promiscuous mode]" \
      -q'[quick (quiet?) output]' \
      -R'[assume ESP/AH packets to be based on old specification (RFC1825 to RFC1829)]' \
      -r'[read packets from file]:input file:_files' \
      -S'[print absolute TCP sequence numbers]' \
      -s'[specify number of bytes of data to snarf from each packet]:number of bytes to snap' \
      -T'[interpret captured packets as specified type]:packet type:_packet_types' \
      "(-tttt)-t[don't print a timestamp on each dump line]" \
      '(-ttt -tttt)-tt[print an unformatted timestamp on each dump line]' \
      '(-tt -tttt)-ttt[print a delta (in micro-seconds) between current and previous line on each dump line]' \
      '(-t -tt -ttt)-tttt[print a timestamp in default format proceeded by date on each dump line]' \
      -u'[print undecoded NFS handles]' \
      -U'[make output packet-buffered when saving to file (-w)]' \
      '(-vvv)-v[slightly more verbose output]' \
      '(-vvv)-vv[more verbose output]' \
      '(-v -vv)-vvv[most verbose output]' \
      -w'[write the raw packets to file]:output file:_files' \
      -W'[limit the number of created files (-C)]:number of files' \
      -x'[print each packet (minus its link level header) in hex]' \
      '(-x)-xx[print each packet, including its link level header, in hex]' \
      -X'[print each packet (minus its link level header) in hex and ASCII]' \
      '(-X)-XX[print each packet, including its link level header, in hex and ASCII]' \
      -y'[set the data link type to use while capturing packets]:data link type:_data_link_types' \
      -Z'[drops privileges (if root) and changes user ID (along with primary group)]:user:_users' \
      '*:BPF filter:_bpf_filter'
    PK[ى9  functions/replace-string-againnuW+A# Back end for replace-string; can be called as a widget to repeat
    # the previous replacement.  _replace_string_src and _replace_string_rep
    # are global.
    
    # When called from replace-string, we need to use the widget
    # name passed to decide whether to do pattern matching: the widget
    # may since have been overwritten.
    local MATCH MBEGIN MEND curwidget=${1:-$WIDGET}
    local -a match mbegin mend
    
    if [[ -z $_replace_string_src ]]; then
      zle -M "No string to replace."
      return 1
    fi
    
    if [[ $curwidget = *(pattern|regex)* ]]; then
        local rep2
        # The following horror is so that an & preceded by an even
        # number of backslashes is active, without stripping backslashes,
        # while preceded by an odd number of backslashes is inactive,
        # with one backslash being stripped.  A similar logic applies
        # to \digit.
        local rep=$_replace_string_rep
        while [[ $rep = (#b)([^\\]#)(\\\\)#(\\|)(\&|\\<->|\\\{<->\})(*) ]]; do
    	if [[ -n $match[3] ]]; then
    	    # Expression is quoted, strip quotes
    	    rep2="${match[1]}${match[2]}${match[4]}"
    	else
    	    rep2+="${match[1]}${match[2]}"
    	    if [[ $match[4] = \& ]]; then
    		rep2+='${MATCH}'
    	    elif [[ $match[4] = \\\{* ]]; then
    		rep2+='${match['${match[4][3,-2]}']}'
    	    else
    		rep2+='${match['${match[4][2,-1]}']}'
    	    fi
    	fi
    	rep=${match[5]}
        done
        rep2+=$rep
        if [[ $curwidget = *regex* ]]; then
          autoload -Uz regexp-replace
          regexp-replace LBUFFER $_replace_string_src $rep2 || return 1
          regexp-replace RBUFFER $_replace_string_src $rep2 || return 1
        else
          LBUFFER=${LBUFFER//(#bm)$~_replace_string_src/${(e)rep2}}
          RBUFFER=${RBUFFER//(#bm)$~_replace_string_src/${(e)rep2}}
        fi
    else
        LBUFFER=${LBUFFER//$_replace_string_src/$_replace_string_rep}
        RBUFFER=${RBUFFER//$_replace_string_src/$_replace_string_rep}
    fi
    PK[RF;XXfunctions/_next_labelnuW+A#autoload
    
    local __gopt __descr __spec
    
    __gopt=()
    zparseopts -D -a __gopt 1 2 V J x
    
    if comptags -A "$1" curtag __spec; then
      (( $#funcstack > _tags_level )) && _comp_tags="${_comp_tags% * }"
      _tags_level=$#funcstack
      _comp_tags="$_comp_tags $__spec "
      if [[ "$curtag" = *[^\\]:* ]]; then
        zformat -f __descr "${curtag#*:}" "d:$3"
        _description "$__gopt[@]" "${curtag%:*}" "$2" "$__descr"
        curtag="${curtag%:*}"
        set -A $2 "${(P@)2}" "${(@)argv[4,-1]}"
      else
        _description "$__gopt[@]" "$curtag" "$2" "$3"
        set -A $2 "${(@)argv[4,-1]}" "${(P@)2}"
      fi
    
      return 0
    fi
    
    return 1
    PK[Pfunctions/_genisoimagenuW+A#compdef genisoimage
    
    _arguments \
      '-nobak[do not include backup files]' \
      '-no-bak[do not include backup files]' \
      '-abstract:abstract filename:_files' \
      '(-A -appid)'{-A,-appid}':application ID:' \
      '-biblio:bibliographic filename:_files' \
      '-cache-inodes[cache inodes]' \
      '-no-cache-inodes[do not cache inodes]' \
      '-check-oldnames[check all imported ISO9660 names from old session]' \
      '-check-session[check all ISO9660 names from previous session]:_files' \
      '-copyright:copyright filename:_files' \
      '-debug[set debug flag]' \
      '(-b -eltorito-boot)'{-b,-eltorito-boot}':boot image:_files' \
      '-eltorito-alt-boot[start specifying alternative El Torito boot parameters]' \
      '(-B -sparc-boot)'{-B,-sparc-boot}':boot image:_files' \
      '-sunx86-boot:boot image:_files' \
      '(-G -generic-boot)'{-G,-generic-boot}':boot image:_files' \
      '-sparc-label:label text:' \
      '-sunx86-label:label text:' \
      '(-c -eltorito-catalog)'{-c,-eltorito-catalog}':catalog:_files' \
      '(-C -cdrecord-params)'{-C,-cdrecord-params}':params:' \
      '(-d -omit-period)'{-d,-omit-period}'[omit trailing periods from filenames]' \
      '-dir-mode:mode:' \
      '(-D -disable-deep-relocation)'{-D,-disable-deep-relocation}'[disable deep directory relocation]' \
      '-file-mode:mode:' \
      '(-f -follow-links)'{-f,-follow-links}'[follow symbolic links]' \
      '-gid:gid:' \
      '-graft-points[allow to use graft points for filenames]' \
      '-root:dir:_files -/' \
      '-old-root:dir:_files -/' \
      '-help[print option help]' \
      '-hide:globfile:_files' \
      '-hide-list:file list:_files' \
      '-hidden:globfile:_files' \
      '-hidden-list:file list:_files' \
      '-hide-joliet:globfile:_files' \
      '-hide-joliet-list:file list:_files' \
      '-hide-joliet-trans-tbl[hide TRANS.TBL from Joliet tree]' \
      '-hide-rr-moved[rename RR_MOVED to .rr_moved in Rock Ridge tree]' \
      '-gui[switch behaviour for GUI]' \
      '-input-charset:charset:' \
      '-output-charset:charset:' \
      '-iso-level:conformance level:(1 2 3 4)' \
      '*:pathspec:_files'
    PK[S'functions/zfgetnuW+A# function zfget {
    # Get files from remote server.  Options:
    #   -c   cat: dump files to stdout.
    #          alias zfcat="zfget -c"
    #          zfpage() { zfget -c "$@" | eval $PAGER }
    #        are sensible things to do, but aren't done for you.  Note the
    #        second doesn't work on all OS's.
    #   -G   don't to remote globbing, else do
    #   -t   update the local file times to the same time as the remote.
    #        Currently this only works if you have the `perl' command,
    #        and that perl is version 5 with the standard library.
    #        See the function zfrtime for more gory details.  This has
    #        no effect with the -c option.
    #
    # If the connection is not currently open, try to open it with the current
    # parameters (set by a previous zfopen or zfparams), then close it after
    # use.  The file is put in the current directory (i.e. using the basename
    # of the remote file only); for more control, use zfgcp.
    
    emulate -L zsh
    
    [[ $curcontext = :zf* ]] || local curcontext=:zfget
    local loc rem opt remlist opt_G opt_t opt_c
    integer stat do_close
    
    while getopts :Gtc opt; do
      [[ $opt = '?' ]] && print "zfget: bad option: -$OPTARG" && return 1
      eval "opt_$opt=1"
    done
    (( OPTIND > 1 )) && shift $(( OPTIND - 1 ))
    
    zfautocheck || return 1
    
    for remlist in $*; do
      # zfcd directory hack to put the front back to ~
      if [[ $remlist == $HOME || $remlist == $HOME/* ]]; then
        remlist="~${remlist#$HOME}"
      fi
      if [[ $opt_G != 1 ]]; then
        zfrglob remlist
      fi
      if (( $#remlist )); then
        for rem in $remlist; do
          if [[ -n $opt_c ]]; then
    	zftp get $rem
    	stat=$?
          else
    	loc=${rem:t}
    	if zftp get $rem >$loc; then
    	  [[ $opt_t = 1 ]] && zfrtime $rem $loc
    	else
    	  stat=1
    	fi
          fi
        done
      fi
    done
    
    (( $do_close )) && zfclose
    
    return $stat
    # }
    PK[ifunctions/_figletnuW+A#compdef figlet
    
    local fontdir
    typeset -A opt_args
    
    fontdir=$(_call_program path figlet -I2 2>/dev/null)
    
    _arguments -s -S \
      "(-r -l -x)-c[center justify]" \
      "(-S -s -o -W -m)-k[use kerning]" \
      "(-r -c -x)-l[left justify]" \
      "(-p)-n[normal mode]" \
      "(-k -S -s -W)-o[let letters overlap]" \
      "(-n)-p[paragraph mode]" \
      "(-c -l -x)-r[right justify]" \
      "(-k -S -o -W -m)-s[smushed spacing]" \
      "(-w)-t[use terminal width]" \
      "(-I)-v[version]" \
      "(-r -c -l)-x[use default justification of font]" \
      "(-E)-D[use Deutsch character set]" \
      "(-D)-E[use English character set]" \
      "(-X -R)-L[left-to-right]" \
      "(-C)-N[clear controlfile list]" \
      "(-L -X)-R[right-to-left]" \
      "(-k -s -o -W -m)-S[smush letters together or else!]" \
      "(-k -S -s -o -m)-W[wide spacing]" \
      "(-L -R)-X[use default writing direction of font]" \
      "(-t)-w+[specify output width]:output width (in columns)" \
      "-d+[specify font directory]:font directory:_path_files -/" \
      '-f+[specify font]:font:_files -W ${~opt_args[-d]\:-$fontdir} -g \*flf\*\(-.\:r\)' \
      '(-k -S -s -o -W)-m+[specify layout mode]:layout mode' \
      '(-N)-C+[specify control file]:control file:_files -W ${~opt_args[-d]\:-$fontdir} -g \*flc\*\(-.\:r\)' \
      "(-v)-I+[display info]:info code:((
        -1\:normal\ operation\ \(default\)
        0\:version,\ copyright\ and\ usage\ information
        1\:version\ in\ integer\ format
        2\:default\ font\ directory
        3\:name\ of\ font\ figlet\ would\ use
        4\:output\ width\ in\ columns
      ))"
    PK[!][[functions/is-at-leastnuW+A#
    # Test whether $ZSH_VERSION (or some value of your choice, if a second argument
    # is provided) is greater than or equal to x.y.z-r (in argument one). In fact,
    # it'll accept any dot/dash-separated string of numbers as its second argument
    # and compare it to the dot/dash-separated first argument. Leading non-number
    # parts of a segment (such as the "zefram" in 3.1.2-zefram4) are not considered
    # when the comparison is done; only the numbers matter. Any left-out segments
    # in the first argument that are present in the version string compared are
    # considered as zeroes, eg 3 == 3.0 == 3.0.0 == 3.0.0.0 and so on.
    #
    # Usage examples:
    # is-at-least 3.1.6-15 && setopt NO_GLOBAL_RCS
    # is-at-least 3.1.0 && setopt HIST_REDUCE_BLANKS
    # is-at-least 586 $MACHTYPE && echo 'You could be running Mandrake!'
    # is-at-least $ZSH_VERSION || print 'Something fishy here.'
    
    emulate -L zsh
    
    local IFS=".-" min_cnt=0 ver_cnt=0 part min_ver version
    
    min_ver=(${=1})
    version=(${=2:-$ZSH_VERSION} 0)
    
    while (( $min_cnt <= ${#min_ver} )); do
      while [[ "$part" != <-> ]]; do
        (( ++ver_cnt > ${#version} )) && return 0
        part=${version[ver_cnt]##*[^0-9]}
      done
    
      while true; do
        (( ++min_cnt > ${#min_ver} )) && return 0
        [[ ${min_ver[min_cnt]} = <-> ]] && break
      done
    
      (( part > min_ver[min_cnt] )) && return 0
      (( part < min_ver[min_cnt] )) && return 1
      part=''
    done
    PK[xfunctions/VCS_INFO_get_data_mtnnuW+A## vim:ft=zsh
    ## monotone support by: Frank Terbeck 
    ## Distributed under the same BSD-ish license as zsh itself.
    
    setopt localoptions extendedglob NO_shwordsplit
    local mtnbranch mtnbase
    
    mtnbase=${vcs_comm[basedir]}
    rrn=${mtnbase:t}
    mtnbranch=${${(M)${(f)"$( ${vcs_comm[cmd]} status )"}:#(#s)Current branch:*}/*: /}
    VCS_INFO_formats '' "${mtnbranch}" "${mtnbase}" '' '' '' ''
    return 0
    PK[m>}00functions/_knocknuW+A#compdef knock
    
    _arguments \
    	'(-u --udp)'{-u,--udp}'[UDP mode]' \
    	'(-v --verbose)'{-v,--verbose}'[verbose]' \
    	'(-V --version -h --help -u --udp -v --verbose)'{-V,--version}'[display version]' \
    	'(-h --help -u --udp -v --verbose -V --version)'{-h,--help}'[help]' \
    	'1:host:_hosts' \
    	'*:port:_ports'
    PK[0#^functions/_tildenuW+A#compdef -tilde-
    
    # We use all named directories and user names here. If this is too slow
    # for you or if there are too many of them, you may want to use
    # `compadd -qS/ -a friends' or something like that.
    
    [[ -n "$compstate[quote]" ]] && return 1
    
    local expl suf ret=1
    
    if [[ "$SUFFIX" = */* ]]; then
      ISUFFIX="/${SUFFIX#*/}$ISUFFIX"
      SUFFIX="${SUFFIX%%/*}"
      suf=(-S '')
    else
      suf=(-qS/)
    fi
    
    _tags users named-directories directory-stack
    
    while _tags; do
      _requested users && _users "$suf[@]" "$@" && ret=0
    
      _requested named-directories expl 'named directory' \
          compadd "$suf[@]" "$@" -k nameddirs && ret=0
    
      _requested directory-stack && _directory_stack "$suf[@]" && ret=0
    
      (( ret )) || return 0
    done
    
    return ret
    PK[-UUfunctions/_antiwordnuW+A#compdef antiword
    
    # Version: 0.37  (21 Oct 2005)
    
    local papersizes
    
    papersizes=( 10x14 a3 a4 a5 b4 b5 executive folio legal letter note quarto statement tabloid )
    
    _arguments -s -S \
      '(         -w    -f -p -t -x)-a+[Adobe PDF output]:paper size:(${papersizes[@]})' \
      '(-i -L       -a    -p -t -x)-f[formatted text output]' \
      '(         -w -a -f    -t -x)-p+[PostScript output]:paper size:(${papersizes[@]})' \
      '(-i -L       -a -f -p    -x)-t[text output (default)]' \
      '(-i -L -m -w -a -f -p -t   )-x+[XML output]:DTD:(db)' \
      '(-x)-m+[character mapping file]:mapping file:_files' \
      '(-i -L -a -p -x)-w+[width in characters of text output]:line width:' \
      '(-w -f -t -x)-i+[image level (PostScript only)]:image level:((0\:use\ non\ standard\ extensions\ from\ Ghostscript 1\:show\ no\ images 2\:PostScript\ level\ 2\ compatible 3\:PostScript\ level\ 3\ compatible))' \
      '(-w -f -t -x)-L[use landscape mode (PostScript only)]' \
      '-s[show hidden (by Word) text]' \
      '-r[show removed text]' \
      '(- *)-h[display help information]' \
      '*:MS Word file:_files -g "*.doc(-.)"' && return
    
    return 1
    PK[..functions/prompt_walters_setupnuW+Aprompt_walters_help () {
      cat <<'EOF'
    This prompt is color-scheme-able.  You can invoke it thus:
    
      prompt walters []
    
    where the color is for the right-hand prompt.
    
    This prompt was stolen from Colin Walters ,
    who gives credit to Michel Daenzer .
    EOF
    }
    
    prompt_walters_setup () {
    
    if [[ "$TERM" != "dumb" ]]; then
        export PROMPT='%B%(?..[%?] )%b%n@%U%m%u> '
        export RPROMPT="%F{${1:-green}}%~%f"
    else
        export PROMPT="%(?..[%?] )%n@%m:%~> "
    fi
    
      prompt_opts=(cr percent)
    }
    
    prompt_walters_setup "$@"
    PK[1Xfunctions/_all_labelsnuW+A#autoload
    
    local __gopt __len __tmp __pre __suf __ret=1 __descr __spec __prev
    
    if [[ "$1" = - ]]; then
      __prev=-
      shift
    fi
    
    __gopt=()
    zparseopts -D -a __gopt 1 2 V J x
    
    __tmp=${argv[(ib:4:)-]}
    __len=$#
    if [[ __tmp -lt __len ]]; then
      __pre=$(( __tmp-1 ))
      __suf=$__tmp
    elif [[ __tmp -eq $# ]]; then
      __pre=-2
      __suf=$(( __len+1 ))
    else
      __pre=4
      __suf=5
    fi
    
    while comptags "-A$__prev" "$1" curtag __spec; do
      (( $#funcstack > _tags_level )) && _comp_tags="${_comp_tags% * }"
      _tags_level=$#funcstack
      _comp_tags="$_comp_tags $__spec "
      if [[ "$curtag" = *[^\\]:* ]]; then
        zformat -f __descr "${curtag#*:}" "d:$3"
        _description "$__gopt[@]" "${curtag%:*}" "$2" "$__descr"
        curtag="${curtag%:*}"
    
        "$4" "${(P@)2}" "${(@)argv[5,-1]}" && __ret=0
      else
        _description "$__gopt[@]" "$curtag" "$2" "$3"
    
        "${(@)argv[4,__pre]}" "${(P@)2}" "${(@)argv[__suf,-1]}" && __ret=0
      fi
    done
    
    return __ret
    PK[{++functions/_invoke-rc.dnuW+A#compdef invoke-rc.d
    
    _arguments \
      '--quiet[quiet mode, no error messages are generated]' \
      '--force[run the initscript regardless of policy and subsystem]' \
      '--try-anyway[run the initscript even if a non-fatal error is found]' \
      '--disclose-deny[return 101 instead of 0 if action is denied]' \
      '--query[return one of status codes 100-106, does not run the script]' \
      '--no-fallback[ignore any fallback action requests by the policy layer]' \
      '1:service:_services' \
      '2:command:(start stop force-stop restart reload force-reload status)'
    PK[[DDfunctions/tcp_commandnuW+Atcp_send $* || return 1
    tcp_read -d -t ${TCP_TIMEOUT:=0.3}
    return 0
    PK[m`functions/vcs_info_printsysnuW+A## vim:ft=zsh
    ## Written by Frank Terbeck 
    ## Distributed under the same BSD-ish license as zsh itself.
    
    emulate -L zsh
    setopt extendedglob
    
    local sys
    local -a disabled enabled
    local -Ax vcs_comm
    
    zstyle -a ":vcs_info:-init-:${1:-default}:-all-" "enable" enabled
    (( ${#enabled} == 0 )) && enabled=( all )
    
    if (( ${+VCS_INFO_backends} == 0 )); then
      autoload -Uz vcs_info_setsys
      vcs_info_setsys
    fi
    
    if [[ -n ${(M)enabled:#(#i)all} ]] ; then
        enabled=( ${VCS_INFO_backends} )
        zstyle -a ":vcs_info:-init-:${1:-default}:-all-" "disable" disabled
    else
        for sys in ${VCS_INFO_backends} ; do
            [[ -z ${(M)enabled:#$sys} ]] && disabled+=( ${sys} )
        done
        enabled=( ${VCS_INFO_backends} )
    fi
    
    print -l '## list of supported version control backends:' \
             '## disabled systems are prefixed by a hash sign (#)'
    
    for sys in ${VCS_INFO_backends} ; do
        [[ -n ${(M)disabled:#${sys}} ]] && printf '#'
        printf '%s\n' ${sys}
    done
    
    print -l '## flavours (cannot be used in the enable or disable styles; they' \
             '## are enabled and disabled with their master [git-svn -> git])'   \
             '## they *can* be used in contexts: '\'':vcs_info:git-svn:*'\''.'
    
    for sys in ${VCS_INFO_backends} ; do
        VCS_INFO_detect_${sys} --flavours
    done
    return 0
    PK[B:(B(Bfunctions/_argumentsnuW+A#autoload
    
    # Complete the arguments of the current command according to the
    # descriptions given as arguments to this function.
    
    local long cmd="$words[1]" descr odescr mesg subopts opt opt2 usecc autod
    local oldcontext="$curcontext" hasopts rawret optarg singopt alwopt
    local setnormarg start rest
    local -a match mbegin mend
    
    long=$argv[(I)--]
    if (( long )); then
      local name tmp tmpargv
    
      if [[ long -eq 1 ]]; then
        tmpargv=()
      else
        tmpargv=( "${(@)argv[1,long-1]}" )
      fi
    
      name=${~words[1]}
      [[ "$name" = [^/]*/* ]] && name="$PWD/$name"
    
      name="_args_cache_${name}"
      name="${name//[^a-zA-Z0-9_]/_}"
    
      if (( ! ${(P)+name} )); then
        local iopts sopts pattern tmpo dir cur cache
        typeset -U lopts
    
        cache=()
    
        # We have to build a new long-option cache, get the `-i' and
        # `-s' options.
    
        set -- "${(@)argv[long+1,-1]}"
    
        iopts=()
        sopts=()
        while [[ "$1" = -[is]* ]]; do
          if [[ "$1" = -??* ]]; then
            tmp="${1[3,-1]}"
            cur=1
          else
            tmp="$2"
    	cur=2
          fi
          if [[ "$tmp[1]" = '(' ]]; then
    	tmp=( ${=tmp[2,-2]} )
          else
    	tmp=( "${(@P)tmp}" )
          fi
          if [[ "$1" = -i* ]]; then
            iopts+=( "$tmp[@]" )
          else
            sopts+=( "$tmp[@]" )
          fi
          shift cur
        done
    
        # Now get the long option names by calling the command with `--help'.
        # The parameter expansion trickery first gets the lines as separate
        # array elements. Then we select all lines whose first non-blank
        # character is a hyphen. Since some commands document more than one
        # option per line, separated by commas, we convert commas into
        # newlines and then split the result again at newlines after joining 
        # the old array elements with newlines between them. Then we select
        # those elements that start with two hyphens, remove anything up to
        # those hyphens and anything from the space or tab after the
        # option up to the end.
    
       tmp=()
       _call_program options ${~words[1]} --help 2>&1 | while IFS= read -r opt; do
         if (( ${#tmp} )); then
           # Previous line had no comment.  Is the current one suitable?
           # It's hard to be sure, but if it there was nothing on the
           # previous line and the current one is indented more than
           # a couple of spaces (and isn't completely whitespace or punctuation)
           # there's a pretty good chance.
           if [[ $opt = [[:space:]][[:space:]][[:space:]]*[[:alpha:]]* ]]; then
    	 # Assume so.
    	 opt=${opt##[[:space:]]##}
    	 # Same substitution as below.
    	 lopts+=("${^tmp[@]}":${${${opt//:/-}//\[/(}//\]/)})
    	 tmp=()
    	 # Finished with this line.
    	 continue
           else
    	 # Still no comment, add the previous options anyway.
    	 lopts+=("${tmp[@]}")
    	 tmp=()
           fi
         fi
         while [[ $opt = [,[:space:]]#(#b)(-[^,[:space:]]#)(*) ]]; do
           # We used to remove the brackets from "[=STUFF]",
           # but later the code appears to handle it with the brackets
           # present.  Maybe the problem was that the intervening code
           # didn't.  If it's buggy without removing them, the problem
           # probably is later, not here.
           start=${match[1]}
           rest=${match[2]}
           if [[ -z ${tmp[(r)${start%%[^a-zA-Z0-9_-]#}]} ]]; then
    	 # variant syntax seen in fetchmail:
    	 # --[fetch]all  means --fetchall or --all.
    	 # maybe needs to be more general
    	 if [[ $start = (#b)(*)\[(*)\](*) ]]; then
    	   tmp+=("${match[1]}${match[2]}${match[3]}" "${match[1]}${match[3]}")
    	 else
    	   tmp+=($start)
    	 fi
           fi
           opt=$rest
         done
         # If there's left over text, assume it's a description; it
         # may be truncated but if it's too long it's no use anyway.
         # There's one hiccup: we sometimes get descriptions like
         # --foo fooarg   Do some foo stuff with foo arg
         # and we need to remove fooarg.  Use whitespace for hints.
         opt=${opt## [^[:space:]]##  }
         opt=${opt##[[:space:]]##}
         if [[ -n $opt ]]; then
           # Add description after a ":", converting any : in the description
           # to a -.  Use RCQUOTES to append this to all versions of the option.
           lopts+=("${^tmp[@]}":${${${opt//:/-}//\[/(}//\]/)})
           tmp=()
           # If there's no comment, we'll see if there's one on the
           # next line.
         fi
       done
       # Tidy up any remaining uncommented options.
       if (( ${#tmp} )); then
         lopts+=("${tmp[@]}")
       fi
    
        # Remove options also described by user-defined specs.
    
        tmp=()
        # Ignore any argument and description information when searching
        # the long options array here and below.
        for opt in "${(@)${(@)lopts:#--}%%[\[:=]*}"; do
    
          # Using (( ... )) gives a parse error.
    
          let "$tmpargv[(I)(|\([^\)]#\))(|\*)${opt}(|[-+]|=(|-))(|\[*\])(|:*)]" ||
              tmp+=( "$lopts[(r)$opt(|[\[:=]*)]" )
        done
        lopts=( "$tmp[@]" )
    
        # Now remove all ignored options ...
    
        while (( $#iopts )); do
          lopts=( ${lopts:#$~iopts[1](|[\[:=]*)} )
          shift iopts
        done
    
        # ... and add "same" options
    
        while (( $#sopts )); do
          # This implements adding things like --disable-* based
          # on the existence of --enable-*.
          # TODO: there's no anchoring here, is that correct?
          # If it's not, careful with the [\[:=]* stuff.
          lopts+=( ${lopts/$~sopts[1]/$sopts[2]} )
          shift 2 sopts
        done
    
        # Then we walk through the descriptions plus a few builtin ones.
        # The last one matches all options; the `special' description and action
        # makes those options be completed without an argument description.
    
        argv+=(
          '*=FILE*:file:_files'
          '*=(DIR|PATH)*:directory:_files -/'
          '*=*:=: '
          '*: :  '
        )
    
        while (( $# )); do
    
          # First, we get the pattern and the action to use and take them
          # from the positional parameters.
    
          # This is the first bit of the arguments in the special form
          # for converting --help texts, taking account of any quoting
          # of colons.
          pattern="${${${(M)1#*[^\\]:}[1,-2]}//\\\\:/:}"
          # Any action specifications that go with it.
          descr="${1#${pattern}}"
          if [[ "$pattern" = *\(-\) ]]; then
    	# This is the special form to disallow arguments
    	# in the next word.
            pattern="$pattern[1,-4]"
    	dir=-
          else
            dir=
          fi
          shift
    
          # We get all options matching the pattern and take them from the
          # list we have built. If no option matches the pattern, we
          # continue with the next.
    
          # Ignore :descriptions at the ends of lopts for matching this;
          # they aren't in the patterns.
          tmp=("${(@M)lopts:##$~pattern(|:*)}")
          lopts=("${(@)lopts:##$~pattern(|:*)}")
    
          (( $#tmp )) || continue
    
          opt=''
    
          # If there are option strings with a `[=', we take these to get an
          # optional argument.
    
          tmpo=("${(@M)tmp:#*\[\=*}")
          if (( $#tmpo )); then
            tmp=("${(@)tmp:#*\[\=*}")
    
    	for opt in "$tmpo[@]"; do
    	  # Look for --option:description and turn it into
    	  # --option[description].  We didn't do that above
    	  # since it could get confused with the [=ARG] stuff.
    	  if [[ $opt = (#b)(*):([^:]#) ]]; then
    	    opt=$match[1]
    	    odescr="[${match[2]}]"
    	  else
    	    odescr=
    	  fi
    	  if [[ $opt = (#b)(*)\[\=* ]]; then
    	    opt2=${${match[1]}//[^a-zA-Z0-9_-]}=-${dir}${odescr}
    	  else
    	    opt2=${${opt}//[^a-zA-Z0-9_-]}=${dir}${odescr}
    	  fi
    	  if [[ "$descr" = :\=* ]]; then
    	    cache+=( "${opt2}::${(L)${opt%\]}#*\=}: " )
    	  elif [[ "$descr" = ::* ]]; then
    	    cache+=( "${opt2}${descr}" )
    	  else
    	    cache+=( "${opt2}:${descr}" )
    	  fi
    	done
          fi
    
          # Descriptions with `=': mandatory argument.
          # Basically the same as the foregoing.
          # TODO: could they be combined?
    
          tmpo=("${(@M)tmp:#*\=*}")
          if (( $#tmpo )); then
            tmp=("${(@)tmp:#*\=*}")
    
    	for opt in "$tmpo[@]"; do
    	  if [[ $opt = (#b)(*):([^:]#) ]]; then
    	    opt=$match[1]
    	    odescr="[${match[2]}]"
    	  else
    	    odescr=
    	  fi
    	  opt2="${${opt%%\=*}//[^a-zA-Z0-9_-]}=${dir}${odescr}"
    	  if [[ "$descr" = :\=* ]]; then
    	    cache+=( "${opt2}:${(L)${opt%\]}#*\=}: " )
    	  else
    	    cache+=( "${opt2}${descr}" )
    	  fi
    	done
          fi
    
          # Everything else is just added as an option without arguments or
          # as described by $descr.
    
          if (( $#tmp )); then
            tmp=(
    	  # commands with a description of the option (as opposed
    	  # to the argument, which is what descr contains): needs to be
    	  # "option[description]".
    	  # Careful: \[ on RHS of substitution keeps the backslash,
    	  # I discovered after about half an hour, so don't do that.
    	  "${(@)^${(@)tmp:#^*:*}//:/[}]"
    	  # commands with no description
    	  "${(@)${(@)tmp:#*:*}//[^a-zA-Z0-9_-]}")
            if [[ -n "$descr" && "$descr" != ': :  ' ]]; then
    	  cache+=( "${(@)^tmp}${descr}" )
            else
    	  cache+=( "$tmp[@]" )
            fi
          fi
        done
        set -A "$name" "${(@)cache:# #}"
      fi
      set -- "$tmpargv[@]" "${(@P)name}"
    fi
    
    subopts=()
    singopt=()
    while [[ "$1" = -(O*|[CRWnsw]) ]]; do
      case "$1" in
      -C)  usecc=yes; shift ;;
      -O)  subopts=( "${(@P)2}" ); shift 2 ;;
      -O*) subopts=( "${(@P)${1[3,-1]}}" ); shift ;;
      -R)  rawret=yes; shift;;
      -n)  setnormarg=yes; NORMARG=-1; shift;;
      -w)  optarg=yes; shift;;
      -s)  singopt=(-s); shift;;
      -W)  alwopt=arg; shift;;
      esac
    done
    
    [[ "$PREFIX" = [-+] ]] && alwopt=arg
    
    zstyle -s ":completion:${curcontext}:options" auto-description autod
    
    if (( $# )) && comparguments -i "$autod" "$singopt[@]" "$@"; then
      local action noargs aret expl local tried ret=1
      local next direct odirect equal single matcher matched ws tmp1 tmp2 tmp3
      local opts subc tc prefix suffix descrs actions subcs anum
      local origpre="$PREFIX" origipre="$IPREFIX" nm="$compstate[nmatches]"
    
      if comparguments -D descrs actions subcs; then
        if comparguments -O next direct odirect equal; then
          opts=yes
          _tags "$subcs[@]" options
        else
          _tags "$subcs[@]"
        fi
      else
        if comparguments -a; then
          noargs='no more arguments'
        else
          noargs='no arguments'
        fi
        if comparguments -O next direct odirect equal; then
          opts=yes
          _tags options
        elif [[ $? -eq 2 ]]; then
            compadd -Q - "${PREFIX}${SUFFIX}"
            return 0
        else
          _message "$noargs"
          return 1
        fi
      fi
    
      comparguments -M matcher
    
      context=()
      state=()
    
      while true; do
        while _tags; do
          anum=1
          if [[ -z "$tried" ]]; then
            while [[ anum -le  $#descrs ]]; do
    
    	  action="$actions[anum]"
    	  descr="$descrs[anum]"
    	  subc="$subcs[anum++]"
    
    	  if [[ $subc = argument* && -n $setnormarg ]]; then
    	    comparguments -n NORMARG
    	  fi
    
              if [[ -n "$matched" ]] || _requested "$subc"; then
    
                curcontext="${oldcontext%:*}:$subc"
    
                _description "$subc" expl "$descr"
    
                if [[ "$action" = \=\ * ]]; then
                  action="$action[3,-1]"
                  words=( "$subc" "$words[@]" )
    	      (( CURRENT++ ))
                fi
    
                if [[ "$action" = -\>* ]]; then
    	      action="${${action[3,-1]##[ 	]#}%%[ 	]#}"
    	      if (( ! $state[(I)$action] )); then
                    comparguments -W line opt_args
                    state+=( "$action" )
    	        if [[ -n "$usecc" ]]; then
    	          curcontext="${oldcontext%:*}:$subc"
    	        else
    	          context+=( "$subc" )
    	        fi
                    compstate[restore]=''
                    aret=yes
                  fi
                else
                  if [[ -z "$local" ]]; then
                    local line
                    typeset -A opt_args
                    local=yes
                  fi
    
                  comparguments -W line opt_args
    
                  if [[ "$action" = \ # ]]; then
    
                    # An empty action means that we should just display a message.
    
    	        _message -e "$subc" "$descr"
    	        mesg=yes
    	        tried=yes
                    alwopt=${alwopt:-yes}
                  elif [[ "$action" = \(\(*\)\) ]]; then
    
                    # ((...)) contains literal strings with descriptions.
    
                    eval ws\=\( "${action[3,-3]}" \)
    
                    _describe -t "$subc" "$descr" ws -M "$matcher" "$subopts[@]" ||
                        alwopt=${alwopt:-yes}
    	        tried=yes
    
                  elif [[ "$action" = \(*\) ]]; then
    
                    # Anything inside `(...)' is added directly.
    
                    eval ws\=\( "${action[2,-2]}" \)
    
                    _all_labels "$subc" expl "$descr" compadd "$subopts[@]" -a - ws ||
                        alwopt=${alwopt:-yes}
    	        tried=yes
                  elif [[ "$action" = \{*\} ]]; then
    
                    # A string in braces is evaluated.
    
                    while _next_label "$subc" expl "$descr"; do
                      eval "$action[2,-2]" && ret=0
                    done
                    (( ret )) && alwopt=${alwopt:-yes}
    	        tried=yes
                  elif [[ "$action" = \ * ]]; then
    
                    # If the action starts with a space, we just call it.
    
    	        eval "action=( $action )"
                    while _next_label "$subc" expl "$descr"; do
                      "$action[@]" && ret=0
                    done
                    (( ret )) && alwopt=${alwopt:-yes}
    	        tried=yes
                  else
    
                    # Otherwise we call it with the description-arguments.
    
    	        eval "action=( $action )"
                    while _next_label "$subc" expl "$descr"; do
                      "$action[1]" "$subopts[@]" "$expl[@]" "${(@)action[2,-1]}" && ret=0
    	        done
                    (( ret )) && alwopt=${alwopt:-yes}
    	        tried=yes
                  fi
                fi
              fi
            done
          fi
          if _requested options &&
             [[ -z "$hasopts" &&
                -z "$matched" &&
                ( -z "$aret" || "$PREFIX" = "$origpre" ) ]] &&
              { ! zstyle -T ":completion:${oldcontext%:*}:options" prefix-needed ||
                [[ "$origpre" = [-+]* || -z "$aret$mesg$tried" ]] } ; then
    	local prevpre="$PREFIX" previpre="$IPREFIX" prevcontext="$curcontext"
    
            curcontext="${oldcontext%:*}:options"
    
    	hasopts=yes
    
    	PREFIX="$origpre"
    	IPREFIX="$origipre"
    
            if [[ -z "$alwopt" || -z "$tried" || "$alwopt" = arg ]] &&
               comparguments -s single; then
    
              if [[ "$single" = direct ]]; then
                _all_labels options expl option \
    	        compadd -QS '' - "${PREFIX}${SUFFIX}"
              elif [[ -z "$optarg" && "$single" = next ]]; then
                _all_labels options expl option \
    	        compadd -Q - "${PREFIX}${SUFFIX}"
              elif [[ "$single" = equal ]]; then
                _all_labels options expl option \
    	        compadd -QqS= - "${PREFIX}${SUFFIX}"
              else
    
    	    tmp1=( "$next[@]" "$direct[@]" "$odirect[@]" "$equal[@]" )
    
                [[ "$PREFIX" = [-+]* ]] && tmp1=( "${(@M)tmp1:#${PREFIX[1]}*}" )
    
                [[ "$single" = next ]] &&
                    tmp1=( "${(@)tmp1:#[-+]${PREFIX[-1]}((#e)|:*)}" )
    
    	    [[ "$PREFIX" != --* ]] && tmp1=( "${(@)tmp1:#--*}" )
    	    tmp3=( "${(M@)tmp1:#[-+]?[^:]*}" )
    	    tmp1=( "${(M@)tmp1:#[-+]?(|:*)}" )
    	    tmp2=( "${PREFIX}${(@M)^${(@)${(@)tmp1%%:*}#[-+]}:#?}" )
    
                _describe -O option \
                          tmp1 tmp2 -Q -S '' -- \
    		      tmp3 -Q
    
                [[ -n "$optarg" && "$single" = next && nm -eq $compstate[nmatches] ]] &&
                    _all_labels options expl option \
    	            compadd -Q - "${PREFIX}${SUFFIX}"
    
              fi
              single=yes
            else
              next+=( "$odirect[@]" )
              _describe -O option \
                        next -Q -M "$matcher" -- \
                        direct -QS '' -M "$matcher" -- \
                        equal -QqS= -M "$matcher"
            fi
    	PREFIX="$prevpre"
    	IPREFIX="$previpre"
            curcontext="$prevcontext"
          fi
          [[ -n "$tried" && "${${alwopt:+$origpre}:-$PREFIX}" != [-+]* ]] && break
        done
        if [[ -n "$opts" && -z "$aret" &&
              -z "$matched" &&
              ( -z "$tried" || -n "$alwopt" ) &&
              nm -eq compstate[nmatches] ]]; then
    
          PREFIX="$origpre"
          IPREFIX="$origipre"
    
          prefix="${PREFIX#*\=}"
          suffix="$SUFFIX"
          PREFIX="${PREFIX%%\=*}"
          SUFFIX=''
    
          compadd -M "$matcher" -D equal - "${(@)equal%%:*}"
    
          if [[ $#equal -eq 1 ]]; then
            PREFIX="$prefix"
    	SUFFIX="$suffix"
    	IPREFIX="${IPREFIX}${equal[1]%%:*}="
    	matched=yes
    
    	comparguments -L "${equal[1]%%:*}" descrs actions subcs
    
    	_tags "$subcs[@]"
    
    	continue
          fi
        fi
        break
      done
    
      [[ -z "$aret" || -z "$usecc" ]] && curcontext="$oldcontext"
    
      if [[ -n "$aret" ]]; then
        [[ -n $rawret ]] && return 300
    
    ### Returning non-zero would allow the calling function to add its own
    ### completions if we generated only options and have to use a ->state
    ### action.  But if that then doesn't generate matches, the calling
    ### function's return value would be wrong unless it compares
    ### $compstate[nmatches] to its previous value.  Ugly.
    ###
    ###    return 1
      else
        [[ -n "$noargs" && nm -eq "$compstate[nmatches]" ]] && _message "$noargs"
      fi
      # Set the return value.
    
      [[ nm -ne "$compstate[nmatches]" ]]
    else
      return 1
    fi
    PK[KO))functions/_wgetnuW+A#compdef wget
    
    local curcontext="$curcontext" state line
    typeset -A opt_args
    
    _arguments -C -s \
      '(- *)'{--version,-V}'[display version info]' \
      '(- *)'{--help,-h}'[display help]' \
      '(--background -b)'{--background,-b}'[run in background]' \
      '(--execute -e)'{--execute=,-e+}'[execute .wgetrc command]:.wgetrc command' \
      '(--output-file -o --append-output -a)'{--output-file=,-o+}'[specify output logfile]:log file to output:_files' \
      '(--append-output -a --output-file -o)'{--append-output=,-a+}'[specify output logfile to append to]:log file to append:_files' \
      '(--debug -d)'{--debug,-d}'[turn on debug output]' \
      '(--quiet -q --verbose -v --no-verbose -nv)'{--quiet,-q}'[turn off output]' \
      '(--quiet -q --verbose -v --no-verbose -nv)'{--verbose,-v}'[turn on verbose output]' \
      '*-n+[turn off flags]:flags:->noflags' \
      '(--input-file -i)'{--input-file=,-i+}'[specify input file]:file containing URLs:_files' \
      '(--force-html -F)'{--force-html,-F}'[treat input file as html]' \
      '(--base -B)'{--base=,-B+}'[prepend URL to relative links]:base URL:_urls' \
      '(--tries -t)'{--tries=,-t+}'[set number of retries]:number of retries' \
      '--retry-connrefused[retry even if connection is refused]' \
      '(--output-document -O)'{--output-document=,-O+}'[specify file to write documents to]:output file:_files' \
      '(--continue -c)'{--continue,-c}'[continue getting an existing file]'  \
      '--progress=[set progress gauge type]:gauge type:->gauge' \
      '(--timestamping -N)'{--timestamping,-N}'[retrieve only files newer than existing]' \
      '(--server-response -S)'{--server-response,-S}'[print server response]' \
      "--spider[don't download anything]" \
      '(--timeout -T)'{--timeout=,-T+}'[set all timeout values]:timeout (seconds)' \
      '(--timeout -T)--dns-timeout=[set the DNS lookup timeout]:DNS lookup timeout (seconds)' \
      '(--timeout -T)--connect-timeout=[set the connect timeout]:connect timeout (seconds)' \
      '(--timeout -T)--read-timeout=[set the read timeout]:read timeout (seconds)' \
      '(--wait,-w)'{--wait=,-w+}'[specify wait between retrievals]:time (seconds)' \
      '(--random-wait)--waitretry=:time (seconds)' \
      '(--waitretry)--random-wait[random wait time between retrievals]' \
      '(--proxy -Y --no-proxy)'{--proxy=,-Y+}'[explicitly turn on proxy]' \
      '(--proxy -Y --no-proxy)--no-proxy[explicitly turn off proxy]' \
      '(--quota -Q)'{--quota=,-Q+}'[set retrieval quota]:number' \
      '--bind-address=[specify address to bind to (hostname or IP)]:bind address:_bind_addresses' \
      '--limit-rate=[specify limit to download rate]:download rate limit' \
      '--no-dns-cache[disable caching DNS lookups]' \
      '--restrict-file-names=[restrict chars in file names to ones OS allows]:OS:->restrict' \
      '(-4 --inet4-only -6 --inet6-only)'{-4,--inet4-only}'[connect only to IPv4 addresses]' \
      '(-4 --inet4-only -6 --inet6-only)'{-6,--inet6-only}'[connect only to IPv6 addresses]' \
      '--prefer-family[connect first to addresses of specified family]:address family:(IPv6 IPv4 none)' \
      '(--http-user --ftp-user)--user[set both ftp and http user]:user' \
      '(--http-password --ftp-password)--password[set both ftp and http password]:password' \
      '(--force-directories -x)'{--force-directories,-x}'[force creation of directories]' \
      '--protocol-directories[use protocol name in directories]' \
      '(--directory-prefix -P)'{--directory-prefix=,-P+}'[specify prefix to save files to]:prefix:_files -/' \
      '--cut-dirs=:number:' \
      '(--user)--http-user=:user' \
      '(--password)--http-password=:password' \
      '--no-cache[disallow server-cached data]' \
      '(--html-extension -E)'{--html-extension,-E}'[save all HTML documents with a .html extension]' \
      "--ignore-length[ignore \`Content-Length' header field]" \
      '--header=:string' \
      '--proxy-user=:user' \
      '--proxy-password=:password' \
      '--referer=:URL:_urls' \
      '--save-headers[save http headers]' \
      '(--user-agent -U)'{--user-agent=,-U+}'[specify user agent to identify as]:user-agent' \
      '--no-http-keep-alive[disable HTTP keep-alive]' \
      '--no-cookies=[turn cookies off]' \
      '--load-cookies=[specify file to load cookies from]:cookie file:_files' \
      '--save-cookies=[specify file to save cookies to]:cookie file:_files' \
      '--keep-session-cookies[load and save session cookies]' \
      '--post-data=[use the POST method with specified data]:data to send' \
      '--post-file=[use the POST method; sending contents of a file]:file:_files' \
      '--secure-protocol=[choose secure protocol]:protocol:(SSLv2 SSLv3 TLSv1)' \
      "--no-check-certificate=[don't check the server certificate]" \
      '--certificate=[specify client certificate]:client certificate file:_files' \
      '--certificate-type=[specify client certificate type]:certificate type:(PEM DER)' \
      '--private-key=[specify private key file]:key file:_files' \
      '--private-key-type=[specify private key type]:key type:key type:(PEM DER)' \
      "--ca-certificate=[specify file with bundle of CA's]:file:_files" \
      "--ca-directory=[specify dir where hash list of CA's are stored]:directory:_directories" \
      '--random-file[specify file with random data for seeding generator]:file:_files' \
      '--egd-file=[specify filename of EGD socket]:file:_files' \
      '(--user)--ftp-user=:user' \
      '(--password)--ftp-password=:password' \
      "--no-remove-listing[don't remove \`.listing' files]" \
      '--no-glob[turn off FTP file name globbing]' \
      '--no-passive-ftp' \
      '--retr-symlinks' \
      '--preserve-permissions[preserve remote file permissions with ftp]' \
      '(--recursive -r)'{--recursive,-r}'[recurse subdirectories]' \
      '(--level -l)'{--level=,-l+}'[specify maximum recursion depth]:level' \
      '--delete-after' \
      '(--convert-links -k)'{--convert-links,-k}'[convert links to be relative]' \
      '(--backup-converted -K)'{--backup-converted,-K}'[backup files before conversion]' \
      '(--mirror -m -r -N -l)'{--mirror,-m}'[mirror (-r -N -l inf -nr)]' \
      '(--page-requisites -p)'{--page-requisites,-p}'[get all images needed to display page]' \
      '--strict-comments[turn on strict (SGML) handling of HTML comments]' \
      '(--accept -A)'{--accept=,-A+}'[specify accepted extensions]:extensions' \
      '(--reject -R)'{--reject=,-R+}'[specify rejected extensions]:extensions' \
      '(--domains -D)'{--domains=,-D+}'[specify accepted domains]:domains:_domains' \
      '--exclude-domains=:rejected domains:_domains' \
      '--follow-ftp' \
      '--follow-tags=:HTML tags:' \
      '--ignore-tags=[specify ignored HTML tags]:HTML tags' \
      '(--span-hosts -H)'{--span-hosts,-H}'[span hosts]' \
      '(--relative -L)'{--relative,-L}'[follow relative links only]' \
      '(--include-directories -I)'{--include-directories=,-I+}'[include directories]:allowed directories' \
      '(--exclude-directories -X)'{--exclude-directories=,-X+}'[exclude directories]:excluded directories' \
      '--no-host-lookup' \
      '--no-parent' \
      '--no-verbose' \
      '--no-clobber' \
      '--no-directories' \
      '--no-host-directories' \
      '--htmlify=:htmlify:' \
      '--no:no:->noflags' \
      '*:URL:_urls' && return 0
    
    case "$state" in
      gauge)
        _values -S : 'progress gauge type' \
          'dot:style:(default binary mega giga micro)' \
          'bar:force:(force)'
      ;;
      noflags)
        _values -s '' 'option' \
          'v[non verbose]' \
          'H[no host directories]' \
          'd[no directories]' \
          'c[no clobber]' \
          'p[no parent]'
      ;;
      restrict)
        _values -s , 'filename char restriction' \
          '(windows)unix' \
          '(unix)windows' \
          '(unix windows)nocontrol'
      ;;
    esac
    PK[dfunctions/_savecorenuW+A#compdef savecore
    
    _savecore() {
    	_arguments -s \
    		'-L[take live dump]' \
    		'-v[verbose]' \
    		'-d[disregard dump header valid flag]' \
    		'-f[save crash dump from file]:file:_files' \
    		'::directory:_files -/'
    }
    
    _savecore "$@"
    PK[		functions/_setxkbmapnuW+A# compdef setxkbmap
    
    # TODO:
    # model, option, symbols and types suggestions
    # take -layout and -variant into account
    
    _setxkbmap() {
        emulate -L zsh
        setopt extendedglob
    
        # xkb files may be in different places depending on system
        local dir sourcedir
        for dir in /usr/lib/X11/xkb /usr/share/X11/xkb; do
            if [ -d $dir ] ; then
               sourcedir=$dir
               break
            fi
        done
        [ -d $sourcedir ] || return 1
    
        local -a arguments
    
        arguments=(
            '-compat[compability map]:compability:_setxkbmap_compat'
            '-config[configuration file]:configuration:_files'
            '-display[display]:display:_x_display'
            '-geometry[geometry component]:geometry:_setxkbmap_geometry'
            '-model[model name]:model:'
            '-option[xkb option]:option:'
            '(-)'-print'[print component names]'
            '-rules[rules file]:rules:_files'
            '-symbols[symbols components]:symbols:'
            '(-)'{-help,-h}'[display help message]'
            '-synch[force synchronization]'
            '-types[types components]:types:'
            '(-verbose -v)'{-verbose,-v}'[set verbosity level]:verbosity:(0 1 2 3 4 5 6 7 8 9)'
            '*::keyboard:_setxkbmap_dispatcher'
        )
        _arguments $arguments
    }
    
    _setxkbmap_dispatcher () {
    
        case $CURRENT in
            1)
                _setxkbmap_layout
            ;;
            2)
                _setxkbmap_variant "$words[1]"
            ;;
        esac
    }
    
    _setxkbmap_files () {
        local dir="$1"
        local label="$2"
    
        local -a fullpath shortpath
    
        fullpath=($sourcedir/$dir/**/*~*README(.))
        shortpath=(${fullpath#$sourcedir\/$dir\/})
    
        _wanted layout expl $label compadd -a - shortpath
    
    }
    
    (( $+functions[_setxkbmap_compat] )) ||
    _setxkbmap_compat() {
        _setxkbmap_files "compat" "compatibility"
    }
    
    (( $+functions[_setxkbmap_layout] )) ||
    _setxkbmap_layout () {
        _setxkbmap_files "symbols" "layout"
    }
    
    (( $+functions[_setxkbmap_geometry] )) ||
    _setxkbmap_geometry () {
        _setxkbmap_files "geometry" "geometry"
    }
    
    (( $+functions[_setxkbmap_variant] )) ||
    _setxkbmap_variant () {
        local file=$sourcedir/symbols/${1}
        local -a variants lines
    
        if [ ! -f $file ]; then
            _message "no such layout: ${1}"
            return 1
        fi
    
        lines=("${(f)$(< ${file})}")
        variants=(${${${(M)lines:#*xkb_symbols*\"([[:alnum:]])##\"*}##*xkb_symbols([^\"])##\"}%%\"*})
        
        _wanted variant expl 'variant' compadd -a variants
    
    }
    
    _setxkbmap "$@"
    PK[Jkt**functions/_fetchmailnuW+A#compdef fetchmail
    
    _arguments -S \
      {--bsmtp,'(--logfile)-L','(-L)--logfile','(--fetchmailrc)-f','(-f)--fetchmailrc','(--idfile)-i','(-i)--idfile'}':file:_files' \
      {--plugin,--plugout,'(--mda)-m','(-m)--mda'}':command:_command_names -e' \
      {'(--username)-u','(-u)--username'}:user:_users \
      '--auth:authentication types:(password kerberos kerberos_v5)' \
      {'(--protocol)-p','(-p)--protocol'}:protocol:'(auto pop2 pop3 apop rpop kpop sdps imap imap-k4 imap-gss etrn)' \
      {'(--port)-P','(-P)--port'}':port number' \
      '*:mail server:_hosts' \
      --
    PK[efunctions/_xfignuW+A#compdef xfig
    
    _x_arguments \
      -{help,Landscape,Portrait,debug,dontswitchcmap,flushleft,inches,inverse,latexfonts,left,metric,monochrome,multiple,noscalablefonts,notrack,right,scalablefonts,showallbuttons,single,specialtext,tablet,track} \
      '-bold:bold font:_x_font' \
      '-button:button font:_x_font' \
      '-but_per_row:number of buttons' \
      '-cbg:canvas background color:_x_color' \
      '-cfg:canvas foreground color:_x_color' \
      '-depth:visual depth' \
      '-exportlanguage:export language:(box latex epic eepic eepicemu pictex ibmgl eps ps pstex textyl tpic pic mf acad pcx png gif jpeg tiff ppm xbm xpm)' \
      '-iconGeometry:icon geometry:_x_geometry' \
      '-internalBW:internal border width' \
      '-keyfile:compose key file:_files' \
      '-magnification:magnification factor' \
      '-max_image_colors:maximum number of colors' \
      '-normal:normal font:_x_font' \
      '-papersize:output paper size:((Letter\:8.5\"\ x\ 11\" Legal\:8.5\"\ x\ 14\" Ledger\:17\"\ x\ 11\" Tabloid\:11\"\ x\ 17\" A\:8.5\"\ x\ 11\" B\:11\"\ x\ 17\" C\:17\"\ x\ 22\" D\:22\"\ x\ 34\" E\:34\"\ x\ 44\" A4\:21\ cm\ x\ 29.7\ cm A3\:29.7\ cm\ x\ 42\ cm A2\:42\ cm\ x\ 59.4\ cm A1\:59.4\ cm\ x\ 84.1\ cm A0\:84.1\ cm\ x\ 118.9\ cm B%\:18.2\ cm\ x\ 25.7\ cm))' \
      '-pheight:canvas height' \
      '-pwidth:canvas width' \
      '-spellcheckcommand:program: _command_names -e' \
      '-startfillstyle:fill style (-1 to 21)' \
      '-startfontsize:font size (in points)' \
      '-startgridmode:grid mode:((0\:no\ grid 1\:1/4\ inch\ or\ 5\ mm 2\:1/2\ inch\ or\ 1\ cm 3\:1\ inch\ or\ 2\ cm))' \
      '-startlatexfont:latex font' \
      '-startlinewidth:line width' \
      '-startposnmode:positioning mode:((0\:any 1\:1/16\ inch\ or\ 1\ mm 2\:1/4\ inch\ or\ 5\ mm 3\:1/2\ inch\ or\ 1\ cm 4\:1\ inch\ or\ 2\ cm))' \
      '-startpsfont:postscript font' \
      '-starttextstep:text step' \
      '-userscale:scale factor' \
      '-userunit:unit string' \
      '-visual:visual:_x_visual' \
      '-zoom:zoom scale' \
      '*:xfig file:_files -g "*.(#i)(|x)fig(-.)"'
    PK[ifunctions/_mondonuW+A#compdef mondoarchive
    
    local curcontext="$curcontext" state line expl ret=1
    typeset -A opt_args
    
    _arguments -C \
      '(-V)-O[create backup]' \
      '(-O)-V[verify backup]' \
      '(-c -C -i -n -w)-c[use CD-R as backup media]:CD-R burn speed' \
      '(-c -C -i -n -w)-C[use CD-R as streaming device (experimental)]:CD-R burn speed' \
      '(-c -C -i -n -w)-i[use ISO image as backup media]' \
      '(-c -C -i -n -w)-n[use NFS mountpoint as backup media]:NFS mountpoint' \
      '(-c -C -i -n -w)-w[use CD-RW as backup media]:CD-RW burn speed' \
      '-D[differential backup]' \
      '-E[exclude path(s) from backup]:paths to exclude from backup:->quoted_path' \
      '-I[path(s) to backup]:paths to include in backup:->quoted_path' \
      '-d[backup device]:backup device' \
      '-g[run in fullscreen mode]' \
      '-k[path to kernel]:path to kernel:->kernel_or_magic' \
      '-m[manual eject]' \
      '-s[media size]:media size]' \
      '-x[non-linux partition]:non-linux partition:_files -g "*(%b)"' \
      '(-1 -2 -3 -4 -5 -6 -7 -8 -9)-'{1,2,3,4,5,6,7,8,9}'[compression level]' \
      '-A[post ISO-creation command]:pre ISO-creation command' \
      '-B[pre iSO-creation command]:post ISO-creation command' \
      '-F[do not create floppy]' \
      '-H[create autorestore image]' \
      '-L[use lzo instead of bzip2]' \
      '-P[post-nuke tarball]:post-nuke tarball:_files -g "*.(#i)(tar.gz|tgz)(-.)"' \
      '-S[scratch directory]:scratch directory:_files -/' \
      '-T[temporary directory]:temporary directory:_files -/' \
      '-f[device with MBR]:device with MBR:_files -g "*(%b)"' \
      '-l[bootloader type]:bootloader type:(GRUB LILO)' && ret=0
    
    case $state in
      quoted_path)
        local suf="/ \t\n"
        [[ -n $compstate[quote] ]] && { suf="$compstate[quote]$suf"; compset -q; }
        _files -r $suf && ret=0
      ;;
      kernel_or_magic)
        _tags kernel magic
        while _tags; do
          _requested magic expl "keyword" \
    	compadd -- FAILSAFE && ret=0
          _requested kernel expl "path to kernel image" \
    	_files && ret=0
      
          (( ret )) || break
        done
      ;;
    esac
    
    return ret
    PK[_ZZfunctions/zfclosenuW+A# function zfclose {
    [[ $curcontext = :zf* ]] || local curcontext=:zfclose
    zftp close
    # }
    PK[functions/_tidynuW+A#compdef tidy
    
    # HTML Tidy for Linux/x86 released on 1st March 2003
    
    local -a access autobool boolean doctype encoding
    
    access=( 1 2 3 )
    boolean=( yes no )
    autobool=( auto $boolean )
    doctype=( auto omit strict loose transitional )
    encoding=( ascii latin1 raw utf8 iso2022 mac utf16le utf16be utf16 win1252 ibm858 big5 shiftjis )
    
    _arguments \
      '(-indent -i)'{-indent,-i}'[indent element content]' \
      '-wrap[wrap text at the specified  (default is 68)]:column:' \
      '(-upper -u)'{-upper,-u}'[force tags to upper case (default is lower case)]' \
      '(-clean -c)'{-clean,-c}'[replace FONT, NOBR and CENTER tags by CSS]' \
      '(-bare -b)'{-bare,-b}'[strip out smart quotes and em dashes, etc.]' \
      '(-numeric -n)'{-numeric,-n}'[output numeric rather than named entities]' \
      '(-errors -e)'{-errors,-e}'[only show errors]' \
      '(-quiet -q)'{-quiet,-q}'[suppress nonessential output]' \
      '-omit[omit optional end tags]' \
      '-xml[specify the input is well formed XML]' \
      '(-asxml -asxhtml -ashtml)'{-asxml,-asxhtml}'[convert HTML to well formed XHTML]' \
      '(-asxml -asxhtml)-ashtml[force XHTML to well formed HTML]' \
      '-access[do additional accessibility checks ( = 1, 2, 3)]:priority level:(${access[@]})' \
      '-raw[output values above 127 without conversion to entities]' \
      '(       -latin0 -latin1 -iso2022 -utf8 -mac -win1252 -ibm858 -utf16le -utf16be -utf16 -shiftjis -big5)-ascii[use US-ASCII for output, ISO-8859-1 for input]' \
      '(-ascii         -latin1 -iso2022 -utf8 -mac -win1252 -ibm858 -utf16le -utf16be -utf16 -shiftjis -big5)-latin0[use US-ASCII for output, ISO-8859-1 for input]' \
      '(-ascii -latin0         -iso2022 -utf8 -mac -win1252 -ibm858 -utf16le -utf16be -utf16 -shiftjis -big5)-latin1[use ISO-8859-1 for both input and output]' \
      '(-ascii -latin0 -latin1          -utf8 -mac -win1252 -ibm858 -utf16le -utf16be -utf16 -shiftjis -big5)-iso2022[use ISO-2022 for both input and output]' \
      '(-ascii -latin0 -latin1 -iso2022       -mac -win1252 -ibm858 -utf16le -utf16be -utf16 -shiftjis -big5)-utf8[use UTF-8 for both input and output]' \
      '(-ascii -latin0 -latin1 -iso2022 -utf8      -win1252 -ibm858 -utf16le -utf16be -utf16 -shiftjis -big5)-mac[use MacRoman for input, US-ASCII for output]' \
      '(-ascii -latin0 -latin1 -iso2022 -utf8 -mac          -ibm858 -utf16le -utf16be -utf16 -shiftjis -big5)-win1252[use Windows-1252 for input, US-ASCII for output]' \
      '(-ascii -latin0 -latin1 -iso2022 -utf8 -mac -win1252         -utf16le -utf16be -utf16 -shiftjis -big5)-ibm858[use IBM-858 (CP850+Euro) for input, US-ASCII for output]' \
      '(-ascii -latin0 -latin1 -iso2022 -utf8 -mac -win1252 -ibm858          -utf16be -utf16 -shiftjis -big5)-utf16le[use UTF-16LE for both input and output]' \
      '(-ascii -latin0 -latin1 -iso2022 -utf8 -mac -win1252 -ibm858 -utf16le          -utf16 -shiftjis -big5)-utf16be[use UTF-16BE for both input and output]' \
      '(-ascii -latin0 -latin1 -iso2022 -utf8 -mac -win1252 -ibm858 -utf16le -utf16be        -shiftjis -big5)-utf16[use UTF-16 for both input and output]' \
      '(-ascii -latin0 -latin1 -iso2022 -utf8 -mac -win1252 -ibm858 -utf16le -utf16be -utf16           -big5)-shiftjis[use Shift_JIS for both input and output]' \
      '(-ascii -latin0 -latin1 -iso2022 -utf8 -mac -win1252 -ibm858 -utf16le -utf16be -utf16 -shiftjis      )-big5[use Big5 for both input and output]' \
      '(-out -o)'{-out,-o}'[specify the output markup file]:output file:_files' \
      '-config[set configuration options from the specified ]:configuration file:_files' \
      '-f[write errors to the specified ]:error file:_files' \
      '(-modify -m)'{-modify,-m}'[modify the original input files]' \
      '(- *)'{-version,-v}'[show the version of Tidy]' \
      '(- *)'{-help,-h,-\?}'[list the command line options]' \
      '(- *)-help-config[list all configuration options]' \
      '(- *)-show-config[list the current configuration settings]' \
      '--indent-spaces:number of spaces:' \
      '--wrap:column:' \
      '--wrap-attributes:boolean:(${boolean[@]})' \
      '--wrap-script-literals:boolean:(${boolean[@]})' \
      '--wrap-sections:boolean:(${boolean[@]})' \
      '--wrap-asp:boolean:(${boolean[@]})' \
      '--wrap-jste:boolean:(${boolean[@]})' \
      '--wrap-php:boolean:(${boolean[@]})' \
      '--literal-attributes:boolean:(${boolean[@]})' \
      '--tab-size:tab size:' \
      '--markup:boolean:(${boolean[@]})' \
      '--quiet:boolean:(${boolean[@]})' \
      '--tidy-mark:boolean:(${boolean[@]})' \
      '--indent:boolean:(${autobool[@]})' \
      '--indent-attributes:boolean:(${boolean[@]})' \
      '--hide-endtags:boolean:(${boolean[@]})' \
      '--input-xml:boolean:(${boolean[@]})' \
      '--output-xml:boolean:(${boolean[@]})' \
      '--output-xhtml:boolean:(${boolean[@]})' \
      '--output-html:boolean:(${boolean[@]})' \
      '--add-xml-pi:boolean:(${boolean[@]})' \
      '--add-xml-decl:boolean:(${boolean[@]})' \
      '--assume-xml-procins:boolean:(${boolean[@]})' \
      '--raw:boolean:(${boolean[@]})' \
      '--uppercase-tags:boolean:(${boolean[@]})' \
      '--uppercase-attributes:boolean:(${boolean[@]})' \
      '--bare:boolean:(${boolean[@]})' \
      '--clean:boolean:(${boolean[@]})' \
      '--logical-emphasis:boolean:(${boolean[@]})' \
      '--word-2000:boolean:(${boolean[@]})' \
      '--drop-empty-paras:boolean:(${boolean[@]})' \
      '--drop-font-tags:boolean:(${boolean[@]})' \
      '--drop-proprietary-attribute:boolean:(${boolean[@]})' \
      '--enclose-text:boolean:(${boolean[@]})' \
      '--enclose-block-text:boolean:(${boolean[@]})' \
      '--alt-text:alternate text:' \
      '--add-xml-space:boolean:(${boolean[@]})' \
      '--fix-bad-comments:boolean:(${boolean[@]})' \
      '--split:boolean:(${boolean[@]})' \
      '--break-before-br:boolean:(${boolean[@]})' \
      '--numeric-entities:boolean:(${boolean[@]})' \
      '--quote-marks:boolean:(${boolean[@]})' \
      '--quote-nbsp:boolean:(${boolean[@]})' \
      '--quote-ampersand:boolean:(${boolean[@]})' \
      '--write-back:boolean:(${boolean[@]})' \
      '--keep-time:boolean:(${boolean[@]})' \
      '--show-warnings:boolean:(${boolean[@]})' \
      '--error-file:error file:_files' \
      '--output-file:output file:_files' \
      '--show-body-only:boolean:(${boolean[@]})' \
      '--slide-style:style sheet file:_files' \
      '--new-inline-tags:tag names:' \
      '--new-blocklevel-tags:tag names:' \
      '--new-empty-tags:tag names:' \
      '--new-pre-tags:tag names:' \
      '--char-encoding:encoding:(${encoding[@]})' \
      '--input-encoding:encoding:(${encoding[@]})' \
      '--output-encoding:encoding:(${encoding[@]})' \
      '--doctype:doctype:(${doctype[@]})' \
      '--fix-backslash:boolean:(${boolean[@]})' \
      '--gnu-emacs:boolean:(${boolean[@]})' \
      '--fix-uri:boolean:(${boolean[@]})' \
      '--lower-literals:boolean:(${boolean[@]})' \
      '--hide-comments:boolean:(${boolean[@]})' \
      '--indent-cdata:boolean:(${boolean[@]})' \
      '--force-output:boolean:(${boolean[@]})' \
      '--show-errors:maximum number of errors:' \
      '--ascii-chars:boolean:(${boolean[@]})' \
      '--join-classes:boolean:(${boolean[@]})' \
      '--join-styles:boolean:(${boolean[@]})' \
      '--escape-cdata:boolean:(${boolean[@]})' \
      '--repeated-attributes:value:(keep-first keep-last)' \
      '--output-bom:boolean:(${autobool[@]})' \
      '--replace-color:boolean:(${boolean[@]})' \
      '--css-prefix:CSS class name:' \
      '--accessibility-check:priority level:(${access[@]})' \
      '--newline:newline character:(LF CRLF CR)' \
      '*:file:_files' && return
    
    return 1
    PK[f{hhfunctions/_update-alternativesnuW+A#compdef update-alternatives
    
    local curcontext="$curcontext" context state line alterdir
    
    if [[ -d /var/lib/dpkg/alternatives ]]; then
      alterdir=/var/lib/dpkg/alternatives
    elif [[ -d /var/lib/rpm/alternatives/ ]]; then
      alterdir=/var/lib/rpm/alternatives
    fi
    
    _arguments -C \
      '--verbose' \
      '--quiet' \
      '--test' \
      '--help' \
      '--version' \
      '--altdir:altdir:_files -/' \
      '--admindir:admindir:_files -/' \
      '--install:*::alt:= ->install' \
      '--remove:*::alt:= ->remove' \
      '--auto:name:_files -W $alterdir' \
      '--display:name:_files -W $alterdir' \
      '--config:name:_files -W $alterdir' && return
    
    while true; do
      case "$state" in
        islave)
          _call_function ret _update_alternatives_$state && return ret
          state=
          _arguments -C \
    	'1:link:_files' \
    	'2:name:_files -W $alterdir' \
    	'3:path:_files' \
    	'--slave:*::more:= ->islave' && return
          [[ -z $state ]] && return 1
        ;;
    
        install)
          _call_function ret _update_alternatives_$state && return ret
          _arguments -C \
    	'1:link:_files' \
    	'2:name:_files -W $alterdir' \
    	'3:path:_files' \
    	'4:priority:' \
    	'--slave:*::slave:= ->islave' && return
          [[ -z $state ]] && return 1
        ;;
    
        remove)
          _call_function ret _update_alternatives_$state && return ret
          _arguments \
    	'1:name:_files -W $alterdir' \
    	'2:path:_files'
          return
        ;;
    
        *) return 1 ;;
      esac
    done
    PK[kkfunctions/_slrnnuW+A#compdef slrn
    
    _arguments \
      '-n[do not check for new groups]' \
      '-h[NNTP host]:NNTP host:_hosts' \
      '-p[NNTP port]:NNTP port:_ports' \
      '-f[name of the newsrc file to use]:newsrc file:_files' \
      '(-C\-)-C[use colors]' \
      "(-C)-C\-[don't use colors]" \
      '-d[get new text descriptions of each group from server]' \
      '-i[specify initialization file to use]:config file:_files' \
      '-D-[add predefined preprocessing token]' \
      '-k[do not process score file]' \
      '-k0[process score file but inhibit expensive scores]' \
      '-a[use active file for getting new news]' \
      '-m[force XTerm mouse reporting]' \
      '-w[wait for a key before switching to full screen mode]' \
      '--create[create a newsrc file by getting list of groups from server]' \
      '--debug[write debugging output to specified file]:debug file:_files' \
      '(-)--help[show help information]' \
      '--inews[use an external inews program to post articles]' \
      '--kill-log[keep a log of articles  killed by the scorefile]:log file:_files' \
      '--nntp[use builtin NNTP support]' \
      '--pull[spool outgoing articles locally]' \
      '--spool[read directly from spool]' \
    PK[HZDDfunctions/_tinnuW+A#compdef tin rtin
    
    local newshosts expl state line curcontext="$curcontext" ret=1
    
    _arguments -C -s \
      '-a[toggle color flag]' \
      '-A[force authentication on connect]' \
      '-c[mark all news as read in subscribed groups]' \
      "-d[don't show newsgroup descriptions]" \
      '-f[specify newsrc file to use]:newsrc file:_files' \
      '-G[specify limit to articles/group to get]:number of articles/group to get' \
      '-g[specify NNTP server]:NNTP server:->newshosts' \
      '-h[display help on tin usage]' \
      '-H[display help information]' \
      '-I[specify news index file directory]:news index file directory:_files -/' \
      '-l[get number of articles per group from the active file]' \
      '-m[specify mailbox directory]:mailbox directory:_files -/' \
      '-M[mail new news to specified user]:user:_users' \
      '-n[only read subscribed groups from server]' \
      '-N[mail new news to yourself]' \
      '-o[post all postponed articles and exit]' \
      '-p[specify port to connect to NNTP server]:NNTP port:_ports' \
      "-q[don't check for new newsgroups]" \
      '-Q[quick start. Same as -nqd]' \
      ${${service:#r*}:+-r\[read news remotely over NNTP\]} \
      '-R[read news saved with -S]' \
      '-s[specify saved news directory]:saved news directory:_files -/' \
      '-S[save new news for later reading]' \
      '-u[update index files]' \
      '-U[update index files in the background while reading news]' \
      '-v[verbose output in batch mode]' \
      '-V[display version information]' \
      '-w[post an article and exit]' \
      "-X[don't save any files on quit]" \
      '-z[start if any unread news]' \
      '-Z[return status to indicate if any unread news]' \
      '::newsgroup:_newsgroups' && return 0
    
    if [[ "$state" = newshosts ]]; then
      newshosts=( ${${(f)"$(<${TIN_HOMEDIR:-$HOME}/.tin/newsrctable)"}%%\#*} ) 2>/dev/null
      _tags hosts nicknames
      while _tags; do
        _requested hosts expl 'NNTP server hostname' \
            compadd ${=newshosts#*[[:blank:]]##[^[:blank:]]*[[:blank:]]} && ret=0
        _requested nicknames expl 'NNTP server nickname' \
            compadd -M 'r:|.=* r:|=*' ${newshosts%%[[:blank:]]*} && ret=0
        (( ret )) || return 0
      done
    fi
    
    return 1
    
    PK[0efunctions/_kfmclientnuW+A#compdef kfmclient kioclient
    
    # kfmclient is a command line interface for use with Konqueror,
    # the KDE file manager and web browser.
    #
    # In KDE4, kioclient has similar syntax but doesn't necessarily talk
    # to Konqueror ("kioclient exec ." by default starts Dolphin, for example).
    
    local expl
    local -a context state line
    typeset -A opt_args
    
    _arguments \
      '--help[show help message]' \
      '--help-qt[show Qt specific options]' \
      '--help-kde[show KDE specific options]' \
      '--help-all[show all options]' \
      '--author[show author information]' \
      '-v[show version information]' \
      '--version[show version information]' \
      '--license[show license information]' \
      '--commands[show available commands]' \
      '--display=:X display:_x_display' \
      '--session=:session id for restoring application: ' \
      '--cmap[use private colormap (8-bit display)]' \
      '--ncols=:limit on number of colors (8-bit display): ' \
      '--nograb[never grab mouse or keyboard]' \
      '--dograb[override nograb in debugger]' \
      '--sync[switch to synchronous mode when debugging]' \
      '--fn=:font name:_x_font' \
      '--font=:font name:_x_font' \
      '--bg=:background color:_x_color' \
      '--background=:background color:_x_color' \
      '--fg=:foreground color:_x_color' \
      '--foreround=:foreground color:_x_color' \
      '--btn=:button color:_x_color' \
      '--button=:button color:_x_color' \
      '--name=:application name: ' \
      '--title=:application title (caption): ' \
      '--visual=:specify visual:_x_visual' \
      '--inputstyle:X input method:(onthespot overthespot offthespot root)' \
      '--im:X Input Method server: ' \
      '--noxim[disable X Input Method]' \
      '--reverse[reverse widget layout]' \
      '--caption=:name in titlebar: ' \
      '--icon=:application icon: ' \
      '--miniicon=:icon in titlebar: ' \
      '--config=:configuration  file:_files' \
      '--dcopserver=:DCOP server: ' \
      '--nocrashhandler[disable crash handler, allow core dumps]' \
      '--waitforwm[wait for a WM_NET compatible window manager]' \
      '--style=:GUI style for application: ' \
      '--geometry=:client window geometry:_x_geometry' \
      '1:client command:(openURL openProfile openProperties exec move
    download copy sortDesktop configure configureDesktop)' \
      '2::args:->firstarg' \
      '3::args:->secondarg'  &&  return 0
    
    [[ $state = *arg ]] || return 1
    
    # Argument to previous command.
    
    case $line[1] in
      (openURL)
      if [[ $state = secondarg ]]; then
        _mime_types
        return
      elif [[ $state = firstarg ]]; then
        _webbrowser
        return
      fi
      ;;
    
      (openProfile)
      if [[ $state = secondarg ]]; then
        _webbrowser
        return
      elif [[ $state = firstarg ]]; then
        local appdata=${$(kde-config --path data 2> /dev/null):-~/.kde/share/apps/}
        _wanted profile expl 'Konqueror profile' \
          compadd -- ${(s/:/)^${appdata}}konqueror/profiles/*(:t)
        return
      fi
      ;;
    
      (exec)
      if [[ $state = secondarg ]]; then
        # Look for a Desktop Action binding.
        _wanted binding expl 'KDE binding' compadd -- ${${${(M)${(f)"$(<$file)"}:#"[Desktop Action "*"]"}%%\]}##"[Desktop Action "}
        return
      elif [[ $state = firstarg ]]; then
        _webbrowser
        return
      fi
      ;;
    
      (move|download|copy|openProperties)
      if [[ $state = firstarg ]]; then
          _webbrowser
          return
      fi
      ;;
    esac
    
    _message "no more arguments"
    PK[Xzpfunctions/_xmlsoftnuW+A#compdef xsltproc xmllint -value-,XML_CATALOG_FILES,-default-
    
    # xmllint: using libxml version 20707
    # xsltproc: using libxml 20707, libxslt 10126 and libexslt 815
    
    local -a encoding
    
    encoding=(
      UTF-8
      UTF-16
      ISO-10646-UCS-2
      ISO-10646-UCS-4
      ISO-8859-1
      ISO-8859-2
      ISO-8859-3
      ISO-8859-4
      ISO-8859-5
      ISO-8859-6
      ISO-8859-7
      ISO-8859-8
      ISO-8859-9
      ISO-2022-JP
      SHIFT_JIS
      EUC-JP
    )
    
    case $service in
      xsltproc)
        _arguments \
          '(-)'{--version,-V}'[show libxml and libxslt versions]' \
          '(--verbose -v)'{--verbose,-v}"[show logs of what's happening]" \
          '(--output -o)'{--output,-o}'[specify output file]:output file:_files' \
          '--timing[display the time used]' \
          '--repeat[run the transformation 20 times]' \
          '--debug[dump the tree of the result instead]' \
          '--dumpextensions[dump registered extension elements and functions]' \
          '--novalid[skip the DTD loading phase]' \
          '--nodtdattr[do not default attributes from the DTD]' \
          '--noout[do not dump the result]' \
          '--maxdepth[increase the maximum depth]:depth' \
          '--maxparserdepth[increase the maximum parser depth]:depth' \
          '--html[input document is an HTML file]' \
          '--encoding[the input document character encoding]:encoding:(${encoding[@]})' \
          '--param[pass a parameter,value pair]:name::value (xpath expression)' \
          '--stringparam[pass a parameter]:name::value' \
          '--path[provide a set of paths for resources]:paths:_files -/' \
          '--nonet[refuse to fetch DTDs or entities over network]' \
          '--nowrite[refuse to write to any file or resource]' \
          '--nomkdir[refuse to create directories]' \
          '--writesubtree[allow file write only with the path subtree]:path:_files -/' \
          '--catalogs[use SGML catalogs]' \
          '--xinclude[do XInclude processing on document input]' \
          '--xincludestyle[do XInclude processing on stylesheets]' \
          '--load-trace[print trace of all external entites loaded]' \
          {--profile,--norman}'[dump profiling information]' \
          '1:stylesheet:_files -g "*.xsl(-.)"' \
          ':file:_files -g "*.xml(-.)"' && return
      ;;
      xmllint)
        _arguments \
          '--version[display the version of the XML library used]' \
          '--debug[dump a debug tree of the in-memory document]' \
          '--shell[run a navigating shell]' \
          '--debugent[debug the entities defined in the document]' \
          '--copy[used to test the internal copy implementation]' \
          '--recover[output what was parsable on broken XML documents]' \
          '--huge[remove any internal arbitrary parser limits]' \
          '--noent[substitute entity references by their value]' \
          "(--output -o)--noout[don't output the result tree]" \
          '--path[provide a set of paths for resources]:paths:_files -/' \
          '--load-trace[print trace of all external entites loaded]' \
          '--nonet[refuse to fetch DTDs or entities over network]' \
          '--htmlout[output results as HTML]' \
          '--nowrap[do not put HTML doc wrapper]' \
          '--nocompact[do not generate compact text nodes]' \
          '--valid[validate the document in addition to std well-formed check]' \
          '(--dtdvalid --relaxng --schema)--postvalid[do a posteriori validation, i.e after parsing]' \
          '(--postvalid --relaxng --schema --dtdvalidfpi)--dtdvalid[do a posteriori validation against a given DTD]:DTD:_webbrowser' \
          '(--postvalid --relaxng --schema --dtdvalid)--dtdvalidfpi[as --dtdvalid but specify DTD with public identifier]:DTD identifier' \
          '--timing[print some timings]' \
          '(--noout --output -o)'{--output,-o}'[save to a given file]:output file:_files' \
          '--repeat[repeat 100 times, for timing or profiling]' \
          '--insert[ad-hoc test for valid insertions]' \
          '--compress[turn on gzip compression of output]' \
          '--html[use the HTML parser]' \
          '--xmlout[use the XML serializer when using --html]' \
          '--push[use the push mode of the parser]' \
          '--memory[parse from memory]' \
          '--maxmem[imits memory allocation]:bytes' \
          '--nowarning[do not emit warnings from parser/validator]' \
          '--noblanks[drop (ignorable?) blanks spaces]' \
          '--nocdata[replace cdata section with text nodes]' \
          '--format[reformat/reindent the input]' \
          '--encode[output in the given encoding]:encoding:(${encoding[@]})' \
          '--dropdtd[remove the DOCTYPE of the input docs]' \
          '--c14n[save in W3C canonical format]' \
          '--c14n11[save in W3C canonical format v1.1 (with comments)]' \
          '--exc-c14n[save in W3C exclusive canonical format]' \
          '--nsclean[remove redundant namespace declarations]' \
          '--testIO[test user I/O support]' \
          '(--nocatalogs)--catalogs[use SGML catalogs]' \
          '(--catalogs)--nocatalogs[deactivate all catalogs]' \
          '--auto[generate a small doc on the fly]' \
          '(--noxincludenode)--xinclude[do XInclude processing]' \
          '(--xinclude)--noxincludenode[do XInclude processing but do not generate XInclude nodes]' \
          '--loaddtd[fetch external DTD]' \
          '--nofixup-base-uris[do not fixup xml:base uris]' \
          '--dtdattr[loaddtd + populate the tree with inherited attributes]' \
          '--stream[use the streaming interface to process very large files]' \
          '--walker[create a reader and walk though the resulting doc]' \
          '--pattern[test the pattern support]:pattern value' \
          '--chkregister[verify the node registration code]' \
          '(--dtdvalid --postvalid --schema)--relaxng[do RelaxNG validation against specified schema]:schema:_webbrowser' \
          '(--dtdvalid --postvalid --relaxng)--schema[do validation against specified WXS schema]:schema:_webbrowser' \
          '(--dtdvalid --postvalid --relaxng)--schematron[do validation against specified schematron]:schema:_webbrowser' \
          '--sax1[use the old SAX1 interfaces for processing]' \
          '--sax[do not build a tree but work just at the SAX level]' \
          '--oldxml10[use XML-1.0 parsing rules before the 5th edition]' \
          '--xpath[evaluate the XPath expression, inply --noout]:XPath expression:' \
          '*:XML file:_webbrowser' && return
      ;;
      *XML_CATALOG_FILES*)
        compset -q
        if [[ -prefix *: ]]; then
          _urls
          return
        fi
        
        compset -S ':*'
        _alternative \
          'files:catalog file:_files' \
          'url-schemas:URL schema:compadd -S "" file:///' && return
      ;;
    esac
    
    return 1
    
    
    PK[lfunctions/_a2utilsnuW+A#compdef a2ensite a2dissite a2enmod a2dismod
    
    local -a mods
    
    case "$service" in
        a2ensite)
    	_wanted sites expl sites \
    	  _files -W /etc/apache2/sites-available
    	;;
        a2dissite)
    	_wanted sites expl sites \
    	  _files -W /etc/apache2/sites-enabled
    	;;
        a2enmod)
    	mods=( /etc/apache2/mods-available/*.load(N:r:t) )
    	_wanted mods expl mods compadd -a mods
    	;;
        a2dismod)
    	mods=( /etc/apache2/mods-enabled/*.load(N:r:t) )
    	_wanted mods expl mods compadd -a mods
    	;;
    esac
    
    return 0
    PK[1iifunctions/_limitsnuW+A#compdef unlimit
    
    local expl
    
    _wanted limits expl 'process limit' compadd "$@" - ${${(f)"$(limit)"}%% *}
    PK[N!functions/_dynamic_directory_namenuW+A#autoload
    
    if [[ -n $functions[zsh_directory_name] ]]; then
      zsh_directory_name c
    else
      _message 'dynamic directory name: implemented as zsh_directory_name c'
    fi
    PK[?s)functions/run-help-gitnuW+Aif [ $# -eq 0 ]; then
        man git
    else
        local al
        if al=$(git config --get "alias.$1"); then
            1=${al%% *}
        fi
        man git-$1
    fi
    PK[`S++functions/_brace_parameternuW+A#compdef -brace-parameter-
    
    _parameters -e
    PK[6Y}}functions/_tune2fsnuW+A#compdef tune2fs
    
    _arguments \
      '-c[set max mounts between checks]:number of mounts' \
      '-C[set mount count]:number of mounts' \
      '-e[set error behavior]:error behavior:(continue remount-ro panic)' \
      '-f[force tune2fs to complete even in the face of errors]' \
      '-g[set the group which can use reserved filesystem blocks]:group:_groups' \
      '-i[interval between checks]:duration' \
      '-j[add an ext3 journal to the filesystem]' \
      '-J[journal options]: :_values -s , option "size[specify journal size]\:size" "device[use external journal]\:block device\:_files"' \
      '-l[list the contents of the filesystem superblock]' \
      '-L[set the volume label of the filesystem]:label' \
      '-m[set the percentage of reserved filesystem blocks]:percentage' \
      '-M[set the last-mounted directory for the filesystem]:directory:_files -/' \
      '-o[mount options]:options:_values -s , debug bsdgroups user_xattr acl uid16 journal_data journal_data_ordered journal_data_writeback' \
      '-O[set or clear filesystem features]: :_values -s , feature dir_index filetype has_journal sparse_super' \
      '-r[set the number of reserved filesystem blocks]:number' \
      '-s[set sparse super feature]:state:((0\:off 1\:on))' \
      '-T[set time last checked]:time specifier' \
      '-u[set user who can use reserved filesystem blocks]:user:_users' \
      '-U[set filesystem UUID]:UUID or special:(clear random time)' \
      ':device:_files'
    PK[1D//functions/_set_commandnuW+A#autoload
    
    # This sets the parameters _comp_command1, _comp_command2 and _comp_command
    # in the calling function.
    
    local command
    
    command="$words[1]"
    
    [[ -z "$command" ]] && return
    
    if (( $+builtins[$command] + $+functions[$command] )); then
      _comp_command1="$command"
      _comp_command="$_comp_command1"
    elif [[ "$command[1]" = '=' ]]; then
      eval _comp_command2\=$command
      _comp_command1="$command[2,-1]"
      _comp_command="$_comp_command2"
    elif [[ "$command" = ..#/* ]]; then
      _comp_command1="${PWD}/$command"
      _comp_command2="${command:t}"
      _comp_command="$_comp_command2"
    elif [[ "$command" = */* ]]; then
      _comp_command1="$command"
      _comp_command2="${command:t}"
      _comp_command="$_comp_command2"
    else
      _comp_command1="$command"
      _comp_command2="$commands[$command]"
      _comp_command="$_comp_command1"
    fi
    PK[*ffunctions/_filesnuW+A#compdef -redirect-,-default-,-default-
    
    local opts tmp glob pat pats expl tag i def descr end ign ret=1 match tried
    local type sdef ignvars ignvar
    
    zparseopts -a opts \
        '/=tmp' 'f=tmp' 'g+:-=tmp' q n 1 2 P: S: r: R: W: X+: M+: F: J+: V+:
    
    type="${(@j::M)${(@)tmp#-}#?}"
    if (( $tmp[(I)-g*] )); then
      glob="${${${${(@M)tmp:#-g*}#-g}##[[:blank:]]#}%%[[:blank:]]#}"
      [[ "$glob" = *[^\\][[:blank:]]* ]] &&
          glob="{${glob//(#b)([^\\])[[:blank:]]##/${match[1]},}}"
    
      # add `#q' to the beginning of any glob qualifier if not there already
      [[ "$glob" = (#b)(*\()([^\|\~]##\)) && $match[2] != \#q* ]] &&
          glob="${match[1]}#q${match[2]}"
    fi
    tmp=$opts[(I)-F]
    if (( tmp )); then
      ignvars=($=opts[tmp+1])
      if [[ $ignvars = _comp_ignore ]]; then
        ign=( $_comp_ignore )
      else
        ign=()
        for ignvar in $ignvars; do
          ign+=(${(P)ignvar})
        done
        opts[tmp+1]=_comp_ignore
      fi
    else
      ign=()
    fi
    
    if zstyle -a ":completion:${curcontext}:" file-patterns tmp; then
      [[ "$type" = */* ]] && glob="$glob,*(-/)"
      pats=()
    
      for i in ${tmp//\%p/${${glob:-\*}//:/\\:}}; do
        if [[ $i = *[^\\]:* ]]; then
          pats=( "$pats[@]" " $i " )
        else
          pats=( "$pats[@]" " ${i}:files " )
        fi
      done
    elif zstyle -t ":completion:${curcontext}:" list-dirs-first; then
      if [[ "$type" = *g* ]]; then
    
        # add `^-/' after `#q' glob qualifier if not there already
        if [[ "$glob" = (#b)(*\(\#q)(*\)) ]]; then
          [[ $match[2] != \^-/* ]] &&
          glob="${match[1]}^-/,${match[2]}"
        else
          glob="$glob(#q^-/)"
        fi
    
        pats=( " *(-/):directories:directories ${glob//:/\\:}:globbed-files" )
      elif [[ "$type" = */* ]] then
        pats=( '*(-/):directories ' '*:all-files ' )
      else
        pats=( '*(-/):directories:directories *(^-/):other-files ' )
      fi
    else
      if [[ "$type" = *g* ]]; then
    
      # People prefer to have directories shown on first try as default.
      # Even if the calling function didn't use -/.
      #
      # if [[ "$type" = */* ]]; then
    
        pats=( " ${glob//:/\\:}:globbed-files *(-/):directories" '*:all-files '
    
        ### We could allow _next_tags to offer only globbed-files or directories
        ### by adding:
        ###   " ${glob//:/\\:}:only-globbed-files " ' *(-/):only-directories '
    
          )
    
      # else
      #   pats=( " ${glob//:/\\:}:globbed-files "
      #          '*(-/):directories ' '*:all-files ' )
      # fi
    
      elif [[ "$type" = */* ]]; then
        pats=( '*(-/):directories ' '*:all-files ' )
      else
        pats=( '*:all-files ' )
      fi
    fi
    
    tried=()
    for def in "$pats[@]"; do
      eval "def=( ${${def//\\:/\\\\\\:}//(#b)([][()|*?^#~<>])/\\${match[1]}} )"
    
      tmp="${(@M)def#*[^\\]:}"
      (( $tried[(I)${(q)tmp}] )) && continue
      tried=( "$tried[@]" "$tmp" )
    
      for sdef in "$def[@]"; do
    
        tag="${${sdef#*[^\\]:}%%:*}"
        pat="${${sdef%%:${tag}*}//\\:/:}"
    
        if [[ "$sdef" = *:${tag}:* ]]; then
          descr="${(Q)sdef#*:${tag}:}"
        else
          if (( $opts[(I)-X] )); then
            descr=
          else
            descr=file
          fi
          end=yes
        fi
    
        _tags "$tag"
        while _tags; do
          _comp_ignore=()
          while _next_label "$tag" expl "$descr"; do
            _comp_ignore=( $_comp_ignore $ign )
            if [[ -n "$end" ]]; then
              _path_files -g "$pat" "$opts[@]" "$expl[@]" && ret=0
            else
              _path_files "$expl[@]" -g "$pat" "$opts[@]" && ret=0
            fi
          done
          (( ret )) || break
        done
    
        ### For that _next_tags change mentioned above we would have to
        ### comment out the following line. (Or not, depending on the order
        ### of the patterns.)
    
        [[ "$pat" = '*' ]] && return ret
    
      done
      (( ret )) || return 0
    done
    
    return 1
    PK[%functions/_portsnapnuW+A#compdef portsnap
    
    local context state line
    typeset -A opt_args
    
    flags=(
      '(cron)fetch[fetch a compressed snapshot or update existing one]'
      '(fetch)cron[sleep rand(3600) seconds, and then fetch updates]'
      '(update)extract[extract snapshot, replacing existing files and dirs]'
      '(extract)update[update ports tree to match current snapshot]'
    )
    
    _arguments -C -s \
        '-d[store working files in workdir]:workdir:_files -/' \
        '-f[read configuration options from conffile]:conf file:_files' \
        '-I[update INDEX only. (update command only)]' \
        '-k[trust an RSA key with SHA256 hash of KEY]:RSA key:_files' \
        '-l[merge the specified local describes file into the INDEX]:file:_files' \
        '-p[location of uncompressed ports tree]:uncompressed ports tree:_files -/' \
        '-s[server from which to fetch updates]:server:_hosts' \
        '*:principal:->principal' && ret=0
    
    if [[ $state == principal ]]; then
      _alternative \
        ':file flag:_values -S " " -w "commands" $flags[@]' \
        '*:path:_files -/'
    fi
    
    return ret
    PK[k@RRfunctions/_enablenuW+A#compdef enable
    
    _arguments -C -s -A "-*" -S \
      "(-f -r)-a[act on aliases]:*:aliases:(${(k)dis_aliases})" \
      "(-a -r)-f[act on functions]:*:functions:(${(k)dis_functions})" \
      "(-a -f)-r[act on reserved words]:*:reserved-words:compadd -k dis_reswords" \
      '-m[treat arguments as patterns]' \
      "*:builtin command:(${(k)dis_builtins})"
    PK[functions/_spamassassinnuW+A#compdef spamassassin
    
    _arguments \
        '-P[pipe to STDOUT]' \
        '-e[error code on spam]' \
        '-h[help]' \
        '-t[test mode]' \
        '-r[report message as verified spam]' \
        '-w[set from addr of reply mail]:fromaddr:_user_at_host' \
        '-l[log to file]:filename:_files' \
        '-L[perform only local tests]' \
        '-d[remove SpamAssassin markup]' \
        '-c[config]:config file:_files' \
        '-p[score preferences]:preference file:_files' \
        '-D[diagnostic output]'
    PK[		functions/_chkconfignuW+A#compdef chkconfig
    
    local curcontext="$curcontext" state line expl ret=1
    
    case $OSTYPE in
    linux*)
      _arguments -C \
        '(- 2)--list[list services]' \
        '(-)--level[specify runlevels to apply to]:-:_values -s "" "run levels" 1 2 3 4 5 6 7' \
        '(- 2)--add[add new service]' \
        '(- 2)--del[remove service from chkconfig management]' \
        '1:service name:_services' \
        '2:state:(on off reset)' && ret=0
    ;;
    irix*)
      _arguments -C \
        '(- 1)-s[print state of configuration flags]' \
        '(1 -s)-f[set flag state]:configuration flag:->flag:state:(on off)' \
        '1:configuration flag:->flag' && ret=0
    
      if [[ -n "$state" ]]; then
        _wanted conf-flags expl 'configuration flag' \
    	compadd ${${${(f)"$($words[1])"}[4,-1]##$'\t'}%% *} && ret=0
      fi
    ;;
    esac
    
    return ret
    PK[wfunctions/_guardnuW+A#autoload
    
    local garbage
    
    zparseopts -K -D -a garbage M: J: V: 1 2 n F: X:
    
    [[ "$PREFIX$SUFFIX" != $~1 ]] && return 1
    
    shift
    _message -e "$*"
    
    [[ -n "$PREFIX$SUFFIX" ]]
    PK["`functions/_screennuW+A#compdef screen
    
    local curcontext="$curcontext" state line expl
    local scr_cmds sessions
    
    scr_cmds=(
      acladd            aclchg            acldel            aclgrp
      aclumask          activity          addacl            allpartial
      altscreen         at                attrcolor         autodetach
      autonuke          backtick          bce               bd_bc_down
      bd_bc_left        bd_bc_right       bd_bc_up          bd_bell
      bd_braille_table  bd_eightdot       bd_info           bd_link
      bd_lower_left     bd_lower_right    bd_ncrc           bd_port
      bd_scroll         bd_skip           bd_start_braille  bd_type
      bd_upper_left     bd_upper_right    bd_width          bell_msg
      bind              bindkey           blanker           blankerprg
      break             breaktype         bufferfile        c1
      caption           chacl             charset           chdir
      clear             colon             command           compacthist
      console           copy              crlf              debug
      defautonuke       defbce            defbreaktype      defc1
      defcharset        defencoding       defescape         defflow
      defgr             defhstatus        defkanji          deflog
      deflogin          defmode           defmonitor        defnonblock
      defobuflimit      defscrollback     defshell          defsilence
      defslowpaste      defutf8           defwrap           defwritelock
      detach            digraph           dinfo             displays
      dumptermcap       echo              encoding          escape
      eval              exec              fit               flow
      focus             gr                hardcopy          hardcopy_append
      hardcopydir       hardstatus        height            help
      history           hstatus           idle              ignorecase
      info              kanji             kill              lastmsg
      license           lockscreen        log               logfile
      login             logtstamp         mapdefault        mapnotnext
      maptimeout        markkeys          maxwin            meta
      monitor           msgminwait        msgwait           multiuser
      nethack           next              nonblock          number
      obuflimit         only              other             partial
      password          paste             pastefont         pow_break
      pow_detach        pow_detach_msg    prev              printcmd
      process           quit              readbuf           readreg
      redisplay         register          remove            removebuf
      reset             resize            screen            scrollback
      select            sessionname       setenv            setsid
      shell             shelltitle        silence           silencewait
      sleep             slowpaste         sorendition       source
      split             startup_message   stuff             su
      suspend           term              termcap           termcapinfo
      terminfo          time              title             umask
      unsetenv          utf8              vbell             vbell_msg
      vbellwait         verbose           version           wall
      width             windowlist        windows           wrap
      writebuf          writelock         xoff              xon
      zmodem            zombie
    )
    
    _arguments -C \
      "-a[force all capabilities into each window's termcap]" \
      '-A[adapt all windows to the new display width & height]' \
      "-c[read configuration file instead of '.screenrc']:config file:_files" \
      '-d[detach the elsewhere running screen (with -r: reattach here)]: :->attached-sessions' \
      '-dmS[start as daemon, screen session in detached mode]:session name' \
      '-D[detach and logout remote (with -r: reattach here)]: :->attached-sessions' \
      '-e[change command characters]:command characters' \
      '-f-[set flow control]:flow control:((n\:flow\ control\ off a\:flow\ control\ auto \:flow\ control\ on))' \
      '-h[set the size of the scrollback history buffer]:buffer size' \
      '-i[interrupt output sooner when flow control is on]' \
      '(-l)-ln[login mode off (do not update utmp database)]' \
      '(-ln)-l[login mode on (update utmp database)]' \
      '(-)'{-ls,-list}'[list sessions/socket directory]' \
      "-L[terminal's last character can be safely updated]" \
      '-m[ignore $STY variable, do create a new screen session]' \
      '-O[choose optimal output rather than exact vt100 emulation]' \
      '-p[preselect the named window]:window number or name:((\=\:windowlist -\:blank\ window \:window\ number))' \
      '-q[quiet startup, exit with non-zero return code if unsuccessful]' \
      '-r[reattach to a detached screen process]: :->detached-sessions' \
      '-Dr: :->any-sessions' \
      '-dr: :->any-sessions' \
      '-R[reattach if possible, otherwise start a new session]: :->detached-sessions' \
      '-DR: :->any-sessions' \
      '-dR: :->any-sessions' \
      '-s[shell to execute rather than $SHELL]:shell name: _command_names -e' \
      '-S[name this session .sockname instead of ..]:session name:->any-sessions' \
      "-t[set title (window's name)]:title" \
      '-T[use term as $TERM for windows, rather than "screen"]:terminal type:_terminals' \
      '-U[tell screen to use UTF-8 encoding]' \
      '(-)-v[print screen version]' \
      '(-)-wipe[do nothing, clean up SockDir]' \
      '-x[attach to a not detached screen (multi display mode)]: :->attached-sessions' \
      '-Dx: :->any-sessions' \
      '-dx: :->any-sessions' \
      '-X[execute command as a screen command in the specified session]:screencmd:(${scr_cmds[@]})' \
      '*::arguments: _normal'
    
    if [[ -n $state ]]; then
      case $state in
        attached-sessions)
          sessions=(
            ${${${(M)${(f)"$(_call_program screen-sessions $words[1] \
                -ls 2>/dev/null)"}:#*[Aa]ttached*}##[[:blank:]]}%%[[:blank:]]*}
          )
        ;;
        detached-sessions)
          sessions=(
            ${${${(M)${(f)"$(_call_program screen-sessions $words[1] \
                -ls 2>/dev/null)"}:#*[Dd]etached*}##[[:blank:]]}%%[[:blank:]]*}
          )
        ;;
        any-sessions)
          sessions=(
            ${${${(M)${(f)"$(_call_program screen-sessions $words[1] \
    	    -ls 2>/dev/null)"}:#*tached*}##[[:blank:]]}%%[[:blank:]]*}
          )
      esac
    
      # check if initial PID is necessary to make sessions unambiguous
      if [[ ${#${(u)sessions#*.}} -lt $#sessions ]]; then
        _wanted screen-sessions expl "${state%-*} screen process" \
    	compadd -a sessions
      else
        _wanted screen-sessions expl "${state%-*} screen process" \
    	compadd ${sessions#*.}
      fi
    fi
    PK[ۍ=functions/_chflagsnuW+A#compdef chflags
    
    local flags own='-g *(-u$EUID)'
    
    flags=(
      '(noopaque)opaque[set the opaque flag]'
      '(opaque)noopaque[unset the opaque flag]'
      '(dump)nodump[set the nodump flag]'
      '(nodump)dump[unset the nodump flag]'
      '(nouappnd)uappnd[set the user append-only flag]'
      '(uappnd)nouappnd[unset the user append-only flag]'
      '(nouchg)uchg[set the user immutable flag]'
      '(uchg)nouchg[unset the user immutable flag]'
    )
    
    if (( ! EUID )); then
      flags=( $flags[@]
        '(noarch)arch[set the archived flag]'
        '(arch)noarch[unset the archived flag]'
        '(nosappnd)sappnd[set the system append-only flag]'
        '(sappnd)nosappnd[unset the system append-only flag]'
        '(noschg)schg[set the system immutable flag]'
        '(schg)noschg[unset the system immutable flag]'
      )
      unset own
    fi
    
    if [[ $OSTYPE = (freebsd|dragonfly|darwin)* ]]; then
      flags=( $flags[@]
        '(nouunlnk)uunlnk[set the user undeletable flag]'
        '(uunlnk)nouunlnk[unset the user undeletable flag]'
        '(nohidden)hidden[set the hidden flag]'
        '(hidden)nohidden[unset the hidden flag]'
      )
      (( EUID )) || flags=( $flags[@]
        '(nosunlnk)sunlnk[set the system undeletable flag]'
        '(sunlnk)nosunlnk[unset the system undeletable flag]'
      )
    fi
    
    _arguments -s -A "-*" \
      '(-L -P)-H[follow symlinks on the command line (specify with -R)]' \
      '(-H -P)-L[follow all symlinks (specify with -R)]' \
      '(-L -H)-P[do not follow symlinks (specify with -R)]' \
      '-R[recurse directories]' \
      ':file flag:_values -s , "file flags" $flags[@]' \
      '*:file:_files "$own"'
    PK[55functions/_options_unsetnuW+A#autoload
    
    # Complete all unset options. This relies on `_main_complete' to store the
    # names of the options that were unset when it was called in the array
    # `_options_unset'.
    
    local expl
    
    _wanted zsh-options expl 'unset zsh option' \
        compadd "$@" -M 'B:[nN][oO]= M:_= M:{A-Z}={a-z}' -a - _options_unset
    PK[nZfunctions/VCS_INFO_realpathnuW+A## vim:ft=zsh
    ## Written by Frank Terbeck 
    ## Distributed under the same BSD-ish license as zsh itself.
    
    setopt localoptions NO_shwordsplit chaselinks
    # -q to avoid chpwd() invocations
    ( builtin cd -q $1 2>/dev/null && pwd; )
    PK[functions/_expand_aliasnuW+A#compdef -K _expand_alias complete-word \C-xa
    
    local word expl tmp pre sel what
    local -a tmpa
    
    eval "$_comp_setup"
    
    if [[ -n $funcstack[2] ]]; then
      if [[ "$funcstack[2]" = _prefix ]]; then
        word="$IPREFIX$PREFIX$SUFFIX"
      else
        word="$IPREFIX$PREFIX$SUFFIX$ISUFFIX"
      fi
      pre=()
    else
      local curcontext="$curcontext"
    
      if [[ -z "$curcontext" ]]; then
        curcontext="expand-alias-word:::"
      else
        curcontext="expand-alias-word:${curcontext#*:}"
      fi
    
      word="$IPREFIX$PREFIX$SUFFIX$ISUFFIX"
      pre=(_main_complete - aliases)
    fi
    
    zstyle -s ":completion:${curcontext}:" regular tmp || tmp=yes
    case $tmp in
    always) sel=r;;
    yes|1|true|on) [[ CURRENT -eq 1 ]] && sel=r;;
    esac
    zstyle -T ":completion:${curcontext}:" global && sel="g$sel"
    zstyle -t ":completion:${curcontext}:" disabled && sel="${sel}${(U)sel}"
    
    tmp=
    [[ $sel = *r* ]] && tmp=$aliases[$word]
    [[ -z $tmp && $sel = *g* ]] && tmp=$galiases[$word]
    [[ -z $tmp && $sel = *R* ]] && tmp=$dis_aliases[$word]
    [[ -z $tmp && $sel = *G* ]] && tmp=$dis_galiases[$word]
    
    if [[ -n $tmp ]]; then
      # We used to remove the quoting from the value in the parameter.
      # That was probably just an oversight: an alias is always replaced
      # literally.
      tmp=${tmp%%[[:blank:]]##}
      if [[ $tmp[1] = [[:alnum:]_] ]]; then
        tmpa=(${(z)tmp})
        if [[ $tmpa[1] = $word && $tmp = $aliases[$word] ]]; then
          # This is an active regular alias and the first word in the result
          # is the same as what was on the line already.  Quote it so
          # that it doesn't get reexanded on execution.
          #
          # Strictly we also need to check if the original word matches
          # a later word in the expansion and the previous words are
          # all aliases where the expansion ends in " ", but I'm
          # too lazy.
          tmp="\\$tmp"
        fi
      fi
      $pre _wanted aliases expl alias compadd -UQ -- ${tmp%%[[:blank:]]##}
    elif (( $#pre )) && zstyle -t ":completion:${curcontext}:" complete; then
      $pre _aliases -s "$sel" -S ''
    else
      return 1
    fi
    PK[&Đ
    
    functions/_approximatenuW+A#autoload
    
    # This code will try to correct the string on the line based on the
    # strings generated for the context. These corrected strings will be
    # shown in a list and one can cycle through them as in a menu completion
    # or get the corrected prefix.
    
    # We don't try correction if the string is too short or we have tried it
    # already.
    
    [[ _matcher_num -gt 1 || "${#:-$PREFIX$SUFFIX}" -le 1 ]] && return 1
    
    local _comp_correct _correct_expl _correct_group comax cfgacc match
    local oldcontext="${curcontext}" opm="$compstate[pattern_match]"
    local dounfunction
    integer ret=1
    
    if [[ "$1" = -a* ]]; then
      cfgacc="${1[3,-1]}"
    elif [[ "$1" = -a ]]; then
      cfgacc="$2"
    else
      zstyle -s ":completion:${curcontext}:" max-errors cfgacc ||
          cfgacc='2 numeric'
    fi
    
    # Get the number of errors to accept.
    
    if [[ "$cfgacc" = *numeric* && ${NUMERIC:-1} -ne 1 ]]; then
      # A numeric argument may mean that we should not try correction.
    
      [[ "$cfgacc" = *not-numeric* ]] && return 1
    
      # Prefer the numeric argument if that has a sensible value.
    
      comax="${NUMERIC:-1}"
    else
      comax="${cfgacc//[^0-9]}"
    fi
    
    # If the number of errors to accept is too small, give up.
    
    [[ "$comax" -lt 1 ]] && return 1
    
    _tags corrections original
    
    # Otherwise temporarily define a function to use instead of
    # the builtin that adds matches. This is used to be able
    # to stick the `(#a...)' in the right place (after an
    # ignored prefix).
    #
    # Current shell structure for use with "always", to make sure
    # we unfunction the compadd.
    {
    if (( ! $+functions[compadd] )); then
      dounfunction=1
      compadd() {
        local ppre="$argv[(I)-p]"
    
        [[ ${argv[(I)-[a-zA-Z]#U[a-zA-Z]#]} -eq 0 &&
           "${#:-$PREFIX$SUFFIX}" -le _comp_correct ]] && return
    
        if [[ "$PREFIX" = \~* && ( ppre -eq 0 || "$argv[ppre+1]" != \~* ) ]]; then
          PREFIX="~(#a${_comp_correct})${PREFIX[2,-1]}"
        else
          PREFIX="(#a${_comp_correct})$PREFIX"
        fi
    
        (( $_correct_group && ${${argv[1,(r)-(|-)]}[(I)-*[JV]]} )) &&
            _correct_expl[_correct_group]=${argv[1,(r)-(-|)][(R)-*[JV]]}
    
        builtin compadd "$_correct_expl[@]" "$@"
      }
    fi
    
    _comp_correct=1
    
    [[ -z "$compstate[pattern_match]" ]] && compstate[pattern_match]='*'
    
    while [[ _comp_correct -le comax ]]; do
      curcontext="${oldcontext/(#b)([^:]#:[^:]#:)/${match[1][1,-2]}-${_comp_correct}:}"
    
      _description corrections _correct_expl corrections \
                   "e:$_comp_correct" "o:$PREFIX$SUFFIX"
    
      _correct_group="$_correct_expl[(I)-*[JV]]"
    
      if _complete; then
        if zstyle -t ":completion:${curcontext}:" insert-unambiguous &&
           [[ "${#compstate[unambiguous]}" -ge "${#:-$PREFIX$SUFFIX}" ]]; then
          compstate[pattern_insert]=unambiguous
        elif _requested original &&
             { [[ compstate[nmatches] -gt 1 ]] ||
               zstyle -t ":completion:${curcontext}:" original }; then
          local expl
    
          _description -V original expl original
    
          builtin compadd "$expl[@]" -U -Q - "$PREFIX$SUFFIX"
    
          # If you always want to see the list of possible corrections,
          # set `compstate[list]=list force' here.
    
          [[ "$compstate[list]" != list* ]] &&
              compstate[list]="$compstate[list] force"
        fi
        compstate[pattern_match]="$opm"
    
        ret=0
        break
      fi
    
      [[ "${#:-$PREFIX$SUFFIX}" -le _comp_correct+1 ]] && break
      (( _comp_correct++ ))
    done
    
    } always {
        [[ -n $dounfunction ]] && (( $+functions[compadd] )) && unfunction compadd
    }
    
    (( ret == 0 )) && return 0
    
    compstate[pattern_match]="$opm"
    
    return 1
    PK[]oNNfunctions/_bash_completionsnuW+A#compdef -K _bash_complete-word complete-word \e~ _bash_list-choices list-choices ^X~
    #
    # This function is for bash compatibility.  As some of the bash bindings
    # are already taken up in zsh, only Esc ~ and \C-x ~ are bound, and
    # you must add the rest by hand.  The bindings expected are:
    #
    # Esc ! -> command name
    # Esc $ -> environment variables
    # Esc @ -> machine names
    # Esc / -> file name
    # Esc ~ -> a user name
    # 
    # C-x instead of Esc with one of the above will list matches and won't
    # attempt any completion.
    #
    # The following will bind the remaining set; simply put it in .zshrc
    # after compinit is run.
    #
    # for key in '!' '$' '@' '/'; do
    #   bindkey "\e$key" _bash_complete-word
    #   bindkey "^X$key" _bash_list-choices
    # done
    #
    # If for some reason \e~ or ^X~ were already bound to something else,
    # that will not have been overridden, so you should add '~' to the
    # list of keys at the top of the for-loop.
    
    eval "$_comp_setup"
    
    local key=$KEYS[-1] expl
    
    case $key in
      '!') _main_complete _command_names
           ;;
      '$') _main_complete - parameters _wanted parameters expl 'exported parameters' \
                                           _parameters -g '*export*'
           ;;
      '@') _main_complete _hosts
           ;;
      '/') _main_complete _files
           ;;
      '~') _main_complete _users
           ;;
      *) _message "Key $key is not understood"
         ;;
    esac
    PK[FAppfunctions/zfanonnuW+A# function zfanon {
    
    emulate -L zsh
    
    [[ $curcontext = :zf* ]] || local curcontext=:zfanon
    local opt opt_1 dir
    
    while getopts :1 opt; do
      [[ $opt = "?" ]] && print "zfanon: bad option: -$OPTARG" >&2 && return 1
      eval "opt_$opt=1"
    done
    (( OPTIND > 1 )) && shift $(( OPTIND - 1 ))
    
    if [[ -z $EMAIL_ADDR ]]; then
      # Exercise in futility.  There's a poem by Wallace Stevens
      # called something like `N ways of looking at a blackbird',
      # where N is somewhere around 0x14 to 0x18.  Now zftp is
      # ashamed to present `N ways of looking at a hostname'.
      local domain host
      # First, maybe we've already got it.  Zen-like.
      if [[ $HOST = *.* ]]; then
        # assume this is the full host name
        host=$HOST
      elif [[ -f /etc/resolv.conf ]]; then
        # Next, maybe we've got resolv.conf.
        domain=${${=${(M)${(f)"$(/dev/null)"}:#Name:*}}[2]}
      if [[ -z $host ]]; then
        # we're running out of ideas, but this should work.
        # after all, i wrote it...
        # don't want user to know about this, too embarrassed.
        local oldvb=$ZFTP_VERBOSE oldtm=$ZFTP_TMOUT
        ZFTP_VERBOSE=
        ZFTP_TMOUT=5
        if zftp open $host >& /dev/null; then
          host=$ZFTP_HOST
          zftp close $host
        fi
        ZFTP_VERBOSE=$oldvb
        ZFTP_TMOUT=$oldtm
      fi
      if [[ -z $host ]]; then
        print "Can't get your hostname.  Define \$EMAIL_ADDR by hand."
        return 1;
      fi
      EMAIL_ADDR="$USER@$host"
      print "Using $EMAIL_ADDR as anonymous FTP password."
    fi
    
    if [[ $1 = */* ]]; then
      1=${1##ftp://}
      dir=${1#*/}
      1=${1%%/*}
    fi
    
    if [[ $opt_1 = 1 ]]; then
      zftp open $1 anonymous $EMAIL_ADDR || return 1
    else
      zftp params $1 anonymous $EMAIL_ADDR
      zftp open || return 1
    fi
    
    if [[ -n $dir ]]; then
      zfcd $dir
    fi
    # }
    PK[_|}}functions/ztodonuW+A# vim: set ft=zsh et sw=2 sts=2:
    
    emulate -L zsh
    setopt no_sh_word_split null_glob no_ksh_arrays
    typeset -gHA __ztodolist
    typeset -gH __ztodolastwrite
    local cachefile short_format list_format
    local tmp needupdate=0
    local -a todos
    
    zstyle -s ':ztodo:*' cache-file cachefile ||
      cachefile="~/.ztodolist"
    zstyle -s ':ztodo:*' short-format short_format ||
      short_format="You have %n thing%1(n..s) to do here."
    zstyle -s ':ztodo:*' list-format list_format ||
      list_format="%-2n: %e"
    
    tmp=(${~tmp::=$cachefile(ms-$(( ${(%)tmp::="%D{%s}"} - ${__ztodolastwrite:-0} )))})
    (( $#tmp )) &&
      . $~cachefile
    
    todos=( ${(ps:\0:)__ztodolist[$PWD]} )
    
    if (( $# )); then
      case "$1" in
        (add)
          shift
          todos=( $todos "$*" )
          needupdate=1
          ;;
        (del)
          shift
          todos[$1]=()
          needupdate=1
          ;;
        (clear)
          shift
          todos=()
          needupdate=1
          ;;
        (list)
          shift
          local i
          for (( i = 1; i <= $#todos; i++ )); do
            zformat -f tmp $list_format n:$i e:"${todos[$i]//\%/%%}"
            print -P "$tmp"
          done
          ;;
      esac
    else
      if [[ $#todos -gt 0 ]]; then
        zformat -f tmp $short_format n:$#todos
        print -P "$tmp"
      fi
    fi
    
    (( $#todos )) &&
      __ztodolist[$PWD]=${(pj:\0:)todos} ||
      unset "__ztodolist[$PWD]"
    (( needupdate )) &&
      print -r "__ztodolist=( ${(kv@qq)^^__ztodolist} )" > ${~cachefile}
    __ztodolastwrite="${(%)tmp::="%D{%s}"}"
    PK[wfunctions/zfherenuW+A# function zfhere {
    # Change to the directory corresponding to $PWD on the server.
    # See zfcd for how this works.
    [[ $curcontext = :zf* ]] || local curcontext=:zfhere
    zfcd $PWD
    # }
    PK[ISMFMFfunctions/_tlanuW+A#compdef tla
    
    autoload -z is-at-least
    local TLA=$words[1]
    local tla_version
    local hide_short
    
    # ask the user which version of tla this is
    if ! zstyle -s ":completion:${curcontext}" tla-version tla_version; then
      # ask tla instead
      tla_version="$($TLA --version)"
      if [[ "${${(f)tla_version}[1]}" == The\ GNU\ Arch\ Revision\ Control\ System\ \(tla\)\ (#b)([0-9.]##) ]]; then
        tla_version="$match[1]"
      else
        tla_version="${${$($TLA --version)#tla tla-}%% from regexps.com*}"
        [[ $tla_version == *[a-zA-Z]* ]] && tla_version=1.3 # tla doesn't know
      fi
    fi
    
    # test whether to hide short options from completion
    if zstyle -s ":completion:${curcontext}" hide-shortopts hide_short; then
      case $hide_short in
        true|yes|on|1) hide_short='!' ;;
        *) hide_short='' ;;
      esac
    fi
    
    # completion functions
    
    (( $+functions[_tla_archives] )) ||
    _tla_archives () { _arch_archives tla "$@" }
    
    (( $+functions[_tla_categories] )) ||
    _tla_categories () { _arch_namespace tla 1 "$argv[@]" }
    
    (( $+functions[_tla_branches] )) ||
    _tla_branches () {_arch_namespace tla 2 "$argv[@]" }
    
    (( $+functions[_tla_versions] )) ||
    _tla_versions () { _arch_namespace tla 3 "$argv[@]" }
    
    (( $+functions[_tla_revisions] )) ||
    _tla_revisions () { _arch_namespace tla 4 "$argv[@]" }
    
    (( $+functions[_tla_local_revisions] )) ||
    _tla_local_revisions () {
      local expl1 expl2 tree_version=`$TLA tree-version`
      _description -V applied-patches expl1 "patches from this version"
      _description -V other-patches expl2 "patches from other versions"
      compadd "$expl1[@]" `$TLA logs`
      compadd "$expl2[@]" `$TLA logs --full $($TLA log-versions | grep -v $tree_version)`
      # This is incredibly slow.
      # Should complete based on -A, -R, -d
    }
    
    (( $+functions[_tla_config] )) ||
    _tla_config () {
    
      # zsh 4.1.1+ is recommended; 4.0.6 gives the error below when doing
      # tla build-config e
      # _path_files:322: no matches found: configs//e/.(/)
      # whereas 4.1.1 completes correctly
    
      local configdir root ret=1 n expl
    
      n=$opt_args[(i)(-d|--dir)]
      [[ -n "$n" ]] && configdir=$opt_args[$n]
      root="$(_call_program tla $TLA tree-root ${configdir} 2>&1)"
      if (( $? )); then
        _message -e messages "Error: $root"
        return $ret
      fi
    
      if [[ -d "$root/configs" ]]; then
        configdir=("$root/configs")
        _description files expl '%Bconfig file%b'
        _files -W configdir "$expl[@]" && ret=0
      else
        _message -e messages "No configs/ directory in tree whose root is $root"
      fi
      return $ret
    }
    
    (( $+functions[_tla_limit] )) ||
    _tla_limit () { #presently only does push-mirror style limits
      [[ $words[$CURRENT] == *@* ]] && return 1
    
      local expl archive
      archive=${words[(r)*@*]:-$($TLA my-default-archive 2> /dev/null)}
      if [ $archive ]; then
    
        if [[ $PREFIX != *--* ]]; then
          _description -V categories expl "categories in $archive"
          compadd -q -S -- "$expl[@]" `$TLA categories -A $archive`
        else
          _tla_namespace_branches 3
        fi
      fi
    }
    
    (( $+functions[_tla_tree_or_rev] )) ||
    _tla_tree_or_rev () {
      _alternative 'trees:tree:_files -/' 'revisions:revision:_tla_revisions'
    }
    
    (( $+functions[_tla_libraries] )) ||
    _tla_libraries () {
      local libraries expl
      libraries=($(_call_program tla $TLA my-revision-library))
      _description -V libraries expl "revision libraries"
      compadd "$expl[@]" -a libraries
    }
    
    (( $+functions[_tla_my_revision_library] )) ||
    _tla_my_revision_library () {
      if [[ -n $words[(r)-d] ]] || [[ -n $words[(r)--delete] ]]; then
        _tla_libraries
      else
        _files -/
      fi
    }
    
    (( $+functions[_tla_log_versions] )) ||
    _tla_log_versions () {
      local logs expl
      if is-at-least 1.1 $tla_version; then
        logs=($(_call_program tla $TLA log-versions))
      else
        logs=($(_call_program tla $TLA logs))
      fi
      _description -V versions expl "log versions"
      compadd "$expl[@]" -a logs
    }
    
    # command argument definitions
    # commands with different versions
    
    local cmd_register_archive cmd_archives cmd_ls_archives cmd_redo
    local cmd_redo_changes cmd_changes cmd_what_changed cmd_categories
    local cmd_branches cmd_versions cmd_cacherev cmd_logs cmd_log_versions
    local cmd_log_ls cmd_update cmd_join_branch cmd_replay cmd_deltapatch
    local cmd_delta_patch cmd_apply_delta cmd_sync_tree cmd_make_sync_tree
    local cmd_delta cmd_revdelta cmd_library_categories cmd_library_branches
    local cmd_library_versions cmd_library_revisions
    local cmd_archive_register
    
    cmd_log_ls=('*:version:_tla_log_versions')
    cmd_log_versions=()
    # the options should only complete items that are in the tree
    
    if is-at-least 1.1 $tla_version; then
      cmd_register_archive=('::archive:_tla_archives' ':location:_files -/')
      cmd_archive_register=($cmd_register_archive)
      cmd_archives=('::regex:')
      cmd_redo=('::changeset:_files -/')
      cmd_changes=('::revision:_tla_revisions'
        #  ':separator:(--)' '*::limit:_files'
        #don't understand the limit usage
      )
      cmd_categories=('::archive:_tla_archives')
      cmd_branches=('::category:_tla_categories')
      cmd_versions=('::branch:_tla_branches')
      cmd_cacherev=('::revision:_tla_revisions')
      #should only complete non-cached revisions
    
      cmd_logs=($cmd_log_ls)
      cmd_update=('::revision:_tla_revisions')
      cmd_join_branch=(':revision:_tla_revisions')
      #should only complete continuation revisions
    
      cmd_replay=('*::revision:_tla_revisions')
      cmd_deltapatch=(':FROM:_tla_tree_or_rev' ':TO:_tla_tree_or_rev')
      cmd_sync_tree=(':revision:_tla_revisions')
      cmd_delta=(':FROM:_tla_tree_or_rev' ':TO:_tla_tree_or_rev' '::DEST:_files -/')
      cmd_library_categories=('::archive:_tla_archives --library')
      cmd_library_branches=('::category:_tla_categories --library')
      cmd_library_versions=('::branch:_tla_branches --library')
      cmd_library_revisions=('::version:_tla_versions --library')
    else
      cmd_register_archive=(':archive:_tla_archives' ':location:_files -/')
      cmd_archives=()
      cmd_redo=()
      cmd_changes=('::revision:_tla_revisions')
      cmd_categories=()
      cmd_branches=(':category:_tla_categories')
      cmd_versions=(':branch:_tla_branches')
      cmd_cacherev=(':revision:_tla_revisions' '::dir:_files -/')
      cmd_logs=($cmd_log_versions)
      cmd_update=(':dir:_files -/' '::newdir:_files -/'
        '::revision:_tla_revisions')
      cmd_join_branch=(':dir:_files -/' '::newdir:_files -/'
        ':revision:_tla_revisions')
      cmd_replay=(':dir:_files -/' '::newdir:_files -/' '::revision:_tla_revisions')
      cmd_deltapatch=(':FROM:_tla_tree_or_rev' ':TO:_tla_tree_or_rev'
        ':UPON:_tla_tree_or_rev' '::DEST:_files -/')
      cmd_sync_tree=(':dir:_files -/' '::newdir:_files -/'
        ':revision:_tla_revisions')
      cmd_delta=(':FROM:_tla_tree_or_rev' ':TO:_tla_tree_or_rev')
      cmd_library_categories=()
      cmd_library_branches=(':category:_tla_categories --library')
      cmd_library_versions=(':branch:_tla_branches --library')
      cmd_library_revisions=(':version:_tla_versions --library')
    fi
    
    cmd_ls_archives=($cmd_archives)
    cmd_redo_changes=($cmd_redo)
    cmd_what_changed=($cmd_changes)
    cmd_delta_patch=($cmd_deltapatch)
    cmd_apply_delta=($cmd_deltapatch)
    cmd_make_sync_tree=($cmd_sync_tree)
    cmd_revdelta=($cmd_delta)
    
    # commands the same in all versions
    
    local cmd_help
    cmd_help=()
    
    local cmd_my_id
    cmd_my_id=('::id-string:')
    
    local cmd_my_default_archive
    cmd_my_default_archive=('::archive:_tla_archives')
    
    local cmd_whereis_archive
    cmd_whereis_archive=(':archive:_tla_archives')
    
    local cmd_init_tree
    cmd_init_tree=('::version:_tla_versions')
    
    local cmd_tree_root
    cmd_tree_root=('::directory:_files -/')
    
    local cmd_tree_version
    cmd_tree_version=('::directory:_files -/')
    
    local cmd_set_tree_version
    cmd_set_tree_version=(':version:_tla_versions')
    
    local cmd_build_config cmd_buildcfg
    cmd_build_config=(':config:_tla_config')
    cmd_buildcfg=($cmd_build_config)
    
    local cmd_cat_config cmd_catcfg cmd_cfgcat
    cmd_cat_config=(':config:_tla_config')
    cmd_catcfg=($cmd_cat_config)
    cmd_cfgcat=($cmd_cat_config)
    
    local cmd_undo cmd_undo_changes
    cmd_undo=('::revision:_tla_revisions')
    cmd_undo_changes=($cmd_undo)
    
    local cmd_file_diffs
    cmd_file_diffs=(':file:_files' '::revision:_tla_revisions')
    
    local cmd_file_find
    cmd_file_find=(':file:_files' '::revision:_tla_revisions')
    
    local cmd_inventory cmd_srcfind
    cmd_inventory=('::separator:(--)' '*:directory:_files -/')
    cmd_srcfind=($cmd_inventory)
    
    local cmd_tree_lint cmd_lint
    cmd_tree_lint=('::directory:_files -/')
    cmd_lint=($cmd_tree_lint)
    
    local cmd_id cmd_invtag
    cmd_id=('*:file:_files')
    cmd_invtag=($cmd_id)
    
    local cmd_id_tagging_method cmd_tagging_method methods
    cmd_id_tagging_method=('::tagging method:(($methods))')
    methods=(
      'names:use naming conventions only'
      'implicit:use naming conventions but permit for inventory tags'
      'tagline:use naming conventions but permit for inventory tags'
      'explicit:require explicit designation of source'
    )
    cmd_tagging_method=($cmd_id_tagging_method)
    
    local cmd_add cmd_add_id cmd_add_tag
    cmd_add=('*:files to add:_files')
    cmd_add_id=($cmd_add)
    cmd_add_tag=($cmd_add)
    
    local cmd_delete cmd_delete_id cmd_delete_tag
    cmd_delete=('*:files to delete:_files')
    cmd_delete_id=($cmd_delete)
    cmd_delete_tag=($cmd_delete)
    
    local cmd_move cmd_move_id cmd_move_tag
    cmd_move_id=(':old name:_files' ':new name:_files')
    cmd_move_id=($cmd_move)
    cmd_move_tag=($cmd_move)
    #would be nice not to offer dirs for newname if oldname is a file, and
    #vice versa
    
    local cmd_mv
    cmd_mv=('*:file:_files')
    # not really right, but close enough
    
    local cmd_default_id cmd_explicit_default cmd_default_tag
    cmd_default_id=('::TAG-PREFIX:')
    cmd_explicit_default=($cmd_default_id)
    cmd_default_tag=($cmd_default_id)
    
    local cmd_tagging_defaults cmd_id_tagging_defaults
    cmd_tagging_defaults=()
    cmd_id_tagging_defaults=($cmd_tagging_defaults)
    
    local cmd_changeset cmd_mkpatch
    cmd_changeset=(
      ':ORIG:_files -/'
      ':MOD:_files -/'
      ':DEST:_files -/'
      '*:files:_files'
    )
    cmd_mkpatch=("$cmd_changeset[@]")
    
    local cmd_dopatch cmd_do_changeset cmd_apply_changeset
    cmd_dopatch=(':changeset:_files -/' ':target:_files -/')
    cmd_do_changeset=($cmd_dopatch)
    cmd_apply_changeset=($cmd_dopatch)
    
    local cmd_show_changeset
    cmd_show_changeset=('::changeset:_files -/')
    
    local cmd_make_archive
    cmd_make_archive=('::name:' ':location:_files -/')
    
    local cmd_archive_setup
    cmd_archive_setup=('*:versions:_tla_branches --trailing-dashes')
    
    local cmd_make_category
    cmd_make_category=(':category:_tla_archives -S /')
    
    local cmd_make_branch
    cmd_make_branch=(':branch:_tla_categories --trailing-dashes')
    
    local cmd_make_version
    cmd_make_version=(':version:_tla_branches --trailing-dashes')
    
    local cmd_import cmd_imprev
    cmd_import=('::version:_tla_versions')
    cmd_imprev=($cmd_import)
    
    local cmd_commit cmd_cmtrev
    cmd_commit=('::version:_tla_versions' ':separator:(--)' '*:files:_files')
    cmd_cmtrev=($cmd_commit)
    
    local cmd_get cmd_getrev
    cmd_get=(':revision:_tla_revisions' '::directory:_files -/')
    cmd_getrev=($cmd_get)
    
    local cmd_get_patch cmd_get_changeset
    cmd_get_patch=(':revision:_tla_revisions' '::dir:_files -/')
    cmd_get_changeset=($cmd_get_patch)
    
    local cmd_lock_revision
    cmd_lock_revision=(':revision:_tla_revisions')
    
    local cmd_push_mirror cmd_archive_mirror
    cmd_push_mirror=(
      '::FROM or MINE:_tla_archives'
      '::TO:_tla_archives'
      '::LIMIT:_tla_limit'
    )
    cmd_archive_mirror=($cmd_push_mirror)
    
    local cmd_revisions
    cmd_revisions=('::version:_tla_versions')
    
    local cmd_ancestry
    cmd_ancestry=('::revision:_tla_revisions')
    
    local cmd_ancestry_graph
    cmd_ancestry_graph=('::revision:_tla_revisions')
    
    local cmd_cat_archive_log
    cmd_cat_archive_log=(':revision:_tla_revisions')
    
    local cmd_cachedrevs
    cmd_cachedrevs=(':version:_tla_versions')
    
    local cmd_uncacherev
    cmd_uncacherev=(':revision:_tla_revisions' '::dir:_files -/')
    
    local cmd_archive_meta_info
    cmd_archive_meta_info=(':item-name:((name\:foo mirror\:bar))')
    
    local cmd_archive_snapshot
    cmd_archive_snapshot=(':dir:_files -/' '::limit:_tla_revisions')
    
    local cmd_archive_version
    cmd_archive_version=()
    
    local cmd_archive_fixup
    cmd_archive_fixup=()
    
    local cmd_make_log
    cmd_make_log=('::version:_tla_versions')
    
    local cmd_add_log cmd_add_log_version
    cmd_add_log=(':version:_tla_versions')
    cmd_add_log_version=($cmd_add_log)
    
    local cmd_remove_log cmd_remove_log_version
    cmd_remove_log=(':version:_tla_log_versions')
    cmd_remove_log_version=($cmd_remove_log)
    
    local cmd_abrowse
    cmd_abrowse=('::LIMIT:_tla_revisions')
    
    local cmd_cat_log
    cmd_cat_log=(':revision-spec:_tla_local_revisions')
    
    local cmd_changelog
    cmd_changelog=('::version:_tla_versions')
    
    local cmd_log_for_merge
    cmd_log_for_merge=('::version:_tla_versions')
    
    local cmd_merges
    cmd_merges=(':INTO:_tla_revisions' '::FROM:_tla_revisions')
    
    local cmd_new_merges
    cmd_new_merges=('::version:_tla_versions')
    
    local cmd_tag cmd_tagrev cmd_branch
    cmd_tag=(':SOURCE-REVISION:_tla_revisions' ':TAG-VERSION:_tla_versions')
    cmd_tagrev=($cmd_tag)
    cmd_branch=($cmd_tag)
    
    local cmd_star_merge
    cmd_star_merge=(':FROM:_tla_revisions')
    
    local cmd_missing cmd_whats_missing
    cmd_missing=('::revision:_tla_revisions')
    cmd_whats_missing=($cmd_missing)
    
    local cmd_pristines cmd_ls_pristines
    cmd_pristines=('::limit:_tla_revisions')
    cmd_ls_pristines=($cmd_pristines)
    
    local cmd_lock_pristine
    cmd_lock_pristine=(':revision:_tla_revisions')
    
    local cmd_add_pristine
    cmd_add_pristine=(':revision:_tla_revisions')
    
    local cmd_find_pristine
    cmd_find_pristine=(':revision:_tla_revisions')
    
    local cmd_my_revision_library cmd_library_dir
    cmd_my_revision_library=(':library:_tla_my_revision_library')
    cmd_library_dir=($my_revision_library)
    
    local cmd_library_find
    cmd_library_find=(':revision:_tla_revisions --library')
    
    local cmd_library_add
    cmd_library_add=(':revision:_tla_revisions --exclude-library-revisions')
    
    local cmd_library_remove
    cmd_library_remove=(':revision:_tla_revisions --library')
    
    local cmd_library_archives
    cmd_library_archives=()
    
    local cmd_library_log
    cmd_library_log=(':revision:_tla_revisions --library')
    
    local cmd_library_file
    cmd_library_file=(':file:_files' ':revision:_tla_revisions --library')
    
    local cmd_grab
    cmd_grab=(':location:_files')
    
    local cmd_parse_package_name
    cmd_parse_package_name=(':name:')
    
    local cmd_valid_package_name
    cmd_valid_package_name=(':name:')
    
    local cmd_library_config
    cmd_library_config=(':library:_tla_libraries')
    
    local cmd_rbrowse
    cmd_rbrowse=('::regular expression:')
    
    local cmd_rm
    cmd_rm=('*:file:_files')
    
    local cmd_escape
    cmd_escape=(':string:')
    
    local cmd_diff
    cmd_diff=('::revision:_tla_revisions')
    
    local cmd_export
    cmd_export=(':revision:_tla_revisions' ':dir:_files -/')
    
    #mutually exclusive options
    
    local -A excludes
    excludes=(
    # This first line means that if --output was given, don't complete
    # --no-output or --keep. The converse is not true.
    --output '--no-output --keep'
    --no-output --output
    
    --silent  '         --quiet --report --verbose --debug'
    --quiet   '--silent         --report --verbose --debug'
    --report  '--silent --quiet          --verbose --debug'
    --verbose '--silent --quiet --report           --debug'
    --debug   '--silent --quiet --report --verbose        '
    
    --sparse --non-sparse
    --non-sparse --sparse
    
    --files       '        --directories --both'
    --directories '--files               --both'
    --both        '--files --directories       '
    
    --mirror --mirror-from
    --mirror-from --mirror
    
    --no-cached --cached-tags
    --cached-tags --no-cached
    
    --non-greedy --greedy
    --greedy --non-greedy
    )
    
    _tla_main () {
      typeset -A opt_args
      local arguments
      if (( CURRENT > 2 )); then
        local cmd=${words[2]}
        local var_cmd=cmd_${cmd//-/_}
        curcontext="${curcontext%:*:*}:tla-$cmd:"
        (( CURRENT-- ))
        shift words
    
        arguments=()
        local input
        input=(${${(M)${(f)"$($TLA $cmd -h)"}:#  *}#  })
    
        local i j=1
        local short long arg desc action
        short=()
        long=()
        arg=()
        desc=()
        action=()
        for (( i=1 ; i <= ${#input} ; i++ )); do
          [[ "$input[i]" != *[^\ ]* ]] && continue # stupid blank lines
          short[j]="${${${input[i]}[1,2]}#--}"
          long[j]="${${input[i]#-?, }%% *}"
    
          arg[j]="${${${input[i]%%  *}##* }##-*}"
          [[ $long[j] == --archive ]] && arg[j]=ARCHIVE # tla doesn't mention this
    
          desc[j]="${input[i]##*  }"
          if [[ "$input[i+1]" == \ *[^\ ]* ]]; then # description continues
            (( i++ ))
            desc[j]="$desc[j] ${input[i]##*  }"
          fi
          [[ "$short[j]" == -[hHV] ]] && continue
          desc[j]="${${desc[j]//\[/\\[}//\]/\\]}" # escape brackets
    
          case $arg[j] in
          DIR|PATCH-DIR|DEST|OUTPUT|PATH)
            action[j]='_files -/' ;;
          FILES|FILE|SNAP-FILE)
            action[j]='_files' ;;
          MASTER|MASTER-SOURCE|ARCHIVE)
            action[j]='_tla_archives' ;;
          CATEGORY)
            action[j]='_tla_categories' ;;
          BRANCH)
            action[j]='_tla_branches' ;;
          VERSION)
            action[j]='_tla_versions' ;;
          CFG)
            action[j]='_tla_configs' ;;
          LIB)
            action[j]='_tla_libraries' ;;
    #      PATCH,FILE) # not sure how to complete this
    #        action[j]='_tla_patch_file' ;;
          *)
            action[j]='' ;;
          esac
    
          (( j++ ))
    
        done
    
        local excluded k
        for (( i = 1 ; i < j ; i++ )); do
          excluded=($short[i] $long[i])
          foreach opt (${=excludes[$long[i]]})
            k=$long[(i)$opt]
            excluded=($excluded $short[k] $long[k])
            #excludes matching short options too :-)
          end
    
    
          # generate arguments to _arguments ;-)
          # make long and short options mutually exclusive
          [ $short[i] ] && arguments=("$arguments[@]"
            "${hide_short}(${excluded})${short[i]}[${desc[i]}]${arg[i]:+:$arg[i]:$action[i]}")
          [ $long[i] ] && arguments=("$arguments[@]"
            "(${excluded})${long[i]}[${desc[i]}]${arg[i]:+:$arg[i]:$action[i]}")
        done
    
        arguments=("$arguments[@]" "${(@P)var_cmd-*:FILE:_files}")
      else
        local help
        local -U cmds
        help=(${(f)"$($TLA help)"})
        cmds=(${${${${(M)help:#* :*}/ #: #/:}%% ##}## #})
        arguments=(':commands:(($cmds))')
      fi
      _arguments -S -A '-*' \
        {"${hide_short}(: -)-V",'(: -)--version'}'[display version]' \
        {"${hide_short}(: -)-h",'(: -)--help'}'[display help]' \
        '(: -)-H[display verbose help]' \
        "$arguments[@]"
    }
    
    _tla_main "$@"
    PK[45hhfunctions/_jobs_builtinnuW+A#compdef jobs
    
    _arguments -C -s \
      "(-d -l -p -r -s *)-Z[specify string to replace shell's argument and environment with]:string" \
      '(-Z)-d[show directory from which each job was started]' \
      '(-Z)-l[list process IDs]' \
      '(-Z)-p[list process groups]' \
      '(-Z -s)-r[list only running jobs]' \
      '(-Z -r)-s[list only stopped jobs]' \
      '(-Z)*::job:_jobs'
    PK[
    
    functions/_xauthnuW+A#compdef xauth
    
    local state context line expl ret=1
    typeset -A opt_args
    local tmp cmd
    
    _arguments -s \
      '-f[specify authfile]:authfile:_files' \
      '(-q)-v[verbose mode]' \
      '(-v)-q[quiet mode]' \
      '-b[break locks]' \
      '-i[ignore locks]' \
      '*::command:->command' && ret=0
    
    while [[ -n "$state" ]]; do
      tmp="$state"
      state=
      case "$tmp" in
      command)
        if (( CURRENT == 1 )); then
          state=subcommands
        else
          cmd="$words[1]"
          curcontext="${curcontext%:*:*}:xauth-${cmd}:"
          case "$cmd" in
          add)
    	_arguments \
    	  ':display name:->displayname' \
    	  ':protocol name:->protocolname' \
    	  ':hexkey:' && ret=0
    	;;
    
          generate)
            if (( CURRENT == 2 )); then
    	  state=displayname
            elif (( CURRENT == 3 )); then
    	  state=protocolname
    	else
    	  case "$words[CURRENT-1]" in
    	  timeout) _message -e values 'timeout (seconds)';;
    	  group) _message -e ids 'group-id';;
    	  data) _message -e values 'hexdata';;
    	  *) 
    	    _wanted options expl 'xauth generate options' \
    	      compadd trusted untrusted timeout group data && ret=0
    	    ;;
    	  esac
    	fi
    	;;
    
          extract|nextract)
    	case "$CURRENT" in
    	2) _wanted files expl 'filename to write auth data' _files && ret=0;;
    	*) state=displayname;;
    	esac
            ;;
    
          list|nlist)
    	state=displayname
            ;;
    
          merge|nmerge)
    	_wanted files expl 'filename to read auth data' _files && ret=0
    	;;
    
          remove)
            state=displayname
    	;;
    
          source)
    	_wanted files expl 'filename to source' _files && ret=0
    	;;
    
          info|exit|quit|\?)
            ;;
    
          help)
            state=subcommands
    	;;
          esac
        fi
        ;;
    
      subcommands)
        tmp=(
          'add:add entry'
          'generate:use server to generate entry'
          'extract:extract entries into file'
          'nextract:numerically extract entries'
          'list:list entries'
          'nlist:numerically list entries'
          'merge:merge entries from files'
          'nmerge:numerically merge entries'
          'remove:remove entries'
          'source:read commands from file'
          'info:print information about entries'
          'exit:save changes and exit program'
          'quit:abort changes and exit program'
          'help:print help'
          '?:list available commands'
        )
        _describe 'xauth command' tmp -- && ret=0
        ;;
    
      protocolname)
        _wanted values expl 'authorization protocol' \
          compadd MIT-MAGIC-COOKIE-1 XDM-AUTHORIZATION-1 SUN-DES-1 MIT-KERBEROS-5 && ret=0
        ;;
    
      displayname)
        { _wanted values expl 'display name' \
            compadd - ${${(f)"$(xauth list)"}%% *} || _x_display } && ret=0
        ;;
      esac
    done
    
    return ret
    PK[+functions/_zlenuW+A#compdef zle
    
    local expl ret=1
    local -a opts compwids state line context
    
    compwids=(accept-and-menu-complete
    	  complete-word
    	  delete-char-or-list
    	  expand-or-complete
    	  expand-or-complete-prefix
    	  list-choices
    	  menu-complete
    	  menu-expand-or-complete
    	  reverse-menu-complete)
    
    opts=(-A -C -D -L -M -N -R -U -a -c -l \* :)
    
    _arguments -s -S \
        "($opts)-A[define widget alias]:old widget:->widget :new widget:->widget" \
        "($opts)-C[define completion widget]:new widget name:->comp-widget :completion widget:->builtin-comp-widget :widget shell function:->function" \
        "($opts)-D[delete widget]:*:widget:->widget" \
        \(${(j. .)opts:#-l}')-L[with -l, list as commands]' \
        \(${(j. .)opts:#-[La]}')-l+[list user-defined widgets]:*:-:->listing' \
        \(${(j. .)opts:#-l}')-a[with -l, list all widgets]' \
        "($opts)-M[display message]:message: " \
        "($opts)-N[define new widget]:widget name:->widget-or-function ::widget shell function:->function" \
        \(${(j. .)opts:#-c}')-R+[redisplay]:*:-:->redisplay' \
        \(${(j. .)opts:#-R}')-c[with -R, clear listing]' \
        "($opts)-U[unget to input stack]:string: " \
        '(-):widget:->widget' \
        '(-)*::widget args:->args' && ret=0
    
    [[ $state == listing ]] &&
      _arguments -s -S '!-l' \
        "(-a)-L[list as commands]" \
        "(-L)-a[list all widgets]" \
        '*:widget name:->widget' && ret=0
    
    case "$state[1]" in
      (args)
        _arguments \
          '(-N)-n[numeric prefix]:number:' \
          '(-n)-N[reset numeric prefix]' \
          '(-)*:widget arguments: ' && ret=0
        ;;
      (widget*)
        _wanted -C "$context[1]" widgets expl widget compadd -k widgets && ret=0
        ;&
      (function)
        [[ $state[1] != *function ]] ||	# Handle fall-through
        _wanted -C "$context[1]" functions expl 'widget shell function' \
          compadd -k functions && ret=0
        ;;
      (comp-widget)
        _wanted -C "$context[1]" widgets expl 'completion widget' \
          compadd -k "widgets[(R)(*:|)(.|)(${(j(|))compwids})(|:*)]" && ret=0
        ;&
      (builtin-comp-widget)
        _wanted -C "$context[1]" widgets expl 'builtin completion widget' \
          compadd -k "widgets[(I)(.|)(${(j(|))compwids})]" && ret=0
        ;;
      (redisplay)
        _arguments -s -S '!-R' \
          "-c[clear listing]" \
          ":status line" "*:strings to list" && ret=0
        ;;
    esac
    
    return ret
    PK[zG}}functions/_update-rc.dnuW+A#compdef update-rc.d
    
    local curcontext="$curcontext" state line expl
    
    _arguments -C \
      '-n[show actions without performing them]' \
      '-f[force removal of symlinks]' \
      '1:service:_services' \
      '2:command:(remove defaults start stop)' \
      '*::args:->args' && return
    
    case $words[2] in
      defaults)
        _message -e number 'sequence number'
      ;;
      remove)
        _message 'no more arguments'
      ;;
      st*)
        case ${words[CURRENT-1]} in
          .) _wanted commands expl commands compadd start stop && return ;;
          start|stop) _message -e number 'sequence number' ;;
          *) _message -e runlevels run\ level ;;
        esac
      ;;
    esac
    
    return 1
    PK[L>>>functions/compinitnuW+A# Initialisation for new style completion. This mainly contains some helper
    # functions and setup. Everything else is split into different files that
    # will automatically be made autoloaded (see the end of this file).  The
    # names of the files that will be considered for autoloading are those that
    # begin with an underscores (like `_condition).
    #
    # The first line of each of these files is read and must indicate what
    # should be done with its contents:
    #
    #   `#compdef '
    #     If the first line looks like this, the file is autoloaded as a
    #     function and that function will be called to generate the matches
    #     when completing for one of the commands whose  are given.
    #     The names may also be interspersed with `-T ' options
    #     specifying for which set of functions this should be added.
    #
    #   `#compdef -[pP] '
    #     This defines a function that should be called to generate matches
    #     for commands whose name matches . Note that only one pattern
    #     may be given.
    #
    #   `#compdef -k