Various fixes, remove _zargs already upstream

Many movings of local inside the actual functions.
Add many missing local and remove -g(!).
Fix namespacing of some parameters and functions, phases() in _scala was nice.
This commit is contained in:
Mikael Magnusson 2012-06-10 02:39:41 +02:00
parent 3497b4841c
commit c3b4d582a0
31 changed files with 406 additions and 440 deletions

6
_adb
View File

@ -43,10 +43,10 @@
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
typeset -A opt_args
local context state line curcontext="$curcontext" adb_args
_adb() { _adb() {
typeset -A opt_args
local context state line curcontext="$curcontext" adb_args
local ret=1 local ret=1
_arguments -C \ _arguments -C \

View File

@ -43,10 +43,10 @@
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
typeset -A opt_args
local context state line curcontext="$curcontext"
_android() { _android() {
typeset -A opt_args
local context state line curcontext="$curcontext"
local ret=1 local ret=1
_arguments -C -A "-*" \ _arguments -C -A "-*" \

View File

@ -44,9 +44,8 @@
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
_debuild() { # FIXME --noconf is only allowed in first position
# FIXME --noconf is only allowed in first position _arguments \
_arguments \
'(- 1 *)'{-h,--help}'[show help]' \ '(- 1 *)'{-h,--help}'[show help]' \
'(- 1 *)--version[show version and copyright information]' \ '(- 1 *)--version[show version and copyright information]' \
{--no-conf,--noconf}'[don'\''t read devscripts config files]' \ {--no-conf,--noconf}'[don'\''t read devscripts config files]' \
@ -59,6 +58,3 @@ _debuild() {
'(-d)-D[force checking of build dependencies]' \ '(-d)-D[force checking of build dependencies]' \
'--check-dirname-level[how much to check directory names]:level:((0\:never 1\:only\ if\ program\ changes\ directory\ \(default\) 2\:always))' \ '--check-dirname-level[how much to check directory names]:level:((0\:never 1\:only\ if\ program\ changes\ directory\ \(default\) 2\:always))' \
'--check-dirname-regex[Perl regex defining matching directory names, the string PACKAGE will be replaced by the package name (default: '\''PACKAGE(-.+)?'\'')]:regex' '--check-dirname-regex[Perl regex defining matching directory names, the string PACKAGE will be replaced by the package name (default: '\''PACKAGE(-.+)?'\'')]:regex'
}
_debuild "$@"

6
_ditz
View File

@ -19,9 +19,9 @@
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
ME=ditz local ME=ditz
COMMANDS=--commands local COMMANDS=--commands
OPTIONS='<options>' local OPTIONS='<options>'
if (($CURRENT == 2)); then if (($CURRENT == 2)); then
# We're completing the first word after the tool: the command. # We're completing the first word after the tool: the command.

View File

@ -46,17 +46,15 @@
typeset -A opt_args typeset -A opt_args
local context state line curcontext="$curcontext" local context state line curcontext="$curcontext"
_emulator() { # TODO All image options are contextual to -sysdir value
# TODO All skin options are contextual to -skindir value
# TODO All image options are contextual to -sysdir value # TODO snapshot options are mutually exclusive
# TODO All skin options are contextual to -skindir value # TODO Use '-snapshot-list' output for snapshot names
# TODO snapshot options are mutually exclusive # TODO Complete -avd with avd names ?
# TODO Use '-snapshot-list' output for snapshot names # TODO -logcat: use completer from _adb
# TODO Complete -avd with avd names ? # TODO Complete options with device values
# TODO -logcat: use completer from _adb # TODO Complete -prop
# TODO Complete options with device values _arguments \
# TODO Complete -prop
_arguments \
'(- : *)-version[display emulator version number]' \ '(- : *)-version[display emulator version number]' \
'(- : *)-help[display help information]' \ '(- : *)-help[display help information]' \
'(- : *)-help-disk-images[about disk images]' \ '(- : *)-help-disk-images[about disk images]' \
@ -134,6 +132,3 @@ _emulator() {
'-qemu[pass arguments to qemu]:arguments' \ '-qemu[pass arguments to qemu]:arguments' \
'-verbose[same as '\''-debug-init'\'']' \ '-verbose[same as '\''-debug-init'\'']' \
'*'{-debug,-debug-,-debug-no-}'[enable/disable specific debug messages]:tag' '*'{-debug,-debug-,-debug-no-}'[enable/disable specific debug messages]:tag'
}
_emulator "$@"

8
_gem
View File

@ -19,16 +19,18 @@
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
gem_general_flags=("(-h --help)"{-h,--help}"[Get help on this command]" _gem() {
local -a gem_general_flags
gem_general_flags=("(-h --help)"{-h,--help}"[Get help on this command]"
"(-V --verbose)"{-V,--verbose}"[Set the verbose level of output]" "(-V --verbose)"{-V,--verbose}"[Set the verbose level of output]"
"(-q --quiet)"{-q,--quiet}"[Silence commands]" "(-q --quiet)"{-q,--quiet}"[Silence commands]"
"--config-file[Use this config file instead of default]:file:_files" "--config-file[Use this config file instead of default]:file:_files"
"--backtrace[Show stack backtrace on errors]" "--backtrace[Show stack backtrace on errors]"
"--debug[Turn on Ruby debugging]" "--debug[Turn on Ruby debugging]"
$nul_arg $nul_arg
) )
_gem() {
if (( CURRENT > 2 )); then if (( CURRENT > 2 )); then
(( CURRENT-- )) (( CURRENT-- ))
shift words shift words

View File

@ -80,7 +80,7 @@ single=( --current -c --pretend -p --help -h --version -v )
_values '' \ _values '' \
last yesterday 1st 2nd 3rd 4th 5th last yesterday 1st 2nd 3rd 4th 5th
_alternative \ _alternative \
'*:*:_days' '*:*:_months' && return 0 '*:*:_genlop_days' '*:*:_genlop_months' && return 0
;; ;;
--file|-f) --file|-f)
_arguments '*:logfile:_files' && return 0 _arguments '*:logfile:_files' && return 0
@ -113,13 +113,13 @@ single=( --current -c --pretend -p --help -h --version -v )
_values '' \ _values '' \
last yesterday 1st 2nd 3rd 4th 5th last yesterday 1st 2nd 3rd 4th 5th
_alternative \ _alternative \
':*:_days' ':*:_months' && return 0 ':*:_genlop_days' ':*:_genlop_months' && return 0
;; ;;
esac esac
done done
} }
_days() { _genlop_days() {
local m="monday" t="tuesday" w="wednesday" T="thursday" f="friday" s="saturday" S="sunday" local m="monday" t="tuesday" w="wednesday" T="thursday" f="friday" s="saturday" S="sunday"
local day=$(date +%u) local day=$(date +%u)
if [[ ${day} == 1 ]] then compadd $m if [[ ${day} == 1 ]] then compadd $m
@ -131,7 +131,7 @@ _days() {
elif [[ ${day} == 7 ]] then compadd $m $t $w $T $f $s $S elif [[ ${day} == 7 ]] then compadd $m $t $w $T $f $s $S
fi fi
} }
_months() { _genlop_months() {
local j="january" f="february" m="march" a="april" M="may" ju="june" J="july" A="august" s="september" o="october" n="november" d="december" local j="january" f="february" m="march" a="april" M="may" ju="june" J="july" A="august" s="september" o="october" n="november" d="december"
local month=$(date +%m) local month=$(date +%m)
if [[ ${month} == 01 ]] then compadd $j if [[ ${month} == 01 ]] then compadd $j

View File

@ -42,10 +42,10 @@
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
typeset -A opt_args
local context state line curcontext="$curcontext"
_git-pulls() { _git-pulls() {
typeset -A opt_args
local context state line curcontext="$curcontext"
local ret=1 local ret=1
_arguments -C \ _arguments -C \

View File

@ -42,8 +42,7 @@
# vim: ft=zsh sw=2 ts=2 et # vim: ft=zsh sw=2 ts=2 et
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
_git-wtf () { _arguments -w -C -s \
_arguments -w -C -s \
'(--long --short)'{-l,--long}'[include author info and date for each commit]' \ '(--long --short)'{-l,--long}'[include author info and date for each commit]' \
'(--long --short)'{-s,--short}'[do not show commits]' \ '(--long --short)'{-s,--short}'[do not show commits]' \
'(--all)'{-a,--all}'[show all branches across all remote repos, not just those from origin]' \ '(--all)'{-a,--all}'[show all branches across all remote repos, not just those from origin]' \
@ -52,6 +51,3 @@ _git-wtf () {
'(--relations)'{-r,--relations}'[show relation to features / integration branches]' \ '(--relations)'{-r,--relations}'[show relation to features / integration branches]' \
'(--dump-config)--dump-config[print out current configuration and exit]' \ '(--dump-config)--dump-config[print out current configuration and exit]' \
'*: :__git_branch_names' '*: :__git_branch_names'
}
_git-wtf "$@"

View File

@ -42,10 +42,10 @@
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
typeset -A opt_args
local context state line curcontext="$curcontext"
_github() { _github() {
typeset -A opt_args
local context state line curcontext="$curcontext"
local ret=1 local ret=1
_arguments -C \ _arguments -C \

View File

@ -44,10 +44,10 @@
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
typeset -A opt_args
local context state line
_gradle() { _gradle() {
typeset -A opt_args
local context state line
local curcontext="$curcontext" local curcontext="$curcontext"
_arguments \ _arguments \

7
_knife
View File

@ -19,9 +19,6 @@
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
# These flags should be available everywhere according to man knife
knife_general_flags=( --help --server-url --key --config --editor --format --log_level --logfile --no-editor --user --print-after --version --yes )
# knife has a very special syntax, some example calls are: # knife has a very special syntax, some example calls are:
# knife status # knife status
# knife cookbook list # knife cookbook list
@ -34,6 +31,10 @@ knife_general_flags=( --help --server-url --key --config --editor --format --log
_knife() { _knife() {
local curcontext="$curcontext" state line local curcontext="$curcontext" state line
typeset -A opt_args typeset -A opt_args
# These flags should be available everywhere according to man knife
knife_general_flags=( --help --server-url --key --config --editor --format --log_level --logfile --no-editor --user --print-after --version --yes )
cloudproviders=(bluebox ec2 rackspace slicehost terremark) cloudproviders=(bluebox ec2 rackspace slicehost terremark)
_arguments \ _arguments \
'1: :->knifecmd'\ '1: :->knifecmd'\

View File

@ -19,15 +19,6 @@
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
typeset -ga nul_args
nul_args=(
'--settings=-[the Python path to a settings module.]:file:_files'
'--pythonpath=-[a directory to add to the Python path.]::directory:_directories'
'--traceback[print traceback on exception.]'
"--version[show program's version number and exit.]"
{-h,--help}'[show this help message and exit.]'
)
_managepy-adminindex(){ _managepy-adminindex(){
_arguments -s : \ _arguments -s : \
$nul_args \ $nul_args \
@ -224,7 +215,16 @@ _applist() {
_values 'Application' $apps && ret=0 _values 'Application' $apps && ret=0
} }
_managepy() { _manage.py() {
local -a nul_args
nul_args=(
'--settings=-[the Python path to a settings module.]:file:_files'
'--pythonpath=-[a directory to add to the Python path.]::directory:_directories'
'--traceback[print traceback on exception.]'
"--version[show program's version number and exit.]"
{-h,--help}'[show this help message and exit.]'
)
local curcontext=$curcontext ret=1 local curcontext=$curcontext ret=1
if ((CURRENT == 2)); then if ((CURRENT == 2)); then
@ -237,4 +237,4 @@ _managepy() {
fi fi
} }
_managepy "$@" _manage.py "$@"

6
_mvn
View File

@ -73,10 +73,10 @@
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
typeset -A opt_args
local context state line
_mvn() { _mvn() {
typeset -A opt_args
local context state line
local curcontext="$curcontext" maven_version excl_opts local curcontext="$curcontext" maven_version excl_opts
excl_opts=(-h --help -v --version -ep --encrypt-password -emp --encrypt-master-password) excl_opts=(-h --help -v --version -ep --encrypt-password -emp --encrypt-master-password)

View File

@ -45,7 +45,9 @@
local curcontext="$curcontext" state line local curcontext="$curcontext" state line
typeset -A opt_args typeset -A opt_args
args=( local -a arguments
arguments=(
'--version[output version information]' '--version[output version information]'
'(-h --help)'{-h,--help}'[show help]' '(-h --help)'{-h,--help}'[show help]'
'(-c --vgl-compress)'{-c,--vgl-compress}'[image transport method]:method:(proxy jpeg rgb xb yuv)' '(-c --vgl-compress)'{-c,--vgl-compress}'[image transport method]:method:(proxy jpeg rgb xb yuv)'
@ -59,7 +61,7 @@ args=(
'(-C --config)'{-C,--config}'[retrieve settings for Bumblebee from FILE]:file:_files' '(-C --config)'{-C,--config}'[retrieve settings for Bumblebee from FILE]:file:_files'
'(-l --ldpath)'{-l,--ldpath}'[PATH the libraries like libGL.so are searched in]:file:_files' '(-l --ldpath)'{-l,--ldpath}'[PATH the libraries like libGL.so are searched in]:file:_files'
'(-s --socket)'{-s,--socket}'[use FILE for communication with the daemon]:file:_files' '(-s --socket)'{-s,--socket}'[use FILE for communication with the daemon]:file:_files'
'*::arguments: _normal' '*::arguments: _files'
) )
_arguments $args _arguments $arguments

6
_perf
View File

@ -42,10 +42,10 @@
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
local context curcontext="$curcontext" state line
typeset -A opt_args
_perf() { _perf() {
local context curcontext="$curcontext" state line
typeset -A opt_args
local ret=1 local ret=1
_arguments -C \ _arguments -C \

9
_pip
View File

@ -21,7 +21,7 @@
local ret=1 state local ret=1 state
declare -ga common_ops local -a common_ops
common_ops=( common_ops=(
"--version[display version number]" "--version[display version number]"
{-h,--help}"[show help]" {-h,--help}"[show help]"
@ -46,6 +46,7 @@ _arguments \
case $state in case $state in
subcommand) subcommand)
local -a subcommands
subcommands=( subcommands=(
"bundle:create pybundle" "bundle:create pybundle"
"freeze:put all currently installed packages" "freeze:put all currently installed packages"
@ -61,17 +62,17 @@ case $state in
;; ;;
options) options)
declare -a args local -a args
args=( args=(
$common_ops $common_ops
) )
declare -a requirement local -a requirement
requirement=( requirement=(
{-r,--requirement=}"[install all the packages listed in the given requirements file]:filename:_files" {-r,--requirement=}"[install all the packages listed in the given requirements file]:filename:_files"
) )
declare -a findlink local -a findlink
findlink=( findlink=(
{-f,--find-links=}"[URL to look for packages at]:url" {-f,--find-links=}"[URL to look for packages at]:url"
) )

38
_pkcon
View File

@ -39,9 +39,8 @@
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
_pkcon() { local -a options
local -a options options=(
options=(
'--version[Show the program version and exit]' '--version[Show the program version and exit]'
'--filter[Set the filter, e.g. installed]' '--filter[Set the filter, e.g. installed]'
"--root[Set the install root, e.g. '/' or '/mnt/ltsp']" "--root[Set the install root, e.g. '/' or '/mnt/ltsp']"
@ -52,10 +51,10 @@ _pkcon() {
'(-c --cache-age)'{-c,--cache-age}"[The maximum metadata cache age. Use -1 for 'never'.]" '(-c --cache-age)'{-c,--cache-age}"[The maximum metadata cache age. Use -1 for 'never'.]"
'(-h --help)'{-h,--help}'[Show help options.]' '(-h --help)'{-h,--help}'[Show help options.]'
'(-v --verbose)'{-v,--verbose}'[Show debugging information for all files]' '(-v --verbose)'{-v,--verbose}'[Show debugging information for all files]'
) )
local -a actions local -a actions
actions=( actions=(
'accept-eula' 'accept-eula'
'get-roles' 'get-roles'
'get-distro-upgrades' 'get-distro-upgrades'
@ -86,13 +85,13 @@ _pkcon() {
'repo-set-data' 'repo-set-data'
'what-provides' 'what-provides'
'upgrade-system' 'upgrade-system'
) )
local context state line expl cmd local context state line expl cmd
local -A opt_args local -A opt_args
integer i=2 integer i=2
while (( i < $#words )); do while (( i < $#words )); do
case "$words[$i]" in case "$words[$i]" in
-*) -*)
# skip option # skip option
@ -107,16 +106,16 @@ _pkcon() {
(( CURRENT-- )) (( CURRENT-- ))
fi fi
(( i++ )) (( i++ ))
done done
if [[ -z "$cmd" ]] if [[ -z "$cmd" ]]
then then
_arguments -s -w : $options \ _arguments -s -w : $options \
":action:($actions)" ":action:($actions)"
return return
fi fi
case "$cmd" in case "$cmd" in
search) search)
_arguments : $options \ _arguments : $options \
':type:(name details group file)' \ ':type:(name details group file)' \
@ -129,8 +128,5 @@ _pkcon() {
*) *)
_arguments -s -w : $options _arguments -s -w : $options
;; ;;
esac esac
return 1 return 1
}
_pkcon "$@"

6
_play
View File

@ -43,10 +43,10 @@
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
local context curcontext="$curcontext" state line
typeset -A opt_args
_play() { _play() {
local context curcontext="$curcontext" state line
typeset -A opt_args
local ret=1 local ret=1
_arguments -C \ _arguments -C \

10
_port
View File

@ -16,11 +16,6 @@
local subcmds local subcmds
# Cache the list of ports.
if (( ! $+_port_list )); then
_port_list=($(port echo all; echo "all current active inactive installed uninstalled outdated"))
fi
subcmds=( subcmds=(
'activate' 'activate'
'archive' 'archive'
@ -97,6 +92,11 @@ case "$state" in
_describe -t commands 'port commands' subcmds _describe -t commands 'port commands' subcmds
;; ;;
(portname) (portname)
# Cache the list of ports.
if (( ! $+_port_list )); then
_port_list=($(port echo all; echo "all current active inactive installed uninstalled outdated"))
fi
_describe -t commands 'available ports' _port_list _describe -t commands 'available ports' _port_list
;; ;;
esac esac

View File

@ -319,6 +319,7 @@ _tbz2tool () {
} }
local -A Args
zparseopts -D -E -A Args -- -emerge zparseopts -D -E -A Args -- -emerge
if (( ${+Args[--emerge]} ));then if (( ${+Args[--emerge]} ));then
_emerge "$@" && return 0 _emerge "$@" && return 0

View File

@ -49,7 +49,7 @@
#<app-portage/portage-utils-0.19> #<app-portage/portage-utils-0.19>
# #
local common_args PORTDIR local common_args PORTDIR var
var=PORTDIR var=PORTDIR
[[ -z ${(P)var} && -r /etc/make.conf ]] && [[ -z ${(P)var} && -r /etc/make.conf ]] &&
local $var="`. /etc/make.conf 2>/dev/null; echo ${(P)var}`" local $var="`. /etc/make.conf 2>/dev/null; echo ${(P)var}`"

View File

@ -41,9 +41,9 @@
# vim: ft=zsh sw=2 ts=2 et # vim: ft=zsh sw=2 ts=2 et
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
local context state line
_pygmentize() { _pygmentize() {
local context state line
_arguments -s -S \ _arguments -s -S \
'-h[prints help]:' \ '-h[prints help]:' \
'-V[prints the package version]:' \ '-V[prints the package version]:' \

4
_sbt
View File

@ -38,12 +38,12 @@
# #
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
function _tasks () { function _sbt_tasks () {
compadd clean compile console console-project console-quick doc package \ compadd clean compile console console-project console-quick doc package \
package-doc package-src publish publish-local run run-main test test-only \ package-doc package-src publish publish-local run run-main test test-only \
test:compile test:package test:package-doc test:package-src update test:compile test:package test:package-doc test:package-src update
} }
_arguments "*:task:_tasks" _arguments "*:task:_sbt_tasks"
return 0 return 0

24
_scala
View File

@ -41,7 +41,7 @@
typeset -A opt_args typeset -A opt_args
local context state line local context state line
function phases () { _scala_phases () {
compadd "parser" "namer" "packageobjects" "typer" "superaccessors" \ compadd "parser" "namer" "packageobjects" "typer" "superaccessors" \
"pickler" "refchecks" "selectiveanf" "liftcode" "selectivecps" "uncurry" \ "pickler" "refchecks" "selectiveanf" "liftcode" "selectivecps" "uncurry" \
"tailcalls" "specialize" "explicitouter" "erasure" "lazyvals" "lambdalift" \ "tailcalls" "specialize" "explicitouter" "erasure" "lazyvals" "lambdalift" \
@ -49,6 +49,7 @@ function phases () {
"dce" "jvm" "terminal" "dce" "jvm" "terminal"
} }
local -a shared_opts
shared_opts=( shared_opts=(
"-bootclasspath+[Override location of bootstrap class files]:bootstrap class directory:_files -/" "-bootclasspath+[Override location of bootstrap class files]:bootstrap class directory:_files -/"
"-classpath+[Specify where to find user class files]:directory:_files -/" "-classpath+[Specify where to find user class files]:directory:_files -/"
@ -82,6 +83,7 @@ shared_opts=(
"-Y[Print a synopsis of private options]" "-Y[Print a synopsis of private options]"
) )
local -a X_opts
X_opts=( X_opts=(
"-Xcheck-null[Warn upon selection of nullable reference]" "-Xcheck-null[Warn upon selection of nullable reference]"
"-Xcheckinit[Wrap field accessors to throw an exception on uninitialized access]" "-Xcheckinit[Wrap field accessors to throw an exception on uninitialized access]"
@ -98,7 +100,7 @@ X_opts=(
"-Xno-forwarders[Do not generate static forwarders in mirror classes]" "-Xno-forwarders[Do not generate static forwarders in mirror classes]"
"-Xno-uescape[Disable handling of \u unicode escapes]" "-Xno-uescape[Disable handling of \u unicode escapes]"
"-Xnojline[Do not use JLine for editing]" "-Xnojline[Do not use JLine for editing]"
"-Xprint\:-[Print out program after <phase>]:phase name:phases" "-Xprint\:-[Print out program after <phase>]:phase name:_scala_phases"
"-Xprint-icode[Log internal icode to *.icode files]" "-Xprint-icode[Log internal icode to *.icode files]"
"-Xprint-pos[Print tree positions, as offsets]" "-Xprint-pos[Print tree positions, as offsets]"
"-Xprint-types[Print tree types (debugging option)]" "-Xprint-types[Print tree types (debugging option)]"
@ -123,6 +125,7 @@ X_opts=(
"-Xplugin-require\:-[Abort unless the given plugin(s) are available]" "-Xplugin-require\:-[Abort unless the given plugin(s) are available]"
) )
local -a Y_opts
Y_opts=( Y_opts=(
"-Y[Print a synopsis of private options]" "-Y[Print a synopsis of private options]"
"-Ybuild-manager-debug[Generate debug information for the Refined Build Manager compiler]" "-Ybuild-manager-debug[Generate debug information for the Refined Build Manager compiler]"
@ -155,19 +158,19 @@ Y_opts=(
"-Yresolve-term-conflict\:-[Resolve term conflicts (default\: error)]:resolution strategy:(package object error)" "-Yresolve-term-conflict\:-[Resolve term conflicts (default\: error)]:resolution strategy:(package object error)"
"-Yrich-exceptions[Fancier exceptions. Set source search path with -Dscala.control.sourcepath]" "-Yrich-exceptions[Fancier exceptions. Set source search path with -Dscala.control.sourcepath]"
"-Yself-in-annots[Include a \"self\" identifier inside of annotations]" "-Yself-in-annots[Include a \"self\" identifier inside of annotations]"
"-Yshow\:-[Show after <phase> (requires -Xshow-class or -Xshow-object)]:phase name:phases" "-Yshow\:-[Show after <phase> (requires -Xshow-class or -Xshow-object)]:phase name:_scala_phases"
"-Yshow-syms[Print the AST symbol hierarchy after each phase]" "-Yshow-syms[Print the AST symbol hierarchy after each phase]"
"-Yshow-trees[Print detailed ASTs (requires -Xprint:phase)]" "-Yshow-trees[Print detailed ASTs (requires -Xprint:phase)]"
"-Ystatistics[Print compiler statistics]" "-Ystatistics[Print compiler statistics]"
"-Ystruct-dispatch\:-[Structural method dispatch policy (default\: poly-cache)]:policy name:(no-cache mono-cache poly-cache invoke-dynamic)" "-Ystruct-dispatch\:-[Structural method dispatch policy (default\: poly-cache)]:policy name:(no-cache mono-cache poly-cache invoke-dynamic)"
"-Ybrowse\:-[Browse the abstract syntax tree after <phase>]:phase name:phases" "-Ybrowse\:-[Browse the abstract syntax tree after <phase>]:phase name:_scala_phases"
"-Ycheck\:-[Check the tree at the end of <phase>]:phase name:phases" "-Ycheck\:-[Check the tree at the end of <phase>]:phase name:_scala_phases"
"-Ylog\:-[Log operations during <phase>]:phase name:phases" "-Ylog\:-[Log operations during <phase>]:phase name:_scala_phases"
"-Yprofile\:-[Profile CPU usage of given phases (requires jgpagent on JVM -agentpath)]:phase name:phases" "-Yprofile\:-[Profile CPU usage of given phases (requires jgpagent on JVM -agentpath)]:phase name:_scala_phases"
"-Yskip\:-[Skip <phase>]:phase name:phases" "-Yskip\:-[Skip <phase>]:phase name:_scala_phases"
"-Ystop-after\:-[Stop after given phase <phase>]:phase name:phases" "-Ystop-after\:-[Stop after given phase <phase>]:phase name:_scala_phases"
"-Ystop-before\:-[Stop before given phase <phase>]:phase name:phases" "-Ystop-before\:-[Stop before given phase <phase>]:phase name:_scala_phases"
"-Ywarn-all[Enable all -Y warnings]" "-Ywarn-all[Enable all -Y warnings]"
"-Ywarn-dead-code[Warn when dead code is identified]" "-Ywarn-dead-code[Warn when dead code is identified]"
@ -188,6 +191,7 @@ Y_opts=(
"-Ytyper-debug[Trace all type assignments]" "-Ytyper-debug[Trace all type assignments]"
) )
local -a scala_opts
scala_opts=( scala_opts=(
"-e+[execute <string> as if entered in the repl]:string" \ "-e+[execute <string> as if entered in the repl]:string" \
"-howtorun+[what to run (default\: guess)]:execution mode:(script object jar guess)" \ "-howtorun+[what to run (default\: guess)]:execution mode:(script object jar guess)" \

View File

@ -16,10 +16,10 @@
# vim: ft=zsh sw=2 ts=2 et # vim: ft=zsh sw=2 ts=2 et
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
typeset -A opt_args _setup.py() {
local context state line typeset -A opt_args
local context state line
_setuppy() {
_arguments -s -S \ _arguments -s -S \
"--verbose[run verbosely (default)]" \ "--verbose[run verbosely (default)]" \
"-v[run verbosely (default)]" \ "-v[run verbosely (default)]" \
@ -700,4 +700,4 @@ _setuppy_upload_docs() {
"*::setup.py commands:_setuppy" "*::setup.py commands:_setuppy"
} }
_setuppy "$@" _setup.py "$@"

6
_srm
View File

@ -15,7 +15,7 @@
# #
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
declare -a opts args local -a opts args
args=( args=(
'(-f --force)'{-f,--force}'[ignore nonexistent files, never prompt]' '(-f --force)'{-f,--force}'[ignore nonexistent files, never prompt]'
'(-r --interactive)'{-i,--interactive}'[prompt before any removal]' '(-r --interactive)'{-i,--interactive}'[prompt before any removal]'
@ -43,14 +43,14 @@ else
fi fi
local curcontext=$curcontext state line ret=1 local curcontext=$curcontext state line ret=1
declare -A opt_args local -A opt_args
_arguments -s -S -C $opts \ _arguments -s -S -C $opts \
$args && ret=0 $args && ret=0
case $state in case $state in
(file) (file)
declare -a ignored local -a ignored
ignored=() ignored=()
((CURRENT > 1)) && ((CURRENT > 1)) &&
ignored+=(${line[1,CURRENT-1]//(#m)[\[\]()\\*?#<>~\^]/\\$MATCH}) ignored+=(${line[1,CURRENT-1]//(#m)[\[\]()\\*?#<>~\^]/\\$MATCH})

View File

@ -42,7 +42,7 @@
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
# FIXME This completes "user@host" and not "[user@]host" ("user@" is optionnal), # FIXME This completes "user@host" and not "[user@]host" ("user@" is optional),
# should be merged in _ssh. # should be merged in _ssh.
_arguments -A "-*" \ _arguments -A "-*" \

View File

@ -50,7 +50,7 @@ _box_arguments=(
__task_list () __task_list ()
{ {
local expl local expl
declare -a tasks local -a tasks
tasks=(box destroy halt init package provision reload resume ssh ssh_config status suspend up version) tasks=(box destroy halt init package provision reload resume ssh ssh_config status suspend up version)
@ -70,7 +70,7 @@ __vm_list ()
__vagrant-box () __vagrant-box ()
{ {
local curcontext="$curcontext" state line local curcontext="$curcontext" state line
typeset -A opt_args local -A opt_args
_arguments -C \ _arguments -C \
':command:->command' \ ':command:->command' \
@ -99,7 +99,7 @@ local expl
local -a boxes installed_boxes local -a boxes installed_boxes
local curcontext="$curcontext" state line local curcontext="$curcontext" state line
typeset -A opt_args local -A opt_args
_arguments -C \ _arguments -C \
':command:->command' \ ':command:->command' \

208
_yaourt
View File

@ -4,104 +4,6 @@
# copy this file to /usr/share/zsh/site-functions/_pacman # copy this file to /usr/share/zsh/site-functions/_pacman
typeset -A opt_args
# options for passing to _arguments: main pacman commands
_yaourt_opts_commands=(
'-Q[Query the package database]'
'-R[Remove a package from the system]'
'-S[Synchronize packages]'
'-U[Upgrade a package]'
'-V[Display version and exit]'
'-h[Display usage]'
'-B[backup pacman database]'
'-G[Get PKGBUILD]'
'-C[Clean backup files]'
'--stats[Package Statistics]'
)
# options for passing to _arguments: options common to all commands
_yaourt_opts_common=(
'-b[Alternate database location]:database_location:_files -/'
'-h[Display syntax for the given operation]'
'-r[Set alternate installation root]:installation root:_files -/'
'-v[Be more verbose]'
'--cachedir[Alternate package cache location]:cache_location:_files -/'
'--config[An alternate configuration file]:config file:_files'
'--logfile[An alternate log file]:config file:_files'
'--noconfirm[Do not ask for confirmation]'
'--noprogressbar[Do not show a progress bar when downloading files]'
'--noscriptlet[Do not execute the install scriptlet if one exists]'
'--print[Only print the targets instead of performing the operation]'
)
# options for passing to _arguments: options for --upgrade commands
_yaourt_opts_pkgfile=(
'-d[Skip dependency checks]'
'-f[Overwrite conflicting files]'
'*:package file:_files -g "*.pkg.tar.*(.)"'
)
# options for passing to _arguments: subactions for --query command
_yaourt_opts_query_actions=(
'-g[View all members of a package group]:*:package groups:->query_group'
'-o[Query the package that owns a file]:file:_files'
'-p[Package file to query]:*:package file:->query_file'
'-s[Search package names and descriptions]:*:search text:->query_search'
)
# options for passing to _arguments: options for --query and subcommands
_yaourt_opts_query_modifiers=(
'-c[List package changelog]'
'-d[List packages installed as dependencies]'
'-e[List packages explicitly installed]'
'-i[View package information]'
'-ii[View package information including backup files]'
'-k[Check package files]'
'-l[List package contents]'
'-m[List installed packages not found in sync db(s)]'
'-t[List packages not required by any package]'
'-u[List packages that can be upgraded]'
'--aur[Install packages from aur, even if they are in community, or, with the -u option, update packages installed from aur]'
'--devel[Used with -u updates all cvs/svn/git/hg/bzr packages]'
)
# options for passing to _arguments: options for --remove command
_yaourt_opts_remove=(
'-c[Remove all dependent packages]'
'-d[Skip dependency checks]'
'-k[Only remove database entry, do not remove files]'
'-n[Remove protected configuration files]'
'-s[Remove dependencies not required by other packages]'
'*:installed package:_yaourt_completions_installed_packages'
)
# options for passing to _arguments: options for --sync command
_yaourt_opts_sync_actions=(
'*-c[Remove old packages from cache]:*:clean:->sync_clean'
'*-cc[Remove all packages from cache]:*:clean:->sync_clean'
'-g[View all members of a package group]:*:package groups:->sync_group'
'-s[Search package names and descriptions]:*:search text:->sync_search'
)
# options for passing to _arguments: options for --sync command
_yaourt_opts_sync_modifiers=(
'-d[Skip dependency checks]'
'-f[Overwrite conflicting files]'
'-i[View package information]'
'-l[List all packages in a repository]'
'-p[Print download URIs for each package to be installed]'
'-u[Upgrade all out-of-date packages]'
'-w[Download packages only]'
'-y[Download fresh package databases]'
'*--ignore[Ignore a package upgrade]:package:
_yaourt_completions_all_packages'
'*--ignoregroup[Ignore a group upgrade]:package group:
_yaourt_completions_all_groups'
'--asdeps[Install packages as non-explicitly installed]'
'--asexplicit[Install packages as explicitly installed]'
)
# handles --help subcommand # handles --help subcommand
_yaourt_action_help() { _yaourt_action_help() {
_arguments -s : \ _arguments -s : \
@ -288,7 +190,113 @@ _yaourt_get_command() {
} }
# main dispatcher # main dispatcher
_pacman() { _yaourt() {
typeset -A opt_args
# options for passing to _arguments: main pacman commands
typeset -a _yaourt_opts_commands
_yaourt_opts_commands=(
'-Q[Query the package database]'
'-R[Remove a package from the system]'
'-S[Synchronize packages]'
'-U[Upgrade a package]'
'-V[Display version and exit]'
'-h[Display usage]'
'-B[backup pacman database]'
'-G[Get PKGBUILD]'
'-C[Clean backup files]'
'--stats[Package Statistics]'
)
# options for passing to _arguments: options common to all commands
typeset -a _yaourt_opts_common
_yaourt_opts_common=(
'-b[Alternate database location]:database_location:_files -/'
'-h[Display syntax for the given operation]'
'-r[Set alternate installation root]:installation root:_files -/'
'-v[Be more verbose]'
'--cachedir[Alternate package cache location]:cache_location:_files -/'
'--config[An alternate configuration file]:config file:_files'
'--logfile[An alternate log file]:config file:_files'
'--noconfirm[Do not ask for confirmation]'
'--noprogressbar[Do not show a progress bar when downloading files]'
'--noscriptlet[Do not execute the install scriptlet if one exists]'
'--print[Only print the targets instead of performing the operation]'
)
# options for passing to _arguments: options for --upgrade commands
typeset -a _yaourt_opts_pkgfile
_yaourt_opts_pkgfile=(
'-d[Skip dependency checks]'
'-f[Overwrite conflicting files]'
'*:package file:_files -g "*.pkg.tar.*(.)"'
)
# options for passing to _arguments: subactions for --query command
typeset -a _yaourt_opts_query_actions
_yaourt_opts_query_actions=(
'-g[View all members of a package group]:*:package groups:->query_group'
'-o[Query the package that owns a file]:file:_files'
'-p[Package file to query]:*:package file:->query_file'
'-s[Search package names and descriptions]:*:search text:->query_search'
)
# options for passing to _arguments: options for --query and subcommands
typeset -a _yaourt_opts_query_modifiers
_yaourt_opts_query_modifiers=(
'-c[List package changelog]'
'-d[List packages installed as dependencies]'
'-e[List packages explicitly installed]'
'-i[View package information]'
'-ii[View package information including backup files]'
'-k[Check package files]'
'-l[List package contents]'
'-m[List installed packages not found in sync db(s)]'
'-t[List packages not required by any package]'
'-u[List packages that can be upgraded]'
'--aur[Install packages from aur, even if they are in community, or, with the -u option, update packages installed from aur]'
'--devel[Used with -u updates all cvs/svn/git/hg/bzr packages]'
)
# options for passing to _arguments: options for --remove command
typeset -a _yaourt_opts_remove
_yaourt_opts_remove=(
'-c[Remove all dependent packages]'
'-d[Skip dependency checks]'
'-k[Only remove database entry, do not remove files]'
'-n[Remove protected configuration files]'
'-s[Remove dependencies not required by other packages]'
'*:installed package:_yaourt_completions_installed_packages'
)
# options for passing to _arguments: options for --sync command
typeset -a _yaourt_opts_sync_actions
_yaourt_opts_sync_actions=(
'*-c[Remove old packages from cache]:*:clean:->sync_clean'
'*-cc[Remove all packages from cache]:*:clean:->sync_clean'
'-g[View all members of a package group]:*:package groups:->sync_group'
'-s[Search package names and descriptions]:*:search text:->sync_search'
)
# options for passing to _arguments: options for --sync command
typeset -a _yaourt_opts_sync_modifiers
_yaourt_opts_sync_modifiers=(
'-d[Skip dependency checks]'
'-f[Overwrite conflicting files]'
'-i[View package information]'
'-l[List all packages in a repository]'
'-p[Print download URIs for each package to be installed]'
'-u[Upgrade all out-of-date packages]'
'-w[Download packages only]'
'-y[Download fresh package databases]'
'*--ignore[Ignore a package upgrade]:package:
_yaourt_completions_all_packages'
'*--ignoregroup[Ignore a group upgrade]:package group:
_yaourt_completions_all_groups'
'--asdeps[Install packages as non-explicitly installed]'
'--asexplicit[Install packages as explicitly installed]'
)
case $words[2] in case $words[2] in
-Q*g*) # ipkg groups -Q*g*) # ipkg groups
_arguments -s : \ _arguments -s : \
@ -335,4 +343,4 @@ _pacman() {
} }
# run the main dispatcher # run the main dispatcher
_pacman "$@" _yaourt "$@"

36
_zargs
View File

@ -1,36 +0,0 @@
#compdef zargs
# ------------------------------------------------------------------------------
# Description
# -----------
#
# Completion script for zargs.
#
# Source: http://smasher.org/tmp/_zargs.gz
#
# ------------------------------------------------------------------------------
# Authors
# -------
#
# * Atom Smasher <atom@smasher.org>
# * Sorin Ionescu <sorin.ionescu@gmail.com>
#
# ------------------------------------------------------------------------------
_arguments -s -S \
'(--eof -e)'{--eof=,-e+}'[Change the end-of-input-args string from "--" to eof-str]:string' \
'(--exit -x)'{--exit,-x}'[Exit if the size (see --max-chars) is exceeded]' \
'(--interactive -p)'{--interactive,-p}'[Prompt before executing each command line]' \
'--help[Print this summary and exit]' \
'(--max-args -n)'{--max-args=,-n+}'[Use at most max-args arguments per command line]:integer' \
'(--max-chars -s)'{--max-chars=,-s+}'[Use at most max-chars characters per command line]:integer' \
'(--max-lines -l)'{--max-lines=,-l+}'[Use at most max-lines of the input-args per command line]:integer' \
'(--max-procs -P)'{--max-procs=,-P+}'[Run up to max-procs command lines in the background at once]:integer' \
'(--no-run-if-empty, -r)'{--no-run-if-empty,-r}'[Do nothing if there are no input arguments before the eof-str]' \
'(--null -0)'{--null,-0}'[Split each input-arg at null bytes, for xargs compatibility]' \
'(--replace -i)'{--replace=,-i+}'[Substitute replace-str in the initial-args by each initial-arg]:string' \
'(--verbose -t)'{--verbose,-t}'[Print each command line to stderr before executing it]' \
'--version[Print the version number and exit]' \
'(-):command: _command_names -e' \
'*::args: _normal'