1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2026-01-01 20:11:06 +01:00

Merge from trunk of files in 21315.

This commit is contained in:
Paul Ackersviller 2007-05-03 02:49:38 +00:00
parent 4bf9b65839
commit 26785dfe6b
48 changed files with 1796 additions and 5 deletions

View file

@ -0,0 +1,5 @@
#compdef dosread dosdel
local expl
_wanted floppyfiles expl 'file on floppy' compadd - ${$(dosdir)[1,-5]:l}

View file

@ -0,0 +1,38 @@
#compdef lsdev
local curcontext="${curcontext}" state line expl
_arguments -C \
'(-P)-C[list info about device in customized devices object class]' \
'(-C -l)-P[list info about device in predefined object class]' \
'-c[specify a device class]:device class:->classes' \
'-f[read flags from file]:file:_files' \
'-F[specify output format]:format:->columnnames' \
'-H[display headers above columns]' \
'-h[display command usage]' \
'(-P)-l[specify device logical name]:device logical name' \
'-r[display set of values in a column]:column name:->columnnames' \
'(-P)-S[specify a device state]:device state:(Available Defined Stopped)' \
'-s[specify a device subclass]:device subclass:->subclasses' \
'-t[specify a device type name]:device type name:->devtypes' && return 0
case $state in
classes)
_wanted devclasses expl 'device class name' \
compadd - $(lsdev ${words[(r)-[CP]]:--P} -r class)
;;
subclasses)
_wanted devsubclasses expl 'device subclass name' \
compadd - $(lsdev ${words[(r)-[CP]]:--P} -r subclass)
;;
devtypes)
_wanted devtypes expl 'device type name' \
compadd - $(lsdev ${words[(r)-[CP]]:--P} -r type)
;;
columnnames)
[[ $words[CURRENT-1] = -F ]] && compset -P '*[^a-zA-Z]'
_wanted devcolumnnames expl 'column name' \
compadd - ${(s: :)words[(r)-C]:+name status location} \
class subclass description type
;;
esac

View file

@ -0,0 +1,8 @@
#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'

View file

@ -0,0 +1,10 @@
#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'

View file

@ -0,0 +1,15 @@
#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[@]"

View file

@ -0,0 +1,6 @@
#compdef odmget odmshow odme
local expl
_wanted objectclasses expl 'object class' \
_files -W ${ODMDIR:-/etc/objrepos} -g '^*.vc(-.)' "$@" -

View file

@ -0,0 +1,6 @@
#autoload
local expl
_wanted physicalvolumes expl 'physical volume' \
compadd "$@" - $(lsdev -C -c disk -S a -F name)

View file

@ -0,0 +1,5 @@
#autoload
local expl
_wanted volumegroups expl 'volume group' compadd "$@" - $(lsvg)

View file

@ -0,0 +1,7 @@
#autoload
_retrieve_mac_apps
local expl
_wanted commands expl 'Mac OS X application' \
compadd "$@" - "${(@)${_mac_apps[@]:t}%.app}"

View file

@ -0,0 +1,104 @@
#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]' \
'(-b --no-bts-query)'{-b,--no-bts-query}'[do not check bts]' \
'(-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]' \
'(-n --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' \
"$_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

View file

