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() {
typeset -A opt_args
local context state line curcontext="$curcontext" adb_args
local ret=1
_arguments -C \

View File

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

View File

@ -44,21 +44,17 @@
# ------------------------------------------------------------------------------
_debuild() {
# FIXME --noconf is only allowed in first position
_arguments \
'(- 1 *)'{-h,--help}'[show help]' \
'(- 1 *)--version[show version and copyright information]' \
{--no-conf,--noconf}'[don'\''t read devscripts config files]' \
{-r-,--rootcmd=}'[command used to become root if debuild not setuid root (default: fakeroot)]: :_command_names' \
'*'{-e-,--preserve-envvar=}'[preserve environment variable]: :_vars' \
'(-e --preserve-envvar)--preserve-env[preserve all environment vars (except PATH)]' \
'*'{-e-,--set-envvar=}'[preserve environment variable]: :_vars -qS=' \
'--prepend-path=[prepend to the sanitised PATH]: :_files -/' \
'(-D)-d[skip 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-regex[Perl regex defining matching directory names, the string PACKAGE will be replaced by the package name (default: '\''PACKAGE(-.+)?'\'')]:regex'
}
_debuild "$@"
# FIXME --noconf is only allowed in first position
_arguments \
'(- 1 *)'{-h,--help}'[show help]' \
'(- 1 *)--version[show version and copyright information]' \
{--no-conf,--noconf}'[don'\''t read devscripts config files]' \
{-r-,--rootcmd=}'[command used to become root if debuild not setuid root (default: fakeroot)]: :_command_names' \
'*'{-e-,--preserve-envvar=}'[preserve environment variable]: :_vars' \
'(-e --preserve-envvar)--preserve-env[preserve all environment vars (except PATH)]' \
'*'{-e-,--set-envvar=}'[preserve environment variable]: :_vars -qS=' \
'--prepend-path=[prepend to the sanitised PATH]: :_files -/' \
'(-D)-d[skip 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-regex[Perl regex defining matching directory names, the string PACKAGE will be replaced by the package name (default: '\''PACKAGE(-.+)?'\'')]:regex'

6
_ditz
View File

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

177
_emulator
View File

@ -46,94 +46,89 @@
typeset -A opt_args
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 snapshot options are mutually exclusive
# TODO Use '-snapshot-list' output for snapshot names
# TODO Complete -avd with avd names ?
# TODO -logcat: use completer from _adb
# TODO Complete options with device values
# TODO Complete -prop
_arguments \
'(- : *)-version[display emulator version number]' \
'(- : *)-help[display help information]' \
'(- : *)-help-disk-images[about disk images]' \
'(- : *)-help-keys[supported key bindings]' \
'(- : *)-help-debug-tags[debug tags for -debug <tags>]' \
'(- : *)-help-char-devices[character <device> specification]' \
'(- : *)-help-environment[environment variables]' \
'(- : *)-help-keyset-file[key bindings configuration file]' \
'(- : *)-help-virtual-device[virtual device management]' \
'(- : *)-help-sdk-images[about disk images when using the SDK]' \
'(- : *)-help-build-images[about disk images when building Android]' \
'(- : *)-help-all[prints all help content]' \
'(- : *)-help-'{version,sysdir,system,image,datadir,kernel,ramdisk,initdata,data,partition-size,cache,no-cache,nocache,sdcard,snapstorage,no-snapstorage,snapshot,no-snapshot,no-snapshot-save,no-snapshot-load,snapshot-list,no-snapshot-update-time,wipe-data,avd,skindir,skin,noskin,no-skin,memory,netspeed,netdelay,netfast,trace,show-kernel,shell,no-jni,nojni,logcat,noaudio,no-audio,audio,raw-keys,radio,port,ports,onion,onion-alpha,onion-rotation,scale,dpi-device,http-proxy,timezone,dns-server,cpu-delay,no-boot-anim,no-window,report-console,gps,keyset,shell-serial,tcpdump,bootchart,charmap,prop,shared-net-id,nand-limits,memcheck,qemu,verbose}'[print option-specific help]' \
'-sysdir[search for system disk images in the directory]: :_files -/' \
'(-system -image)'{-system,-image}'[read initial system image from the file]: :_files -g "*.img"' \
'-datadir[write user data into the directory]: :_files -/' \
'-kernel[use specific emulated kernel]: :_files' \
'-ramdisk[ramdisk image (default <system>/ramdisk.img]: :_files -g "*.img"' \
'-initdata[same as '\''-init-data <file>'\'']: :_files' \
'-data[data image (default <datadir>/userdata-qemu.img]: :_files -g "*.img"' \
'-partition-size[system/data partition size]:size (in MBs)' \
'(-no-cache -nocache)-cache[cache partition image (default is temporary file)]: :_files -g "*.img"' \
'(-cache -no-cache -nocache)'{-no-cache,-nocache}'[disable the cache partition]' \
'-sdcard[SD card image (default <system>/sdcard.img]: :_files -g "*.img"' \
'(-no-snapstorage)-snapstorage[file that contains all state snapshots (default <datadir>/snapshots.img)]: :_files -g "*.img"' \
'(-snapstorage)-no-snapstorage[do not mount a snapshot storage file (this disables all snapshot functionality)]' \
'-snapshot[name of snapshot within storage file for auto-start and auto-save (default '\''default-boot'\'')]:snapshot name' \
'-no-snapshot[perform a full boot and do not do not auto-save, but qemu vmload and vmsave operate on snapstorage]' \
'-no-snapshot-save[do not auto-save to snapshot on exit: abandon changed state]' \
'-no-snapshot-load[do not auto-start from snapshot: perform a full boot]' \
'-snapshot-list[show a list of available snapshots]' \
'-no-snapshot-update-time[do not do try to correct snapshot time on restore]' \
'-wipe-data[reset the user data image (copy it from initdata)]' \
'-avd[use a specific android virtual device]:android virtual device name' \
'-skindir[search skins in <dir> (default <system>/skins)]: :_files -/' \
'-skin[select a given skin]' \
'(-noskin -no-skin)'{-noskin,-no-skin}'[don'\''t use any emulator skin]' \
'-memory[physical RAM size in MBs]:size (in MBs)' \
'-netspeed[maximum network download/upload speeds]:speed' \
'-netdelay[network latency emulation]:delay' \
'-netfast[disable network shaping]' \
'-trace[enable code profiling (F9 to start)]:trace name' \
'-show-kernel[display kernel messages]' \
'-shell[enable root shell on current terminal]' \
{-no-jni,-nojni}'[disable JNI checks in the Dalvik runtime]' \
'-logcat[enable logcat output with given tags]:logcat tags' \
'(-audio -noaudio -no-audio)'{-noaudio,-no-audio}'[disable audio support]' \
'(-noaudio -no-audio)-audio[use specific audio backend]:audio backend' \
'-raw-keys[disable Unicode keyboard reverse-mapping]' \
'-radio[redirect radio modem interface to character device]:device' \
'-port[TCP port that will be used for the console]:port number' \
'-ports[TCP ports used for the console and adb bridge]:console port,adb port' \
'-onion[use overlay PNG image over screen]: :_files -g "*.(png|PNG)"' \
'-onion-alpha[specify onion-skin translucency]:percentage' \
'-onion-rotation[specify onion-skin rotation]:rotation:((1 2 3 4))' \
'-scale[scale emulator window]:scale' \
'-dpi-device[specify device'\''s resolution in dpi (default 165)]:dpi' \
'-http-proxy[make TCP connections through a HTTP/HTTPS proxy]:proxy' \
'-timezone[use this timezone instead of the host'\''s default]:timezone' \
'-dns-server[use this DNS server(s) in the emulated system]:DNS servers' \
'-cpu-delay[throttle CPU emulation]:CPU delay' \
'-no-boot-anim[disable animation for faster boot]' \
'-no-window[disable graphical window display]' \
'-report-console[report console port to remote socket]: :_socket' \
'-gps[redirect NMEA GPS to character device]:device' \
'-keyset[specify keyset file name]: :_files' \
'-shell-serial[specific character device for root shell]:device' \
'-tcpdump[capture network packets to file]: :_files' \
'-bootchart[enable bootcharting]:timeout' \
'-charmap[use specific key character map]: :_files' \
'*-prop[set system property on boot]:name=value' \
'-shared-net-id[join the shared network, using IP address 10.1.2.<number>]:number' \
'-nand-limits[enforce NAND/Flash read/write thresholds]:limits' \
'-memcheck[enable memory access checking]:flags' \
'-qemu[pass arguments to qemu]:arguments' \
'-verbose[same as '\''-debug-init'\'']' \
'*'{-debug,-debug-,-debug-no-}'[enable/disable specific debug messages]:tag'
}
_emulator "$@"
# TODO All image options are contextual to -sysdir value
# TODO All skin options are contextual to -skindir value
# TODO snapshot options are mutually exclusive
# TODO Use '-snapshot-list' output for snapshot names
# TODO Complete -avd with avd names ?
# TODO -logcat: use completer from _adb
# TODO Complete options with device values
# TODO Complete -prop
_arguments \
'(- : *)-version[display emulator version number]' \
'(- : *)-help[display help information]' \
'(- : *)-help-disk-images[about disk images]' \
'(- : *)-help-keys[supported key bindings]' \
'(- : *)-help-debug-tags[debug tags for -debug <tags>]' \
'(- : *)-help-char-devices[character <device> specification]' \
'(- : *)-help-environment[environment variables]' \
'(- : *)-help-keyset-file[key bindings configuration file]' \
'(- : *)-help-virtual-device[virtual device management]' \
'(- : *)-help-sdk-images[about disk images when using the SDK]' \
'(- : *)-help-build-images[about disk images when building Android]' \
'(- : *)-help-all[prints all help content]' \
'(- : *)-help-'{version,sysdir,system,image,datadir,kernel,ramdisk,initdata,data,partition-size,cache,no-cache,nocache,sdcard,snapstorage,no-snapstorage,snapshot,no-snapshot,no-snapshot-save,no-snapshot-load,snapshot-list,no-snapshot-update-time,wipe-data,avd,skindir,skin,noskin,no-skin,memory,netspeed,netdelay,netfast,trace,show-kernel,shell,no-jni,nojni,logcat,noaudio,no-audio,audio,raw-keys,radio,port,ports,onion,onion-alpha,onion-rotation,scale,dpi-device,http-proxy,timezone,dns-server,cpu-delay,no-boot-anim,no-window,report-console,gps,keyset,shell-serial,tcpdump,bootchart,charmap,prop,shared-net-id,nand-limits,memcheck,qemu,verbose}'[print option-specific help]' \
'-sysdir[search for system disk images in the directory]: :_files -/' \
'(-system -image)'{-system,-image}'[read initial system image from the file]: :_files -g "*.img"' \
'-datadir[write user data into the directory]: :_files -/' \
'-kernel[use specific emulated kernel]: :_files' \
'-ramdisk[ramdisk image (default <system>/ramdisk.img]: :_files -g "*.img"' \
'-initdata[same as '\''-init-data <file>'\'']: :_files' \
'-data[data image (default <datadir>/userdata-qemu.img]: :_files -g "*.img"' \
'-partition-size[system/data partition size]:size (in MBs)' \
'(-no-cache -nocache)-cache[cache partition image (default is temporary file)]: :_files -g "*.img"' \
'(-cache -no-cache -nocache)'{-no-cache,-nocache}'[disable the cache partition]' \
'-sdcard[SD card image (default <system>/sdcard.img]: :_files -g "*.img"' \
'(-no-snapstorage)-snapstorage[file that contains all state snapshots (default <datadir>/snapshots.img)]: :_files -g "*.img"' \
'(-snapstorage)-no-snapstorage[do not mount a snapshot storage file (this disables all snapshot functionality)]' \
'-snapshot[name of snapshot within storage file for auto-start and auto-save (default '\''default-boot'\'')]:snapshot name' \
'-no-snapshot[perform a full boot and do not do not auto-save, but qemu vmload and vmsave operate on snapstorage]' \
'-no-snapshot-save[do not auto-save to snapshot on exit: abandon changed state]' \
'-no-snapshot-load[do not auto-start from snapshot: perform a full boot]' \
'-snapshot-list[show a list of available snapshots]' \
'-no-snapshot-update-time[do not do try to correct snapshot time on restore]' \
'-wipe-data[reset the user data image (copy it from initdata)]' \
'-avd[use a specific android virtual device]:android virtual device name' \
'-skindir[search skins in <dir> (default <system>/skins)]: :_files -/' \
'-skin[select a given skin]' \
'(-noskin -no-skin)'{-noskin,-no-skin}'[don'\''t use any emulator skin]' \
'-memory[physical RAM size in MBs]:size (in MBs)' \
'-netspeed[maximum network download/upload speeds]:speed' \
'-netdelay[network latency emulation]:delay' \
'-netfast[disable network shaping]' \
'-trace[enable code profiling (F9 to start)]:trace name' \
'-show-kernel[display kernel messages]' \
'-shell[enable root shell on current terminal]' \
{-no-jni,-nojni}'[disable JNI checks in the Dalvik runtime]' \
'-logcat[enable logcat output with given tags]:logcat tags' \
'(-audio -noaudio -no-audio)'{-noaudio,-no-audio}'[disable audio support]' \
'(-noaudio -no-audio)-audio[use specific audio backend]:audio backend' \
'-raw-keys[disable Unicode keyboard reverse-mapping]' \
'-radio[redirect radio modem interface to character device]:device' \
'-port[TCP port that will be used for the console]:port number' \
'-ports[TCP ports used for the console and adb bridge]:console port,adb port' \
'-onion[use overlay PNG image over screen]: :_files -g "*.(png|PNG)"' \
'-onion-alpha[specify onion-skin translucency]:percentage' \
'-onion-rotation[specify onion-skin rotation]:rotation:((1 2 3 4))' \
'-scale[scale emulator window]:scale' \
'-dpi-device[specify device'\''s resolution in dpi (default 165)]:dpi' \
'-http-proxy[make TCP connections through a HTTP/HTTPS proxy]:proxy' \
'-timezone[use this timezone instead of the host'\''s default]:timezone' \
'-dns-server[use this DNS server(s) in the emulated system]:DNS servers' \
'-cpu-delay[throttle CPU emulation]:CPU delay' \
'-no-boot-anim[disable animation for faster boot]' \
'-no-window[disable graphical window display]' \
'-report-console[report console port to remote socket]: :_socket' \
'-gps[redirect NMEA GPS to character device]:device' \
'-keyset[specify keyset file name]: :_files' \
'-shell-serial[specific character device for root shell]:device' \
'-tcpdump[capture network packets to file]: :_files' \
'-bootchart[enable bootcharting]:timeout' \
'-charmap[use specific key character map]: :_files' \
'*-prop[set system property on boot]:name=value' \
'-shared-net-id[join the shared network, using IP address 10.1.2.<number>]:number' \
'-nand-limits[enforce NAND/Flash read/write thresholds]:limits' \
'-memcheck[enable memory access checking]:flags' \
'-qemu[pass arguments to qemu]:arguments' \
'-verbose[same as '\''-debug-init'\'']' \
'*'{-debug,-debug-,-debug-no-}'[enable/disable specific debug messages]:tag'

20
_gem
View File

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

View File

@ -80,7 +80,7 @@ single=( --current -c --pretend -p --help -h --version -v )
_values '' \
last yesterday 1st 2nd 3rd 4th 5th
_alternative \
'*:*:_days' '*:*:_months' && return 0
'*:*:_genlop_days' '*:*:_genlop_months' && return 0
;;
--file|-f)
_arguments '*:logfile:_files' && return 0
@ -113,13 +113,13 @@ single=( --current -c --pretend -p --help -h --version -v )
_values '' \
last yesterday 1st 2nd 3rd 4th 5th
_alternative \
':*:_days' ':*:_months' && return 0
':*:_genlop_days' ':*:_genlop_months' && return 0
;;
esac
done
}
_days() {
_genlop_days() {
local m="monday" t="tuesday" w="wednesday" T="thursday" f="friday" s="saturday" S="sunday"
local day=$(date +%u)
if [[ ${day} == 1 ]] then compadd $m
@ -131,7 +131,7 @@ _days() {
elif [[ ${day} == 7 ]] then compadd $m $t $w $T $f $s $S
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 month=$(date +%m)
if [[ ${month} == 01 ]] then compadd $j

View File

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

View File

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

View File

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

View File

@ -44,10 +44,10 @@
# ------------------------------------------------------------------------------
typeset -A opt_args
local context state line
_gradle() {
typeset -A opt_args
local context state line
local curcontext="$curcontext"
_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 status
# knife cookbook list
@ -34,6 +31,10 @@ knife_general_flags=( --help --server-url --key --config --editor --format --log
_knife() {
local curcontext="$curcontext" state line
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)
_arguments \
'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(){
_arguments -s : \
$nul_args \
@ -224,7 +215,16 @@ _applist() {
_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
if ((CURRENT == 2)); then
@ -237,4 +237,4 @@ _managepy() {
fi
}
_managepy "$@"
_manage.py "$@"

6
_mvn
View File

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

View File

@ -45,7 +45,9 @@
local curcontext="$curcontext" state line
typeset -A opt_args
args=(
local -a arguments
arguments=(
'--version[output version information]'
'(-h --help)'{-h,--help}'[show help]'
'(-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'
'(-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'
'*::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() {
local context curcontext="$curcontext" state line
typeset -A opt_args
local ret=1
_arguments -C \

9
_pip
View File

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

174
_pkcon
View File

@ -39,98 +39,94 @@
# ------------------------------------------------------------------------------
_pkcon() {
local -a options
options=(
'--version[Show the program version and exit]'
'--filter[Set the filter, e.g. installed]'
"--root[Set the install root, e.g. '/' or '/mnt/ltsp']"
'(-n --nowait)'{-n,--nowait}'[Exit without waiting for actions to complete]'
'(-y --noninteractive)'{-g,--noninteractive}'[Install the packages without asking for confirmation]'
'--background[Run the command using idle network bandwidth and also using less power]'
'(-p --plain)'{-p,--plain}'[Print to screen a machine readable output, rather than using animated widgets]'
'(-c --cache-age)'{-c,--cache-age}"[The maximum metadata cache age. Use -1 for 'never'.]"
'(-h --help)'{-h,--help}'[Show help options.]'
'(-v --verbose)'{-v,--verbose}'[Show debugging information for all files]'
)
local -a options
options=(
'--version[Show the program version and exit]'
'--filter[Set the filter, e.g. installed]'
"--root[Set the install root, e.g. '/' or '/mnt/ltsp']"
'(-n --nowait)'{-n,--nowait}'[Exit without waiting for actions to complete]'
'(-y --noninteractive)'{-g,--noninteractive}'[Install the packages without asking for confirmation]'
'--background[Run the command using idle network bandwidth and also using less power]'
'(-p --plain)'{-p,--plain}'[Print to screen a machine readable output, rather than using animated widgets]'
'(-c --cache-age)'{-c,--cache-age}"[The maximum metadata cache age. Use -1 for 'never'.]"
'(-h --help)'{-h,--help}'[Show help options.]'
'(-v --verbose)'{-v,--verbose}'[Show debugging information for all files]'
)
local -a actions
actions=(
'accept-eula'
'get-roles'
'get-distro-upgrades'
'get-categories'
'get-actions'
'get-groups'
'get-filters'
'get-transactions'
'get-time'
'search'
'install'
'install-local'
'download'
'remove'
'update'
'refresh'
'resolve'
'get-updates'
'get-depends'
'get-requires'
'get-details'
'get-files'
'get-update-detail'
'get-packages'
'repo-list'
'repo-enable'
'repo-disable'
'repo-set-data'
'what-provides'
'upgrade-system'
)
local -a actions
actions=(
'accept-eula'
'get-roles'
'get-distro-upgrades'
'get-categories'
'get-actions'
'get-groups'
'get-filters'
'get-transactions'
'get-time'
'search'
'install'
'install-local'
'download'
'remove'
'update'
'refresh'
'resolve'
'get-updates'
'get-depends'
'get-requires'
'get-details'
'get-files'
'get-update-detail'
'get-packages'
'repo-list'
'repo-enable'
'repo-disable'
'repo-set-data'
'what-provides'
'upgrade-system'
)
local context state line expl cmd
local -A opt_args
local context state line expl cmd
local -A opt_args
integer i=2
while (( i < $#words )); do
case "$words[$i]" in
-*)
# skip option
(( i++ ))
continue
;;
esac
integer i=2
while (( i < $#words )); do
case "$words[$i]" in
-*)
# skip option
(( i++ ))
continue
;;
esac
if [[ -z "$cmd" ]]; then
cmd="$words[$i]"
words[$i]=()
(( CURRENT-- ))
fi
(( i++ ))
done
if [[ -z "$cmd" ]]; then
cmd="$words[$i]"
words[$i]=()
(( CURRENT-- ))
fi
(( i++ ))
done
if [[ -z "$cmd" ]]
then
_arguments -s -w : $options \
":action:($actions)"
return
fi
if [[ -z "$cmd" ]]
then
_arguments -s -w : $options \
":action:($actions)"
return
fi
case "$cmd" in
search)
_arguments : $options \
':type:(name details group file)' \
':data: :'
;;
refresh)
_arguments -s -w : $options \
'--force'
;;
*)
_arguments -s -w : $options
;;
esac
return 1
}
_pkcon "$@"
case "$cmd" in
search)
_arguments : $options \
':type:(name details group file)' \
':data: :'
;;
refresh)
_arguments -s -w : $options \
'--force'
;;
*)
_arguments -s -w : $options
;;
esac
return 1

6
_play
View File

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

10
_port
View File

@ -16,11 +16,6 @@
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=(
'activate'
'archive'
@ -97,6 +92,11 @@ case "$state" in
_describe -t commands 'port commands' subcmds
;;
(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
;;
esac

View File

@ -108,7 +108,7 @@ _quickpkg () {
# Stuff for emerge
_emerge () {
local nopkg_opts all noask_opts bopts install_args common_args profiles
local nopkg_opts all noask_opts bopts install_args common_args profiles
noask_opts=(-p -a --pretend --ask --regen --info --search -s --searchdesc \
-S --version -V --help -h --metadata)
@ -319,6 +319,7 @@ _tbz2tool () {
}
local -A Args
zparseopts -D -E -A Args -- -emerge
if (( ${+Args[--emerge]} ));then
_emerge "$@" && return 0

View File

@ -49,7 +49,7 @@
#<app-portage/portage-utils-0.19>
#
local common_args PORTDIR
local common_args PORTDIR var
var=PORTDIR
[[ -z ${(P)var} && -r /etc/make.conf ]] &&
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
# ------------------------------------------------------------------------------
local context state line
_pygmentize() {
local context state line
_arguments -s -S \
'-h[prints help]:' \
'-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 \
package-doc package-src publish publish-local run run-main test test-only \
test:compile test:package test:package-doc test:package-src update
}
_arguments "*:task:_tasks"
_arguments "*:task:_sbt_tasks"
return 0

24
_scala
View File

@ -41,7 +41,7 @@
typeset -A opt_args
local context state line
function phases () {
_scala_phases () {
compadd "parser" "namer" "packageobjects" "typer" "superaccessors" \
"pickler" "refchecks" "selectiveanf" "liftcode" "selectivecps" "uncurry" \
"tailcalls" "specialize" "explicitouter" "erasure" "lazyvals" "lambdalift" \
@ -49,6 +49,7 @@ function phases () {
"dce" "jvm" "terminal"
}
local -a shared_opts
shared_opts=(
"-bootclasspath+[Override location of bootstrap class files]:bootstrap class 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]"
)
local -a X_opts
X_opts=(
"-Xcheck-null[Warn upon selection of nullable reference]"
"-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-uescape[Disable handling of \u unicode escapes]"
"-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-pos[Print tree positions, as offsets]"
"-Xprint-types[Print tree types (debugging option)]"
@ -123,6 +125,7 @@ X_opts=(
"-Xplugin-require\:-[Abort unless the given plugin(s) are available]"
)
local -a Y_opts
Y_opts=(
"-Y[Print a synopsis of private options]"
"-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)"
"-Yrich-exceptions[Fancier exceptions. Set source search path with -Dscala.control.sourcepath]"
"-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-trees[Print detailed ASTs (requires -Xprint:phase)]"
"-Ystatistics[Print compiler statistics]"
"-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"
"-Ycheck\:-[Check the tree at the end of <phase>]:phase name:phases"
"-Ylog\:-[Log operations during <phase>]:phase name:phases"
"-Yprofile\:-[Profile CPU usage of given phases (requires jgpagent on JVM -agentpath)]:phase name:phases"
"-Yskip\:-[Skip <phase>]:phase name:phases"
"-Ystop-after\:-[Stop after given phase <phase>]:phase name:phases"
"-Ystop-before\:-[Stop before given phase <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:_scala_phases"
"-Ylog\:-[Log operations during <phase>]:phase name:_scala_phases"
"-Yprofile\:-[Profile CPU usage of given phases (requires jgpagent on JVM -agentpath)]:phase name:_scala_phases"
"-Yskip\:-[Skip <phase>]:phase name:_scala_phases"
"-Ystop-after\:-[Stop after given phase <phase>]:phase name:_scala_phases"
"-Ystop-before\:-[Stop before given phase <phase>]:phase name:_scala_phases"
"-Ywarn-all[Enable all -Y warnings]"
"-Ywarn-dead-code[Warn when dead code is identified]"
@ -188,6 +191,7 @@ Y_opts=(
"-Ytyper-debug[Trace all type assignments]"
)
local -a scala_opts
scala_opts=(
"-e+[execute <string> as if entered in the repl]:string" \
"-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
# ------------------------------------------------------------------------------
typeset -A opt_args
local context state line
_setup.py() {
typeset -A opt_args
local context state line
_setuppy() {
_arguments -s -S \
"--verbose[run verbosely (default)]" \
"-v[run verbosely (default)]" \
@ -700,4 +700,4 @@ _setuppy_upload_docs() {
"*::setup.py commands:_setuppy"
}
_setuppy "$@"
_setup.py "$@"

6
_srm
View File

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

View File

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

208
_yaourt
View File

@ -4,104 +4,6 @@
# 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
_yaourt_action_help() {
_arguments -s : \
@ -288,7 +190,113 @@ _yaourt_get_command() {
}
# 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
-Q*g*) # ipkg groups
_arguments -s : \
@ -335,4 +343,4 @@ _pacman() {
}
# 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'