From 2598e0995abf3d3fadc226cbc282f25bfe8e6521 Mon Sep 17 00:00:00 2001 From: Paul Ackersviller Date: Wed, 2 May 2007 03:46:28 +0000 Subject: Merge of workers/{21302,21306,21310}. --- Completion/Unix/Command/_bogofilter | 130 +++++++++++++++++++++++++++++++++++ Completion/Unix/Command/_chkconfig | 28 ++++++++ Completion/Unix/Command/_chmod | 82 ++++++++++++++++++++++ Completion/Unix/Command/_gs | 57 ++++++++++++++++ Completion/Unix/Command/_look | 16 +++++ Completion/Unix/Command/_python | 38 +++++++++++ Completion/Unix/Command/_rar | 132 ++++++++++++++++++++++++++++++++++++ 7 files changed, 483 insertions(+) create mode 100644 Completion/Unix/Command/_bogofilter create mode 100644 Completion/Unix/Command/_chkconfig create mode 100644 Completion/Unix/Command/_chmod create mode 100644 Completion/Unix/Command/_gs create mode 100644 Completion/Unix/Command/_look create mode 100644 Completion/Unix/Command/_python create mode 100644 Completion/Unix/Command/_rar (limited to 'Completion/Unix/Command') diff --git a/Completion/Unix/Command/_bogofilter b/Completion/Unix/Command/_bogofilter new file mode 100644 index 000000000..9e6ac3f88 --- /dev/null +++ b/Completion/Unix/Command/_bogofilter @@ -0,0 +1,130 @@ +#compdef bogoutil bogotune bogofilter + +local expl ret bogotokens + +_bogoutil_caching_policy () { + + # 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 diff --git a/Completion/Unix/Command/_chkconfig b/Completion/Unix/Command/_chkconfig new file mode 100644 index 000000000..76da38d27 --- /dev/null +++ b/Completion/Unix/Command/_chkconfig @@ -0,0 +1,28 @@ +#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 diff --git a/Completion/Unix/Command/_chmod b/Completion/Unix/Command/_chmod new file mode 100644 index 000000000..3df93fd64 --- /dev/null +++ b/Completion/Unix/Command/_chmod @@ -0,0 +1,82 @@ +#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 + if zstyle -t ":completion:${curcontext}:" disable-stat; then + _files && ret=0 + else + zmodload -i zsh/stat 2>/dev/null + typeset -i8 ref=$(stat +mode $opt_args[--reference]) + _wanted files expl file _files -g "*(-.^f${ref#??})" && ret=0 + fi + 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 diff --git a/Completion/Unix/Command/_gs b/Completion/Unix/Command/_gs new file mode 100644 index 000000000..22f3c789b --- /dev/null +++ b/Completion/Unix/Command/_gs @@ -0,0 +1,57 @@ +#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 diff --git a/Completion/Unix/Command/_look b/Completion/Unix/Command/_look new file mode 100644 index 000000000..94a90bc3f --- /dev/null +++ b/Completion/Unix/Command/_look @@ -0,0 +1,16 @@ +#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"') && return + +return ret diff --git a/Completion/Unix/Command/_python b/Completion/Unix/Command/_python new file mode 100644 index 000000000..be27f8300 --- /dev/null +++ b/Completion/Unix/Command/_python @@ -0,0 +1,38 @@ +#compdef python + +# Python 2.4 + +local curcontext="$curcontext" state line expl +typeset -A opt_args + +_arguments -C -s -S \ + '(1 -)-c+[program passed in as string (terminates option list)]:python command:' \ + '-d[debug output from parser]' \ + '-E[ignore 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]' \ + '-OO[remove doc-strings in addition to the -O optimizations]' \ + '-Q+[division options]:division option:(old warn warnall new)' \ + "-S[don't imply 'import site' on initialization]" \ + '-t[issue warnings about inconsistent tab usage]' \ + '-tt[issue errors about inconsistent tab usage]' \ + '-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 diff --git a/Completion/Unix/Command/_rar b/Completion/Unix/Command/_rar new file mode 100644 index 000000000..1e3a26166 --- /dev/null +++ b/Completion/Unix/Command/_rar @@ -0,0 +1,132 @@ +#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 -- cgit 1.4.1