@ -14,7 +14,7 @@ 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//:/|})(-.)" "$@"
_files "$@" -g "*.(#i)(${~formats//:/|})(-.)"
return
fi
@ -49,7 +49,7 @@ case "$service" in
'*-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:_x_font' \
'*-font:font:_x_font' \
'*-foreground:color:_x_color' \
'*-frame:border dimensions (<width>x<height>+<out>+<in>)' \
'*-gamma[gamma correction level]:gamma correction level (<n> or <red>/<green>/<blue>)' \
@ -84,7 +84,7 @@ case "$service" in
'*-shared_memory' \
'*-sharpen:sharpening factor (0.0 - 99.9%%)' \
'*-size:image size (<width>x<height>+<offset>)' \
'*-text_font:_x_font' \
'*-text_font:font:_x_font' \
'*-texture:background texture image:_imagemagick' \
'*-title:image title' \
'*-treedepth:color reduction tree depth' \
@ -117,7 +117,7 @@ case "$service" in
'*-depth:image depth:(8 16)' \
'*-display:display:_x_display' \
'*-dither[apply dithering]' \
'*-font:_x_font' \
'*-font:font:_x_font' \
'*-foreground:color:_x_color' \
'*-gamma[gamma correction level]:gamma correction level (<n> or <red>/<green>/<blue>)' \
'*+gamma[gamma correction level (don'\''t change pixels)]:gamma correction level (<n> or <red>/<green>/<blue>)' \
@ -138,7 +138,7 @@ case "$service" in
'*-scenes:image scene number' \
'*-shared_memory' \
'*-size:image size (<width>x<height>+<offset>)' \
'*-text_font:_x_font' \
'*-text_font:font:_x_font' \
'*-title:image title' \
'*-treedepth:color reduction tree depth' \
'*-trim' \

View file

@ -0,0 +1,586 @@
#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

View file

@ -0,0 +1,17 @@
#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'

View file

@ -0,0 +1,50 @@
#compdef links
local curcontext="$curcontext" state line ret=1
typeset -A opt_args
_arguments -C \
'(-help)-anonymous[restrict links so that it can run on an anonymous account]' \
'(-help)-assume-codepage[specify default codepage to use]:codepage' \
'(-help)-async-dns[asynchronous DNS resolver]:bool:((0\:on 1\:off))' \
'(-help)-download-dir[default download directory]:_files -/' \
'(-help)-driver[graphics driver to use]:graphics driver:->graphics_drivers' \
'(-help)-dump[dump the page as pure text]' \
'(-help)-format-cache-size[number of formatted document pages cached]:pages' \
'(-help)-ftp-proxy[specify ftp proxy server]:proxy:->proxies' \
'(-help)-g[run in graphics mode rather than plain text mode]' \
'-help[prints the help screen]' \
'(-help)-http-proxy[specify web proxy server]:proxy:->proxies' \
'(-help)-image-cache-size[image cache memory]:memory (kilobytes)' \
'(-help)-max-connections[maximum number of concurrent connections]:connections' \
'(-help)-max-connections-to-host[maximum number of concurrent connection to a given host]:connections' \
'(-help)-memory-cache-size[cache memory]:kilobytes' \
'(-help)-no-connect[runs links as a separate instance]' \
'(-help)-receive-timeout[timeout on receive]:timeout (seconds)' \
'(-help)-retries[number of retries]:retries' \
'(-help)-source[dump the source page]' \
'(-help)-unrestartable-receive-timeout[timeout on non restartable connections]:timeout (seconds)' \
'(-help)-version[prints the links version number and exit]' \
':URL:->html' && ret=0
case $state in
html)
_alternative 'files:file:_files -g "*.x#html(-.)"' 'urls:URL:_urls' && ret=0
;;
graphics_drivers)
local -a vals
vals=( ${=${${${(f)"$(_call_program links-graphics-drivers links -driver help 2>&1)"}[-1]}//','/''}} )
_describe -t links-graphics-drivers 'graphics driver' vals && ret=0
;;
proxies)
local suf=-S:
if compset -P '*:'; then
_message -e ports 'port number'
else
compset -S ':*' && suf=
_hosts $suf && ret=0
fi
;;
esac
return ret

View file

@ -0,0 +1,44 @@
#compdef lsof
_arguments -s -S \
'(-)'{-\?,-h}'[list help]' \
'-a[AND selections]' \
'-b[avoid kernel blocks]' \
'-C[disable reporting of path name components]' \
'-c[list files for command beginning with specified char]:char' \
'+d[search for open instances for contents of specified dir]:search directory:_files -/' \
'-d[specify list of file descriptors to exclude/include]:file descriptors' \
'+D[recursively search from specified dir]:search directory:_files -/' \
'-D[direct use of device cache file]:function:((\?\:report\ device\ cache\ file\ paths b\:build\ the\ device\ cache\ file i\:ignore\ the\ device\ cache\ file r\:read\ the\ device\ cache\ file u\:read\ and\ update\ the\ device\ cache\ file))' \
'-f[inhibit listing of kernel file structure info]::info type or path' \
'+f[enable listing of kernel file structure info]::info type' \
'-F[select output fields]:fields' \
'-g[select by process group id]::process group id' \
'*-i[select internet files]:address' \
'-k[specify kernel name list file]:kernel file:_files' \
'-l[inhibit conversion of UIDs to user names]' \
'-L[list no link counts]' \
'+L[list all link counts]::max link count for listed files' \
'-m[specify kernel memory file]:kernel memory file:_files' \
'-M[disable reporting of portmapper registrations]' \
'+M[enable reporting of portmapper registrations]' \
'-n[inhibit conversion of network numbers to hostnames]' \
'-N[select listing of NFS files]' \
'(-s)-o[list file offset]' \
'-O[avoid overheads of bypassing potential blocking]' \
'-P[inhibit conversion of port numbers to port names]' \
'-p[list files for specified processes]:process ID:_pids' \
'-r[repeat listing endlessly]::delay (seconds)' \
'+r[repeat listing until no files listed]::delay (seconds)' \
'-R[list parent PID]' \
'(-o)-s[list file size]' \
'-S[specify timeout for kernel functions that might deadlock]:timeout (seconds)' \
'-T[select reporting of TCP/TPI info]::info type:((q\:queue\ length\ reporting s\:state\ reporting w\:window\ size\ reporting))' \
'(+w -w)-t[terse output]' \
'-u[list files owned by specified users]:user:_users -S,' \
'-U[list Unix domain socket files]' \
'(-)-v[list version info]' \
'-V[indicate unsuccessfully searched for items]' \
'(-t)+w[suppress warnings]' \
'(-t)-w[enable warnings]' \
'*:file:_files'

View file

@ -0,0 +1,59 @@
#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

View file

@ -0,0 +1,68 @@
#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)"$(</etc/shells)"}:#\#*} )
else
shells=( ${(M)commands:#*/(|[abckz]|tc|ba)sh} )
fi
args=(
'(-D)-c+[comment]:comment'
"(-D)-${home}+[home directory]:home directory:_directories -W /"
'(-D)-e+[specify expiration date]:expiration date (YYYY-MM-DD)'
'(-D)-f+[specify inactive days]:inactive days'
'(-D)-g+[initial group]:initial group:_groups'
'(-D)-G+[supplementary groups]:supplementary group:_groups -S,'
"(-D)-s+[shell]:shell:( $shells /bin/false )"
'(-D -M)-m[create home directory]'
'(-D)-u[uid]:uid'
'(-D)-o[allow non unique uid]'
)
[[ $OSTYPE = linux* ]] && args+=(
'(-D -U -L)-p+[specify encrypted password]:encrypted password' )
if [[ $service = useradd ]]; then
(( redhat )) || args+=(
"(-D -k -m)-M[don't create home]"
'(-D)-r[create system account]'
"(-D)-n[don't create mirrored user]"
)
[[ $OSTYPE = linux* ]] || sun=" -s"
args+=(
"(-c -G -m -k -M -p -u -o -n -r$sun)-D[modify or display defaults]"
'(-D -M)-k[skeleton home directory]:skeleton directory:_directories -W /'
':username'
)
else
(( redhat )) || args=( $args[@]
"(-U -p)-L[lock user's password]"
"(-L -p)-U[unlock user's password]"
)
args+=(
'-l[specify new user name]:new username'
':username:_users'
)
fi
else
args=( '-g+[gid]:gid' '-o[allow non unique gid]' )
if [[ $service = groupadd ]]; then
args+=( ':group name' )
(( redhat )) || args=( $args[@]
'-r[create system group]'
'-f[force]'
)
else
args+=(
'-n[specify new group name]:new group name'
':group:_groups'
)
fi
fi
_arguments -A "-*" -s $args[@]

112
Completion/Unix/Command/_yp Normal file
View file

@ -0,0 +1,112 @@
#compdef ypcat ypmatch yppasswd ypwhich ypset ypserv ypbind yppush yppoll ypxfr domainname
local curcontext="$curcontext" line state expl ret=1
typeset -A opt_args
if (( ! $+_yp_cache_maps )); then
_yp_cache_maps=( "${(@)${(@f)$(_call_program maps ypwhich -m)}%% *}" )
_yp_cache_nicks=( "${(@)${(@)${(@f)$(_call_program names ypwhich -x)}#*\"}%%\"*}" )
_yp_args=(
'(-x)-d[specify domain]:domain name' \
'(-x)-k[display keys]' \
'(-x)-t[inhibit nicknames]' \
'(: -d -k -t)-x[display nicknames]' \
)
fi
case "$service" in
ypcat)
_arguments -C -s "$_yp_args[@]" ':map name:->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<TAB>' 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

View file

@ -0,0 +1,6 @@
#compdef zdump
_arguments \
'-v[lowest possible]' \
'-c[cutoff]:cutoff year:' \
'*:time zone:_time_zone'

View file

@ -0,0 +1,29 @@
#compdef -value-,TERMINFO_DIRS,-default- -P -value-,*PATH,-default-
# options:
# -s <sep> 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\-' "$@"

View file

@ -0,0 +1,20 @@
#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

View file

@ -0,0 +1,24 @@
#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
: ${(A)_cache_groups:=${${(M)${(f)"$(_call_program groups lookupd -q group)"}:#name*}##*: }}
elif (( ${+commands[getent]} )); then
: ${(A)_cache_groups:=${${(s: :)$(_call_program groups getent group 2>/dev/null)}%%:*}}
else
: ${(A)_cache_groups:=${${${(s: :)$(</etc/group)}%%:*}:#+}}
if (( ${+commands[ypcat]} )) &&
tmp=$(_call_program groups ypcat group.byname 2>/dev/null); then
_cache_groups+=( ${${(f)tmp}%%:*} ) # If you use YP
fi
fi
groups=( "$_cache_groups[@]" )
fi
_wanted groups expl group compadd -a "$@" - groups

View file

@ -0,0 +1,24 @@
#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
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

View file

@ -0,0 +1,32 @@
#autoload
#
# _perl_basepods - zsh completion function
#
# Adam Spiers <adam@spiers.net>
#
# 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

View file

@ -0,0 +1,119 @@
#compdef pmpath pmvers pmdesc pmload pmexp pmeth pmls pmcat pman pmfunc podgrep podtoc podpath
#
# _perl_modules - zsh completion function
#
# Adam Spiers <adam@spiers.net>
#
# 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.
#
# 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
zstyle -s ":completion:${curcontext}:" cache-policy update_policy
if [[ -z "$update_policy" ]]; then
zstyle ":completion:${curcontext}:" cache-policy \
_perl_modules_caching_policy
fi
if [[ $argv[-1] = -tP ]]; then
argv=("${(@)argv[1,-2]}")
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
local expl
_wanted modules expl 'Perl module' compadd "$@" -a - $perl_modules
}
_perl_modules_caching_policy () {
local _perllocals
# 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 "$@"

View file

@ -0,0 +1,54 @@
#compdef pflags pcred pmap pldd psig pstack pfiles pwdx pstop prun pwait ptree
# If given the `-m <pattern>' option, this tries to complete only pids
# of processes whose command line match the `<pattern>'.
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]= ;;
*) [[ ${#:-$PREFIX$SUFFIX} -gt ${#compstate[unambiguous]} ]] &&
compstate[insert]=menu ;;
esac
fi
return ret

View file

@ -0,0 +1,12 @@
#autoload
local expl ports
if ! zstyle -a ":completion:${curcontext}:" ports ports; then
(( $+_cache_ports )) ||
: ${(A)_cache_ports:=${${(M)${${(f)"$(</etc/services)"}:#\#*}#*/tcp}%%[ ]*}}
ports=( "$_cache_ports[@]" )
fi
_wanted ports expl port compadd -a "$@" - ports

View file

@ -0,0 +1,72 @@
#compdef -value-,PRINTER,-default- -value-,LPDEST,-default-
local expl ret=1 list disp sep tmp
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 (( ! $+_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 [[ $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

View file

@ -0,0 +1,18 @@
#autoload
local -a inits xinetds alls
local expl ret=1
if 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
_wanted services expl service compadd "$@" - /etc/init.d/*(-*:t) && ret=0
fi
return ret

View file

@ -0,0 +1,6 @@
#compdef tex latex slitex pdflatex jadetex pdfjadetex
local expl
_description files expl 'TeX or LaTeX file'
_files "$@" "$expl[@]" -g '*.(tex|TEX|texinfo|texi)(-.)'

View file

@ -0,0 +1,6 @@
#compdef -P (texi(2*|ndex))
local expl
_description files expl 'texinfo file'
_files "$@" "$expl[@]" -g '*.(texinfo|texi)(-.)'

View file

@ -0,0 +1,9 @@
#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 "$@" -

View file

@ -0,0 +1,18 @@
#autoload
local expl
if (( ! $+_cursor_cache )); then
local file
file=( /usr/{include,{{X11R6,openwin},local{,/X11{,R6}}}/include}/X11/cursorfont.h(N) )
if (( $#file )); then
_cursor_cache=( "${(@)${(@)${(M@)${(@f)$(< $file[1])}:#*XC_*}[2,-1]#* XC_}% *}" )
else
_cursor_cache=( X_cursor )
fi
fi
_wanted cursors expl 'cursor name' \
compadd "$@" -M 'm:-=_ r:|_=*' -a - _cursor_cache

View file

@ -0,0 +1,19 @@
#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

16
Completion/X/Type/_x_font Normal file
View file

@ -0,0 +1,16 @@
#autoload
local expl
_tags fonts || return 1
# This *has* to be improved some day...
if (( ! $+_font_cache )); then
typeset -gU _font_cache
_font_cache=( "${(@)^${(@f)$(_call_program fonts xlsfonts)}%%--*}--" )
fi
_wanted fonts expl font \
compadd -M 'r:|-=* r:|=*' "$@" -S '' -a - _font_cache

View file

@ -0,0 +1,22 @@
#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

View file

@ -0,0 +1,32 @@
#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'

View file

@ -0,0 +1,21 @@
#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'

View file

@ -0,0 +1,14 @@
#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

View file

@ -0,0 +1,5 @@
#compdef shift
local expl
_wanted arrays expl array _parameters "$@" - -g '*array*'

View file

@ -0,0 +1,29 @@
#autoload
local i fds expl list link sep
for i in {0..9}; [[ -e /dev/fd/$i ]] && fds+=( $i )
if zstyle -T ":completion:${curcontext}:" verbose && [[ -e /proc/$$/fd ]]; then
zstyle -s ":completion:${curcontext}:" list-separator sep || sep=--
if zmodload -e zsh/stat; then
for i in "${fds[@]}"; do
stat +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

View file

@ -0,0 +1,5 @@
#compdef unfunction
local expl
_wanted functions expl 'shell function' compadd -k "$@" - functions

View file

@ -0,0 +1,3 @@
#compdef bg
_jobs -s "$@"

View file

@ -0,0 +1,3 @@
#compdef disown fg
_jobs "$@"

View file

@ -0,0 +1,5 @@
#compdef unlimit
local expl
_wanted limits expl 'process limit' compadd "$@" - ${${(f)"$(limit)"}%% *}

View file

@ -0,0 +1,8 @@
#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

View file

@ -0,0 +1,10 @@
#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

View file

@ -0,0 +1,10 @@
#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