Remove some compdefs that are available directly in zsh

This commit is contained in:
Julien Nicoulaud 2016-02-04 22:58:53 +01:00
parent e70e7f8941
commit 12e3dd2d5f
10 changed files with 0 additions and 2280 deletions

423
src/_adb
View File

@ -1,423 +0,0 @@
#compdef adb
# ------------------------------------------------------------------------------
# Copyright (c) 2011 Github zsh-users - http://github.com/zsh-users
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# * Neither the name of the zsh-users nor the
# names of its contributors may be used to endorse or promote products
# derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL ZSH-USERS BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
# ------------------------------------------------------------------------------
# Description
# -----------
#
# Completion script for adb (Android Debug Bridge) 1.0.26
# (http://developer.android.com/guide/developing/tools/adb.html).
#
# ------------------------------------------------------------------------------
# Authors
# -------
#
# * Julien Nicoulaud <julien.nicoulaud@gmail.com>
#
# ------------------------------------------------------------------------------
_adb() {
typeset -A opt_args
local context state line curcontext="$curcontext" adb_args
local ret=1
_arguments -C \
'(-e -s)-d[directs command to the only connected USB device, returns an error if more than one USB device is present]' \
'(-d -s)-e[directs command to the only running emulator, returns an error if more than one emulator is running]' \
'(-d -e)-s[directs command to the USB device or emulator with the given serial number]: :_adb_serial_numbers' \
'-p[simple product name or a relative/absolute path to a product out directory]: :_adb_products' \
'1: :_adb_cmds' \
'*::arg:->args' \
&& ret=0
adb_args="${(fkv)opt_args[(I)-d|-e|-s|-p]}"
case "$state" in
(args)
curcontext="${curcontext%:*:*}:adb-cmd-$words[1]:"
case $words[1] in
(help|version|devices|jdwp|bugreport|wait-for-device|start-server|kill-server|get-state|get-serialno|status-window|remount|reboot-bootloader|root|usb)
_message 'no more arguments' && ret=0
;;
(connect|disconnect)
_arguments \
'1: :_adb_host_colon_ports' \
&& ret=0
;;
(push)
_arguments \
'1:files:_files' \
'2: :_adb_remote_files -/' \
&& ret=0
;;
(pull)
_arguments \
'1: :_adb_remote_files -/' \
'2:local directory:_files -/' \
&& ret=0
;;
(sideload)
_arguments \
'1:archive:_files -g "*.zip(-.)"' \
&& ret=0
;;
(sync)
_arguments \
'-l[list but do not copy]' \
'1: :_adb_sync_directories' \
&& ret=0
;;
(shell|emu)
_arguments -C \
'1: :_adb_remote_commands' \
'*::remote-command-arg:->remote-command-args' \
&& ret=0
case "$state" in
(remote-command-args)
curcontext="${curcontext%:*:*}:adb-remote-cmd-$words[1]:"
if (( $+functions[_adb_remote_command_$words[1]_args] )); then
_adb_remote_command_$words[1] && ret=0
# TODO Write handlers for following commands:
# * am (Activity Manager)
# * pm (Package Manager)
# TODO Reuse existing compdefs for standard commands (ls, id, ifconfig, kill, etc) ?
# How do we tell them to use _remote_ files/pids/users/etc ?
else
_adb_remote_command_default && ret=0
fi
;;
esac
;;
(logcat)
local -a rotation_opts
[[ -n ${(M)words:#"-f"} ]] && rotation_opts+=('-r[rotates the log file every kbytes of output. The default value is 16]:value (in kb)')
[[ -n ${(M)words:#"-r"} ]] && rotation_opts+=('-n[sets the maximum number of rotated logs. The default value is 4]:count')
_arguments \
'-b[loads an alternate log buffer for viewing, such as event or radio. The main buffer is used by default]: :_adb_logcat_buffers' \
'-c[clears (flushes) the entire log and exits]' \
'-d[dumps the log to the screen and exits]' \
'-f[writes log message output to file. The default is stdout]: :_files' \
'-g[prints the size of the specified log buffer and exits]' \
'-s[sets the default filter spec to silent]' \
'-v[sets the output format for log messages]: :_adb_logcat_output_formats' \
"${rotation_opts[@]}" \
'*: :_adb_logcat_filter_specs' \
&& ret=0
;;
(forward)
_arguments \
'1: :_adb_local_forward_specs' \
'2: :_adb_remote_forward_specs' \
&& ret=0
;;
(install)
_arguments \
'-l[forward-lock the app]' \
'-r[reinstall the app, keeping its data]' \
'-s[install on SD card instead of internal storage]' \
'1: :_files' \
&& ret=0
;;
(uninstall)
_arguments \
'-k[keep the data and cache directories]' \
'1: :_adb_packages' \
&& ret=0
;;
(reboot)
_arguments \
'1:program:((bootloader:reboot\ into\ the\ bootloader\ program recovery:reboot\ into\ the\ recovery\ program))' \
&& ret=0
;;
(tcpip)
_arguments \
'1::port' \
&& ret=0
;;
(ppp)
# TODO Complete tty (See http://developer.android.com/guide/developing/tools/adb.html#commandsummary)
# TODO Complete PPP parameters (See http://ppp.samba.org/pppd.html)
_arguments \
'1::tty' \
'*::parameters' \
&& ret=0
;;
esac
;;
esac
return ret
}
(( $+functions[_adb_cmds] )) ||
_adb_cmds() {
_alternative \
'general-commands:general command:_adb_general_cmds' \
'device-commands:device command:_adb_device_cmds' \
'scripting-commands:scripting command:_adb_scripting_cmds'
}
(( $+functions[_adb_general_cmds] )) ||
_adb_general_cmds() {
local commands; commands=(
'help:show help message'
'version:show version number'
'devices:list all connected devices'
'connect:connect to a device via TCP/IP'
'disconnect:disconnect from a TCP/IP device'
)
_describe -t general-commands 'general command' commands "$@"
}
(( $+functions[_adb_device_cmds] )) ||
_adb_device_cmds() {
local commands; commands=(
'push:copy file/dir to device'
'pull:copy file/dir from device'
'sideload:push an update using sideload'
'sync:copy host->device only if changed'
'shell:run remote shell interactively or command'
'emu:run emulator console command'
'logcat:view device log'
'forward:forward socket connections'
'jdwp:list PIDs of processes hosting a JDWP transport'
'install:push this padbage file to the device and install it'
'uninstall:remove this app padbage from the device'
'bugreport:return all information from the device'
)
_describe -t device-commands 'device command' commands "$@"
}
(( $+functions[_adb_scripting_cmds] )) ||
_adb_scripting_cmds() {
local commands; commands=(
'wait-for-device:block until device is online'
'start-server:ensure that there is a server running'
'kill-server:kill the server if it is running'
'get-state:prints\: offline | bootloader | device'
'get-serialno:prints\: <serial-number>'
'status-window:continuously print device status for a specified device'
'remount:remounts the /system partition on the device read-write'
'reboot:reboots the device, optionally into the bootloader or recovery program'
'reboot-bootloader:reboots the device into the bootloader'
'root:restarts the adbd daemon with root permissions'
'usb:restarts the adbd daemon listening on USB'
'tcpip:restarts the adbd daemon listening on TCP on the specified port'
'ppp:run PPP over USB'
)
_describe -t scripting-commands 'scripting command' commands "$@"
}
(( $+functions[_adb_products] )) ||
_adb_products() {
_alternative \
'product-names:product name:_adb_product_names' \
'directories:directory:_files -/'
}
(( $+functions[_adb_product_names] )) ||
_adb_product_names() {
local ret=1
if [[ -n "$ANDROID_PRODUCT_OUT" ]]; then
local product_names; product_names=("$ANDROID_PRODUCT_OUT:default value set in ANDROID_PRODUCT_OUT environment variable")
_describe -t product-names 'product name' product_names && ret=0
else
_message -e product-names 'product name' && ret=0
fi
return ret
}
(( $+functions[_adb_serial_numbers] )) ||
_adb_serial_numbers() {
local serial_numbers; serial_numbers=(${${(M)${(f)"$(_call_program devices $service devices)"//:/\\:}:#*device}%%[[:space:]]*}":connected device")
[[ -n "$ANDROID_SERIAL" ]] && serial_numbers+=("$ANDROID_SERIAL:default value set in ANDROID_SERIAL environment variable")
_describe -t serial-numbers 'serial number' serial_numbers "$@" && ret=0
}
(( $+functions[_adb_packages] )) ||
_adb_packages() {
local packages; packages=(${${(ps:\r\n:)"$(_call_program packages $service $adb_args shell 'ls /data/data 2>/dev/null')"}:#\**\*})
_multi_parts . packages
}
(( $+functions[_adb_host_colon_ports] )) ||
_adb_host_colon_ports() {
local ret=1
if compset -P '*:'; then
_message -e ports 'port' && ret=0
else
_wanted hosts expl 'host' _hosts -qS: && ret=0
fi
return ret
}
(( $+functions[_adb_remote_files] )) ||
_adb_remote_files() {
local dirsonly command="ls -d ${(S)words[CURRENT]/\/*//}*/ 2>/dev/null"
zparseopts -D -E '/=dirsonly'
(( ! $#dirsonly )) && command+="; ls -d ${words[CURRENT]}* 2>/dev/null"
local files; files=(${${(ps:\r\n:)"$(_call_program files $service $adb_args shell "'$command'" 2>/dev/null)"}:#\**\*})
_multi_parts "$@" / files
}
(( $+functions[_adb_remote_commands] )) ||
_adb_remote_commands() {
local commands; commands=(${${(ps:\r\n:)"$(_call_program commands $service $adb_args shell "'IFS=:;for path_dir in \$PATH; do ls \$path_dir 2>/dev/null; done'" 2>/dev/null)"}:#\**\*})
_describe -t remote-commands 'remote command' commands && ret=0
}
(( $+functions[_adb_local_forward_specs] )) ||
_adb_local_forward_specs() {
local ret=1
if compset -P '*:'; then
case ${IPREFIX%:} in
(tcp)
_message -e ports 'port' && ret=0
;;
(localabstract|localreserved)
_wanted sockets expl 'socket' _socket && ret=0
;;
(localfilesystem)
_wanted socket-files expl 'socket file' _files && ret=0
;;
(dev)
_wanted devices expl 'device' _files -g "/dev/**" && ret=0
;;
esac
else
local modes; modes=(
'tcp:TCP socket'
'localabstract:local abstract socket'
'localreserved:local reserved socket'
'localfilesystem:local filesystem socket'
'dev:device'
)
_describe -t forward-modes 'forward mode' modes -qS: && ret=0
fi
return ret
}
(( $+functions[_adb_remote_forward_specs] )) ||
_adb_remote_forward_specs() {
local ret=1
if compset -P '*:'; then
case ${IPREFIX%:} in
(tcp)
_message -e ports 'remote port' && ret=0
;;
(localabstract|localreserved|localfilesystem)
_message -e sockets 'remote socket' && ret=0
;;
(dev)
_message -e devices 'remote device' && ret=0
;;
(jdwp)
local pids; pids=(${${(f)"$(_call_program pids $service $adb_args jdwp 2>/dev/null)"}:#\**\*})
_describe -t remote-pids 'remote pid' pids && ret=0
;;
esac
else
local modes; modes=(
'tcp:TCP socket'
'localabstract:local abstract socket'
'localreserved:local reserved socket'
'localfilesystem:local filesystem socket'
'dev:device'
'jdwp:Java Debug Wire Protocol'
)
_describe -t forward-modes 'forward mode' modes -qS: && ret=0
fi
return ret
}
(( $+functions[_adb_sync_directories] )) ||
_adb_sync_directories() {
_alternative \
'partitions:partition:((system:the\ /system\ partition data:the\ /data\ partition))' \
'directories:directory:_adb_remote_files -/'
}
(( $+functions[_adb_logcat_filter_specs] )) ||
_adb_logcat_filter_specs() {
local ret=1
if compset -P '*:'; then
local priorities; priorities=(
'V:verbose (lowest priority)'
'D:debug'
'I:info'
'W:warning'
'E:error'
'F:fatal'
'S:silent (highest priority, on which nothing is ever printed)'
)
_describe -t log-priorities 'log priority' priorities "$@" && ret=0
else
local tags; tags=(${(u)${${${(f)"$(_call_program tags $service $adb_args logcat -d 2>/dev/null)"}%%[[:space:]]#\(*}##*\/}:#\**\*})
_describe -t log-tags 'log tag' tags -qS: "$@" && ret=0
fi
return ret
}
(( $+functions[_adb_logcat_output_formats] )) ||
_adb_logcat_output_formats() {
local formats; formats=(
'brief:display priority/tag and PID of originating process (the default format)'
'process:display PID only'
'tag:display the priority/tag only'
'thread:display process:thread and priority/tag only'
'raw:display the raw log message, with no other metadata fields'
'time:display the date, invocation time, priority/tag, and PID of the originating process'
'long:display all metadata fields and separate messages with a blank lines'
)
_describe -t log-formats 'log format' formats "$@" && ret=0
}
(( $+functions[_adb_logcat_buffers] )) ||
_adb_logcat_buffers() {
local buffers; buffers=(
'main:view the main log buffer (default)'
'radio:view the buffer that contains radio/telephony related messages'
'events:view the buffer containing events-related messages'
)
_describe -t log-buffers 'log buffer' buffers "$@" && ret=0
}
(( $+functions[_adb_remote_command_default] )) ||
_adb_remote_command_default() {
_wanted remote-files expl 'remote file' _adb_remote_files
}
_adb "$@"
# Local Variables:
# mode: Shell-Script
# sh-indentation: 2
# indent-tabs-mode: nil
# sh-basic-offset: 2
# End:
# vim: ft=zsh sw=2 ts=2 et

View File

@ -1,52 +0,0 @@
#compdef bpython bpython2
# ------------------------------------------------------------------------------
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# * Neither the name of the zsh-users nor the
# names of its contributors may be used to endorse or promote products
# derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL ZSH-USERS BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
# ------------------------------------------------------------------------------
# Description
# -----------
#
# Completion script for bpython (http://bpython-interpreter.org/).
#
# ------------------------------------------------------------------------------
# Authors
# -------
#
# * Massimiliano Torromeo <massimiliano.torromeo@gmail.com>
#
# ------------------------------------------------------------------------------
_arguments -A "-*" \
'(-h --help)'{-h,--help}'[Show help message]' \
'(-i --interactive)'{-i,--interactive}'[Drop to bpython shell after running file instead of exiting]' \
'(-q --quiet)'{-q,--quiet}"[Don't flush the output to stdout]" \
'(-V --version)'{-V,--version}'[Print version and exit]' \
'--config[Use CONFIG instead of default config file]:Config file:_files' \
'*: :_files'
# Local Variables:
# mode: Shell-Script
# sh-indentation: 2
# indent-tabs-mode: nil
# sh-basic-offset: 2
# End:
# vim: ft=zsh sw=2 ts=2 et

View File

@ -1,709 +0,0 @@
#compdef cabal
# ------------------------------------------------------------------------------
# Copyright (c) 2012 Github zsh-users - http://github.com/zsh-users
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# * Neither the name of the zsh-users nor the
# names of its contributors may be used to endorse or promote products
# derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL ZSH-USERS BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
# ------------------------------------------------------------------------------
# Description
# -----------
#
# Completion script for cabal-install (http://hackage.haskell.org/trac/hackage/wiki/CabalInstall)
#
# ------------------------------------------------------------------------------
# Authors
# -------
#
# * Gérard Milmeister
# * Matvey Aksenov <matvey.aksenov@gmail.com>
#
# ------------------------------------------------------------------------------
local WORDS
_cabal ()
{
WORDS=()
for w in $words[1,(($CURRENT - 1))]; do
if [[ $w != -* ]]; then WORDS+=$w; fi
done
if (( $#WORDS == 1 )); then
_arguments \
{-h,--help}'[show help]' \
{-V,--version}'[print version information]' \
'--numeric-version[print just the version number]' \
'--config-file=[set an alternate location for the config file]:config file:_files' \
'--sandbox-config-file=[set an alternate location for the sandbox config file]:config file:_files' \
'--require-sandbox[enable requiring the presence of a sandbox for sandbox-aware commands]' \
'--no-require-sandbox[disable requiring the presence of a sandbox for sandbox-aware commands]' \
'--ignore-sandbox[ignore any existing sandbox]' \
'*::command:_cabal_command'
else
_arguments '*::command:_cabal_command'
fi
}
_cabal_command ()
{
local -a _cabal_cmds
_cabal_cmds=(
'update:updates list of known packages'
'install:installs a list of packages'
'help:help about commands'
'info:display detailed information about a particular package'
'list:list packages matching a search string'
'fetch:download packages for later installation'
"user-config:display and update the user's global cabal configuration"
"get:get a package's source code"
'init:interactively create a .cabal file'
'configure:prepare to build the package'
'build:compile all/specific components'
'clean:clean up after a build'
'run:build and run an executable'
'repl:open an interpreter session for the given component'
'test:run all/specific tests in the test suite'
'bench:run all/specific benchmarks'
'check:check the package for common mistakes'
'sdist:generate a source distribution file (.tar.gz)'
'upload:upload source packages to Hackage'
'report:upload build reports to a remote server'
'freeze:freeze dependencies'
'haddock:generate Haddock HTML documentation'
'hscolour:generate HsColour colourised code, in HTML format'
'copy:copy the files into the install locations'
'register:register this package with the compiler'
'sandbox:create/modify/delete a sandbox'
'exec:give a command access to the sandbox package repository'
)
local -a _cabal_programs
_cabal_programs=()
programs=(alex ar c2hs cpphs gcc ghc ghc-pkg ghcjs ghcjs-pkg greencard haddock happy
haskell-suite haskell-suite-pkg hmake hpc hsc2hs hscolour jhc ld lhc lhc-pkg
pkg-config strip tar uhc)
for program in $programs; do
_cabal_programs+=(
"--with-${program}=[give the path to ${program}]:file:_files"
"--${program}-options=[give extra options to ${program}]"
"--${program}-option=[give an extra option to ${program}]"
)
done
if (( CURRENT == 1 )) then
_describe -t commands 'command' _cabal_cmds || compadd "$@"
else
local curcontext="$curcontext"
cmd="${${_cabal_cmds[(r)$WORDS[2]:*]%%:*}}"
if (( $#cmd )); then
_call_function ret _cabal_$cmd
else
_message "unknown cabal command: $WORDS[2]"
fi
fi
}
_cabal_bench ()
{
_arguments \
{-h,--help}'[show help]' \
{-v-,--verbose=}'[control verbosity]:level:(0 1 2 3)' \
'--builddir=[the directory where Cabal puts generated build files]:directory:_files -/' \
'--benchmark-options=[give extra options to benchmark executables]' \
'--benchmark-option=[give an extra option to benchmark executables (no need to quote options containing spaces)]' \
{-j,--jobs=}'[run NUM jobs simultaneously]' \
$_cabal_programs \
"--only[don't reinstall add-source dependencies (sandbox-only)]"
}
_cabal_build ()
{
_arguments \
{-h,--help}'[show help]' \
{-v-,--verbose=}'[control verbosity]:level:(0 1 2 3)' \
'--builddir=[the directory where Cabal puts generated build files]:directory:_files -/' \
{-j,--jobs=}'[run NUM jobs simultaneously]' \
$_cabal_programs \
"--only[don't reinstall add-source dependencies (sandbox-only)]"
}
_cabal_check ()
{
_arguments {-h,--help}'[show help]'
}
_cabal_clean ()
{
_arguments \
{-h,--help}'[show help]' \
{-v-,--verbose=}'[control verbosity]:level:(0 1 2 3)' \
'--builddir=[the directory where Cabal puts generated build files]:directory:_files -/' \
{-s,--save-configure}'[do not remove the configuration file during cleaning; saves need to reconfigure]'
}
_cabal_configure ()
{
local context state state_descr line
typeset -A opt_args
_arguments \
{-h,--help}'[show help]' \
{-v-,--verbose=}'[control verbosity]:level:(0 1 2 3)' \
'--builddir=[the directory where Cabal puts generated build files]:directory:_files -/' \
{-g,--ghc}'[compile with GHC]' \
'--ghcjs[compile with GHCJS]' \
'--jhc[compile with JHC]' \
'--lhc[compile with LHC]' \
'--uhc[compile with UHC]' \
'--haskell-suite[compile with a haskell-suite compiler]' \
{-w,--with-compiler=}'[give the path to a particular compiler]:file:_files' \
'--with-hc-pkg=[give the path to the package tool]:file:_files' \
'--prefix=[take this prefix in preparation of installation]:directory:_files -/' \
'--bindir=[installation directory for executables]:directory:_files -/' \
'--libdir=[installation directory for libraries]:directory:_files -/' \
'--libsubdir=[subdirectory of libdir in which libs are installed]:directory:_files -/' \
'--libexecdir=[installation directory for program executables]:directory:_files -/' \
'--datadir=[installation directory for read-only data]:directory:_files -/' \
'--datasubdir=[subdirectory of datadir in which data files are installed]:directory:_files -/' \
'--docdir=[installation directory for documentation]:directory:_files -/' \
'--htmldir=[installation directory for HTML]:directory:_files -/' \
'--haddockdir=[installation directory for haddock interfaces]:directory:_files -/' \
'--sysconfdir=[installation directory for configuration files]:directory:_files -/' \
'--program-prefix=[prefix to be applied to installed executables]' \
'--program-suffix=[suffix to be applied to installed executables]' \
'--enable-library-vanilla[enable Vanilla libraries]' \
'--disable-library-vanilla[disable Vanilla libraries]' \
{-p,--enable-library-profiling}'[enable Library profiling]' \
'--disable-library-profiling[disable Library profiling]' \
'--enable-shared[enable Shared library]' \
'--disable-shared[disable Shared library]' \
'--enable-executable-dynamic[enable Executable dynamic linking]' \
'--disable-executable-dynamic[disable Executable dynamic linking]' \
'--enable-profiling[enable Executable profiling]' \
'--disable-profiling[disable Executable profiling]' \
{-O-,--enable-optimization=}'[build with optimization]:level:(0 1 2)' \
'--disable-optimization[build without optimization]' \
'--enable-debug-info=[emit debug info]:n:(0 1 2)' \
"--disable-debug-info[don't emit debug info]" \
'--enable-library-for-ghci[enable compile library for use with GHCi]' \
'--disable-library-for-ghci[disable compile library for use with GHCi]' \
'--enable-split-objs[enable split library into smaller objects]' \
'--disable-split-objs[disable split library into smaller objects]' \
'--enable-executable-stripping[enable strip executables upon installation]' \
'--disable-executable-stripping[disable strip executables upon installation]' \
'--enable-library-stripping[enable strip libraries upon installation]' \
'--disable-library-stripping[disable strip libraries upon installation]' \
'--configure-option=[extra option for configure]' \
'--user[enable doing a per-user installation]' \
'--global[disable doing a per-user installation]' \
'--package-db=[use a given package database]:: :->default-db-or-filepath' \
{-f,--flags=}'[force values for the given flags]:flags:' \
'--extra-include-dirs=[a list of directories to search for header files]:directory:_files -/' \
'--extra-lib-dirs=[a list of directories to search for externallibraries]:directory:_files -/' \
'--extra-prog-path=[A list of directories to search for required programs]:directory:_files -/' \
'--instantiate-with=[A mapping of signature names to concrete module instantiations]' \
'--enable-tests[enable dependency checking and compilation for test suites]' \
'--disable-tests[disable dependency checking and compilation for test suites]' \
'--enable-coverage[enable build library and test suites with, Haskell Program Coverage enabled (GHC only)]' \
'--disable-coverage[disable build library and test suites with, Haskell Program Coverage enabled (GHC only)]' \
'--enable-benchmarks[enable dependency checking and compilation, for benchmarks]' \
'--disable-benchmarks[disable dependency checking and compilation, for benchmarks]' \
'--enable-relocatable[enable building a package that is relocatable (GHC only)]' \
'--disable-relocatable[disable build a package that is relocatable (GHC only)]' \
$_cabal_programs \
'--cabal-lib-version=[select which version of the Cabal lib to use]' \
'--constraint=[a list of additional constraints on the dependencies]' \
'--preference=[specify preferences on the version of a package]' \
'--solver=[select dependency solver to use]:solver:(topdown modular choose)' \
'--allow-newer=[ignore upper bounds in dependencies on some or all packages]'
case $state in
(default-db-or-filepath)
_alternative \
':default db:(global user clear)' \
':filepath:_files'
;;
esac
}
_cabal_copy ()
{
_arguments \
{-h,--help}'[show help]' \
{-v-,--verbose=}'[control verbosity]:level:(0 1 2 3)' \
'--builddir=[the directory where Cabal puts generated build]:directory:_files -/' \
'--destdir=[directory to copy files to]:directory:_files -/'
}
_cabal_exec ()
{
_arguments \
{-h,--help}'[show help]' \
{-v-,--verbose=}'[control verbosity]:level:(0 1 2 3)'
}
_cabal_fetch ()
{
_arguments \
{-h,--help}'[show help]' \
{-v-,--verbose=}'[control verbosity]:level:(0 1 2 3)' \
'--dependencies[resolve and fetch dependencies]' \
'--no-dependencies[ignore dependencies]' \
'--dry-run[do not install anything, only print what would be installed]' \
'--solver=[select dependency solver to use]:solver:(topdown modular choose)]' \
'--max-backjumps=[maximum number of backjumps allowed while solving dependencies]' \
'--reorder-goals[try to reorder goals according to certain heuristics]' \
'--shadow-installed-packages[if multiple package instances of the same version are installed, treat all but one as shadowed]' \
'--strong-flags[do not defer flag choices]' \
'*:package:_cabal_list_packages'
}
_cabal_freeze ()
{
_arguments \
{-h,--help}'[show help]' \
{-v-,--verbose=}'[control verbosity]:level:(0 1 2 3)' \
'--dry-run[do not freeze anything, only print what would be frozen]' \
'--enable-tests[enable freezing of the dependencies of any tests suites in the package description file]' \
'--disable-tests[disable freezing of the dependencies of any tests suites in the package description file.]' \
'--enable-benchmarks[enable freezing of the dependencies of any benchmarks suites in the package]' \
'--disable-benchmarks[disable freezing of the dependencies of any benchmarks suites in the package]' \
'--solver=[select dependency solver to use]:solver:(topdown modular choose)]' \
'--max-backjumps=[maximum number of backjumps allowed while solving dependencies]' \
'--reorder-goals[try to reorder goals according to certain heuristics]' \
'--shadow-installed-packages[if multiple package instances of the same version are installed, treat all but one as shadowed]' \
'--strong-flags[do not defer flag choices]'
}
_cabal_get ()
{
_arguments \
{-h,--help}'[show help]' \
{-v-,--verbose=}'[control verbosity]:level:(0 1 2 3)' \
{-d-,--destdir=}'[where to unpack the packages]:directory:_files -/' \
{-s,--source-repository=}"[copy the package's source repository]" \
'--pristine[unpack the original pristine tarball, rather than updating the .cabal file with the latest revision from the package archive]' \
'*:package:_cabal_list_packages'
}
_cabal_haddock ()
{
_arguments \
{-h,--help}'[show help]' \
{-v-,--verbose=}'[control verbosity]:level:(0 1 2 3)' \
'--builddir=[the directory where Cabal puts generated files]:directory:_files -/' \
'--keep-temp-files[keep temporary files]' \
'--hoogle[generate a hoogle database]' \
'--html[generate HTML documentation]' \
'--html-location=[location of HTML documentation]:url:' \
'--executables[run haddock for Executables targets]' \
'--tests[run haddock for Test Suite targets]' \
'--benchmarks[run haddock for Benchmark targets]' \
'--all[run haddock for all targets]' \
'--internal[run haddock for internal modules]' \
'--css=[path to the haddock stylesheet]:file:_files' \
'--hyperlink-source[hyperlink the documentation to the source code]' \
'--hscolour-css=[path to the HsColour stylesheet]:file:_files' \
'--contents-location=[bake URL in as the location for the contents page]:url:' \
'--with-ghc=[path to ghc]:file:_files' \
'--with-haddock=[path to haddock]:file:_files' \
'--PROG-option=[give an extra option to PROG (no need to quote options containing spaces)]:option:' \
'--ghc-options=[give extra options to ghc]:option:' \
'--haddock-options=[give extra options to haddock]:option:' \
}
_cabal_help ()
{
local -a cmds
cmds=(update install help info list fetch user-config get init configure build clean run
repl test bench check sdist upload report freeze haddock hscolour copy register sandbox exec)
_arguments \
{-h,--help}'[Show help]' \
'*::command:( $cmds )'
}
_cabal_hscolour ()
{
_arguments \
{-h,--help}'[show help]' \
{-v-,--verbose=}'[control verbosity]:level:(0 1 2 3)' \
'--builddir=[the directory where Cabal puts generated files]:directory:_files -/' \
'--executables[run hscolour for Executables targets]' \
'--tests[run hscolour for Test Suite targets]' \
'--benchmarks[run hscolour for Benchmarks targets]' \
'--all[run hscolour for all targets]' \
'--css=[path to stylesheet]:file:_files'
}
_cabal_info ()
{
local context state state_descr line
typeset -A opt_args
_arguments \
{-h,--help}'[show help]' \
{-v-,--verbose=}'[control verbosity]:level:(0 1 2 3)' \
'--package-db=[use a given package database]:: :->default-db-or-filepath' \
'*:package:_cabal_list_packages'
case $state in
(default-db-or-filepath)
_alternative \
':default db:(global user clear)' \
':filepath:_files'
;;
esac
}
_cabal_install ()
{
local context state state_descr line
typeset -A opt_args
_arguments \
{-h,--help}'[show help]' \
{-v-,--verbose=}'[control verbosity]:level:(0 1 2 3)' \
'--builddir=[the directory where Cabal puts generated build files]:directory:_files -/' \
{-g,--ghc}'[compile with GHC]' \
'--ghcjs[compile with GHCJS]' \
'--jhc[compile with JHC]' \
'--lhc[compile with LHC]' \
'--uhc[compile with UHC]' \
'--haskell-suite[compile with a haskell-suite compiler]' \
{-w,--with-compiler=}'[give the path to a particular compiler]:file:_files' \
'--with-hc-pkg=[give the path to the package tool]:file:_files' \
'--prefix=[take this prefix in preparation of installation]:directory:_files -/' \
'--bindir=[installation directory for executables]:directory:_files -/' \
'--libdir=[installation directory for libraries]:directory:_files -/' \
'--libsubdir=[subdirectory of libdir in which libs are installed]:directory:_files -/' \
'--libexecdir=[installation directory for program executables]:directory:_files -/' \
'--datadir=[installation directory for read-only data]:directory:_files -/' \
'--datasubdir=[subdirectory of datadir in which data files are installed]:directory:_files -/' \
'--docdir=[installation directory for documentation]:directory:_files -/' \
'--htmldir=[installation directory for HTML]:directory:_files -/' \
'--haddockdir=[installation directory for haddock interfaces]:directory:_files -/' \
'--sysconfdir=[installation directory for configuration files]:directory:_files -/' \
'--program-prefix=[prefix to be applied to installed executables]' \
'--program-suffix=[suffix to be applied to installed executables]' \
'--enable-library-vanilla[enable Vanilla libraries]' \
'--disable-library-vanilla[disable Vanilla libraries]' \
{-p,--enable-library-profiling}'[enable Library profiling]' \
'--disable-library-profiling[disable Library profiling]' \
'--enable-shared[enable Shared library]' \
'--disable-shared[disable Shared library]' \
'--enable-executable-dynamic[enable Executable dynamic linking]' \
'--disable-executable-dynamic[disable Executable dynamic linking]' \
'--enable-profiling[enable Executable profiling]' \
'--disable-profiling[disable Executable profiling]' \
{-O-,--enable-optimization=}'[build with optimization]:level:(0 1 2)' \
'--disable-optimization[build without optimization]' \
'--enable-debug-info=[emit debug info]:n:(0 1 2)' \
"--disable-debug-info[don't emit debug info]" \
'--enable-library-for-ghci[enable compile library for use with GHCi]' \
'--disable-library-for-ghci[disable compile library for use with GHCi]' \
'--enable-split-objs[enable split library into smaller objects]' \
'--disable-split-objs[disable split library into smaller objects]' \
'--enable-executable-stripping[enable strip executables upon installation]' \
'--disable-executable-stripping[disable strip executables upon installation]' \
'--enable-library-stripping[enable strip libraries upon installation]' \
'--disable-library-stripping[disable strip libraries upon installation]' \
'--configure-option=[extra option for configure]' \
'--user[enable doing a per-user installation]' \
'--global[disable doing a per-user installation]' \
'--package-db=[use a given package database]:: :->default-db-or-filepath' \
{-f,--flags=}'[force values for the given flags]:flags:' \
'--extra-include-dirs=[a list of directories to search for header files]:directory:_files -/' \
'--extra-lib-dirs=[a list of directories to search for external libraries]:directory:_files -/' \
'--extra-prog-path=[a list of directories to search for required programs]:directory:_files -/' \
'--instantiate-with=[A mapping of signature names to concrete module instantiations]' \
'--enable-tests[enable dependency checking and compilation for test suites]' \
'--disable-tests[disable dependency checking and compilation for test suites]' \
'--enable-coverage[enable build library and test suites with, Haskell Program Coverage enabled. (GHC only)]' \
'--disable-coverage[disable build library and test suites with, Haskell Program Coverage enabled. (GHC only)]' \
'--enable-benchmarks[enable dependency checking and compilation, for benchmarks]' \
'--disable-benchmarks[disable dependency checking and compilation, for benchmarks]' \
'--enable-relocatable[enable building a package that is relocatable (GHC only)]' \
'--disable-relocatable[disable build a package that is relocatable (GHC only)]' \
$_cabal_programs \
'--cabal-lib-version=[select which version of the Cabal lib to use]' \
'--constraint=[a list of additional constraints on the dependencies]' \
'--preference=[specify preferences on the version of a package]' \
'--solver=[select dependency solver to use]:solver:(topdown modular choose)' \
'--allow-newer=[ignore upper bounds in dependencies on some or all packages]' \
'--enable-documentation[enable building of documentation]' \
'--disable-documentation[disable building of documentation]' \
'--doc-index-file=[a central index of haddock API documentation]:file:_files' \
'--dry-run[do not install anything]' \
'--max-backjumps=[maximum number of backjumps allowed while solving dependencies]' \
'--reorder-goals[try to reorder goals according to certain heuristics]' \
'--shadow-installed-packages[if multiple package instances of the same version are installed, treat all but one as shadowed]' \
'--strong-flags[do not defer flag choices]' \
'--reinstall[always install]' \
'--avoid-reinstalls[do not select versions that would destructively overwrite installed packages]' \
'--force-reinstalls[reinstall packages even if they will most likely break other installed packages]' \
'--upgrade-dependencies[pick the latest version for all dependencies, rather than trying to pick an installed version]' \
{--only-dependencies,--dependencies-only}'[install only the dependencies necessary to build the given packages]' \
'--root-cmd=[command used to gain root privileges]::' \
'--symlink-bindir=[add symlinks into this directory]:directory:_files -/' \
'--build-summary=[save build summaries to file]:file:_files' \
'--build-log=[log all builds to file]:file:_files' \
'--remote-build-reporting=[generate build reports to send to a remote]:level:(none anonymous detailed)' \
'--remote-planning-failure[generate build reports when the dependency solver fails]' \
'--one-shot[do not record the packages in the world file]' \
'--run-tests[run package test suites during installation]' \
{-j,--jobs=}'[run NUM jobs simultaneously]' \
'--haddock-hoogle[generate a hoogle database]' \
'--haddock-html[generate HTML documentation]' \
'--haddock-html-location=[location of HTML documentation]:url:' \
'--haddock-executables[run haddock for Executables targets]' \
'--haddock-tests[run haddock for Test Suite targets]' \
'--haddock-benchmarks[run haddock for Benchmarks targets]' \
'--haddock-all[run haddock for all targets]' \
'--haddock-internal[run haddock for internal modules]' \
'--haddock-css=[path to the haddock stylesheet]:file:_files' \
'--haddock-hyperlink-source[hyperlink the documentation to the source code]' \
'--haddock-hscolour-css=[path to the HsColour stylesheet]:file:_files' \
'--haddock-contents-location=[bake URL in as the location for the contents page]:url:' \
'*:: :->package-or-cabal-file'
case $state in
(default-db-or-filepath)
_alternative \
':default db:(global user clear)' \
':filepath:_files'
;;
(package-or-cabal-file)
_alternative \
':package:_cabal_list_packages' \
':files:_files -g "*.cabal"'
;;
esac
}
_cabal_list ()
{
local context state state_descr line
typeset -A opt_args
_arguments \
{-h,--help}'[show help]' \
{-v-,--verbose=}'[control verbosity]:level:(0 1 2 3)' \
'--installed[only print installed packages]' \
'--simple-output[print in a easy-to-parse format]' \
'--package-db=[use a given package database]:: :->default-db-or-filepath' \
'*:package:_cabal_list_packages'
case $state in
(default-db-or-filepath)
_alternative \
':default db:(global user clear)' \
':filepath:_files'
;;
esac
}
_cabal_register ()
{
_arguments \
{-h,--help}'[show help]' \
{-v-,--verbose=}'[control verbosity]:level:(0 1 2 3)' \
'--builddir=[the directory where Cabal puts generated files]:directory:_files -/' \
"--user[register in user's local package database]" \
"--global[register in the system-wide package database]" \
'--inplace[register in build location]' \
'--gen-script[generate a script to register later]' \
'--gen-pkg-config=[generate package registration file]' \
'--print-ipid[print the installed package ID calculated for this package]'
}
_cabal_repl ()
{
_arguments \
{-h,--help}'[show help]' \
{-v-,--verbose=}'[control verbosity]:level:(0 1 2 3)' \
'--builddir=[the directory where Cabal puts generated build files]:directory:_files -/' \
$_cabal_programs \
"--only[don't reinstall add-source dependencies (sandbox-only)]"
}
_cabal_report ()
{
_arguments \
{-h,--help}'[show help]' \
{-v-,--verbose=}'[control verbosity]:level:(0 1 2 3)' \
{-u,--username=}'[hackage username]' \
{-p,--password=}'[hackage password]'
}
_cabal_run ()
{
_arguments \
{-h,--help}'[show help]' \
{-v-,--verbose=}'[control verbosity]:level:(0 1 2 3)' \
'--builddir=[the directory where Cabal puts generated build files]:directory:_files -/' \
{-j,--jobs=}'[run NUM jobs simultaneously]' \
$_cabal_programs \
"--only[don't reinstall add-source dependencies (sandbox-only)]"
}
_cabal_sandbox ()
{
_arguments \
{-h,--help}'[show help]' \
{-v-,--verbose=}'[control verbosity]:level:(0 1 2 3)' \
'--sandbox=[Sandbox location]:sandbox:_files -/'
if (( $#WORDS == 2 )); then
local -a _cabal_sandbox_cmds
_cabal_sandbox_cmds=(
'init:initialize the sandbox'
'delete:remove the sandbox deleting all the packages installed inside'
'add-source:make one or more local package available in the sandbox'
'delete-source:remove an add-source dependency'
'list-sources:list add-source dependencies'
'hc-pkg:call sandbox related haskell compiler package database'
)
_describe -t sandbox-commands 'sandbox-command' _cabal_sandbox_cmds || compadd "$@"
else
case $WORDS[3] in
add-source)
_arguments \
{-h,--help}'[show help]' \
{-v-,--verbose=}'[control verbosity]:level:(0 1 2 3)' \
'--snapshot[take a snapshot instead of creating a link]' \
'--sandbox=[Sandbox location]:sandbox:_files -/' \
'*:sources:_files -/'
;;
delete-source)
_arguments \
'*:sources:_files -/'
;;
init | delete | list-sources | hc-pkg)
_message 'no more arguments'
;;
*)
_message "unknown cabal sandbox command: $WORDS[3]"
;;
esac
fi
}
_cabal_sdist ()
{
_arguments \
{-h,--help}'[show help]' \
{-v,--verbose=}'[control verbosity]:level:(0 1 2 3)' \
'--builddir=[the directory where Cabal puts generated files]:directory:_files -/' \
"--list-sources=[just write a list of the package's sources to a file]:directory:_files -/" \
'--snapshot[produce a snapshot source distribution]' \
'--output-directory=[generate a source distribution in the given directory]:directory:_files -/' \
'--targz[produce a .tar.gz format archive]' \
'--zip[produce a .zip format archive]'
}
_cabal_test ()
{
_arguments \
{-h,--help}'[show help]' \
{-v-,--verbose=}'[control verbosity]:level:(0 1 2 3)' \
'--builddir=[the directory where Cabal puts generated files]:directory:_files -/' \
'--log=[log all test suite results to file]:file:_files' \
'--machine-log=[produce a machine-readable log file]:file:_files' \
'--show-details=[when to show results of individual test cases?]:filter:(always never failures)' \
'--keep-tix-files[keep .tix files for HPC between test runs]' \
'--test-options=[give extra options to test executables]' \
'--test-option=[give an extra option to test executables]' \
{-j,--jobs=}'[run NUM jobs simultaneously]' \
$_cabal_programs \
"--only[don't reinstall add-source dependencies (sandbox-only)]"
}
_cabal_update ()
{
_arguments \
{-h,--help}'[show help]' \
{-v-,--verbose=}'[control verbosity]:level:(0 1 2 3)'
}
_cabal_upload ()
{
_arguments \
{-h,--help}'[show help]' \
{-v-,--verbose=}'[control verbosity]:level:(0 1 2 3)' \
{-c,--check}'[do not upload, just do QA checks]' \
{-u-,--username=}'[hackage username]' \
{-p-,--password=}'[hackage password]' \
'*:file:_files -g "*.tar.gz"'
}
_cabal_list_packages () {
_cabal_get_available_packages
_cabal_get_available_files=(*.cabal)
compadd "$@" -a -- _cabal_available_packages _cabal_get_available_files
}
_cabal_get_available_packages ()
{
if ( [[ ${+_cabal_available_packages} -eq 0 ]] || _cache_invalid CABAL_AVAILABLE_PACKAGES ) &&
! _retrieve_cache CABAL_AVAILABLE_PACKAGES;
then
_cabal_available_packages=( $(cabal list --simple-output | cut -d' ' -f1 | uniq) )
_store_cache CABAL_AVAILABLE_PACKAGES _cabal_available_packages
fi
}
_cabal_user-config ()
{
_arguments \
{-h,--help}'[show help]' \
{-v-,--verbose=}'[control verbosity]:level:(0 1 2 3)'
if (( $#WORDS == 2 )); then
local -a _cabal_user_config_cmds
_cabal_user_config_cmds=(
"diff:show a pseudo-diff of the user's ~/.cabal/config file and the default configuration"
'update:applies the pseudo-diff to the default configuration and write the result to ~/.cabal/config'
)
_describe -t user-config-commands 'user-config-command' _cabal_user_config_cmds || compadd "$@"
else
case $WORDS[3] in
diff | update)
_message 'no more arguments'
;;
*)
_message "unknown cabal user-config command: $WORDS[3]"
;;
esac
fi
}
_cabal "$@"

View File

@ -1,139 +0,0 @@
#compdef gradle gradlew
# ------------------------------------------------------------------------------
# Copyright (c) 2011 Github zsh-users - http://github.com/zsh-users
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# * Neither the name of the zsh-users nor the
# names of its contributors may be used to endorse or promote products
# derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL ZSH-USERS BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
# ------------------------------------------------------------------------------
# Description
# -----------
#
# Completion script for Gradle 1.0-milestone-5 (http://www.gradle.org).
#
# Status: incomplete (see TODO/FIXME tags)
#
# ------------------------------------------------------------------------------
# Authors
# -------
#
# * Julien Nicoulaud <julien.nicoulaud@gmail.com>
#
# ------------------------------------------------------------------------------
# Wrapper Support
if [[ $service == "gradlew" && -x "./gradlew" ]] ; then
service="./$service"
fi
_gradle() {
typeset -A opt_args
local context state line
local curcontext="$curcontext"
_arguments \
'(- 1 *)'{-?,-h,--help}'[show help message]' \
'(-a --no-rebuild)'{-a,--no-rebuild}'[do not rebuild project dependencies]' \
'(-b --build-file)'{-b,--build-file}'[specify the build file]:build file:_gradle_scripts' \
'(-C --cache)'{-C,--cache}'[specify how compiled build scripts should be cached]:cache strategy:((rebuild\:rebuild\ the\ cache on\:use\ the\ cache\ \(default\)))' \
'(-c --settings-file)'{-c,--settings-file}'[specify the settings file]:settings file:_gradle_scripts' \
'*'{-D-,--system-prop}'[set system property of the JVM]:property:_gradle_properties' \
'(-d --debug -q --quiet -i --info)'{-d,--debug}'[log in debug mode (includes normal stacktrace)]' \
'(--foreground --no-daemon --stop)--daemon[use the Gradle daemon to run the build, starts the daemon if not running]' \
'(-e --embedded)'{-e,--embedded}'[specify an embedded build script]:embedded build script' \
'(--daemon --no-daemon --stop)--foreground[start the Gradle daemon in the foreground]' \
'(-g --gradle-user-home)'{-g,--gradle-user-home}'[specify the gradle user home directory]: :_files -/' \
'--gui[launch a GUI application]' \
'(-I --init-script)'{-I,--init-script}'[specify an initialization script]:init script:_gradle_scripts' \
'(-i --info -q --quiet -d --debug)'{-i,--info}'[set log level to info]' \
'(-m --dry-run)'{-m,--dry-run}'[run the builds with all task actions disabled]' \
'(-n --dependencies)'{-n,--dependencies}'[show list of all project dependencies]' \
'--no-color[do not use color in the console output]' \
'(--daemon --foreground --stop)--no-daemon[do not use the Gradle daemon to run the build]' \
'--no-opt[ignore any task optimization]' \
'*'{-P-,--project-prop}'[set project property for the build script]:property:_gradle_properties' \
'(-p --project-dir)'{-p,--project-dir}'[specify the start directory for Gradle]: :_files -/' \
'--profile[profile build execution time and generate a report in the <build_dir>/reports/profile directory]' \
'(-q --quiet -d --debug -i --info)'{-q,--quiet}'[log errors only]' \
'(-r --properties)'{-r,--properties}'[show list of all available project properties]' \
'(-S --full-stacktrace)'{-S,--full-stacktrace}'[print out the full (very verbose) stacktrace for any exceptions]' \
'(-s --stacktrace)'{-s,--stacktrace}'[print out the stacktrace also for user exceptions]' \
'(--daemon --foreground)--stop[stop the Gradle daemon if it is running]' \
'(-t --tasks)'{-t,--tasks}'[show list of available tasks]' \
'(-u --no-search-upward)'{-u,--no-search-upward}'[don'\''t search in parent folders for a settings.gradle file]' \
'(-v --version)'{-v,--version}'[print version info]' \
'(-x --exclude-task)*'{-x,--exclude-task}'[specify a task to be excluded from execution]:task:_gradle_tasks' \
'*: :_gradle_tasks'
}
(( $+functions[_gradle_tasks] )) ||
_gradle_tasks() {
local alternatives task_group task_group_name task_group_tasks
local project="${PREFIX%:*}"
alternatives=("project:project:_gradle_projects -qS:")
for task_group in ${(M)${(ps:\n\n:)"$($service --daemon --quiet --no-color ${project}:tasks 2>/dev/null)"}:#*[[:space:]]\-[[:space:]]*}; do
task_group_name="${${${task_group%%---*}%[[:space:]]tasks[[:space:]]*}:l}"
task_group_tasks=(${(q)${(f)${task_group##*---}}/[[:space:]]\-[[:space:]]/:})
alternatives+=("${task_group_name//[[:space:]]/-}-task:${task_group_name} task:((${task_group_tasks[@]}))")
done
_alternative "${alternatives[@]}"
}
(( $+functions[_gradle_projects] )) ||
_gradle_projects() {
local project="${PREFIX%:*}"
local projects; projects=(${${${(M)${(f)"$($service --daemon --quiet --no-color ${project}:projects 2>/dev/null)"}:#*--- Project\ \':*}#*\'}%\'*})
_multi_parts $@ : projects
}
(( $+functions[_gradle_scripts] )) ||
_gradle_scripts() {
_files -g '*.gradle*'
}
(( $+functions[_gradle_properties] )) ||
_gradle_properties() {
local ret=1
if compset -P '*='; then
_message -e property-values 'property value' && ret=0
else
_wanted property-names expl 'property name' _gradle_property_names -qS= && ret=0
fi
return ret
}
(( $+functions[_gradle_property_names] )) ||
_gradle_property_names() {
local property_names; property_names=(${${(M)${(f)"$($service --daemon --quiet --no-color :properties 2>/dev/null)"}:#*:*}%%:*})
_describe -t property_names 'property name' property_names "$@"
}
_gradle "$@"
# Local Variables:
# mode: Shell-Script
# sh-indentation: 2
# indent-tabs-mode: nil
# sh-basic-offset: 2
# End:
# vim: ft=zsh sw=2 ts=2 et

View File

@ -1,35 +0,0 @@
#compdef mosh
# ------------------------------------------------------------------------------
# Description
# -----------
#
# Completion script for mosh (http://mosh.mit.edu).
#
# Source: https://gist.github.com/2242920
#
# ------------------------------------------------------------------------------
# Authors
# -------
#
# * Ben O'Hara (https://github.com/benohara)
#
# ------------------------------------------------------------------------------
_arguments \
'--client=:client helper:_command_names -e' \
'--server=:server helper:_files' \
'--ssh=:ssh command to run:_files' \
'(-a -n)--predict=:when:(adaptive always never)' \
'(--predict -n)-a[predict always]' \
'(--predict -a)-n[predict never]' \
{-p,--port=}':port:_ports' \
':remote:_hosts' \
':remote command:_command_names -e'
# Local Variables:
# mode: Shell-Script
# sh-indentation: 2
# indent-tabs-mode: nil
# sh-basic-offset: 2
# End:
# vim: ft=zsh sw=2 ts=2 et

56
src/_nl
View File

@ -1,56 +0,0 @@
#compdef nl
# ------------------------------------------------------------------------------
# Description
# -----------
#
# Completion script for GNU nl (coreutils 8.13).
#
# ------------------------------------------------------------------------------
# Authors
# -------
#
# * github.com/RobSis
#
# ------------------------------------------------------------------------------
local arguments style_values format_values ret=1
style_values=(
"a:number all lines"
"t:number only nonempty lines"
"n:number no lines"
"pBRE:number only lines that contain a match for the basic regular expression, BRE"
)
format_values=(
"ln:left justified, no leading zeros"
"rn:right justified, no leading zeros"
"rz:right justified, leading zeros"
)
_arguments -C -s -S \
{-b+,--body-numbering=}'[use STYLE for given number of lines]:style:->style' \
{-d+,--section-delimiter=}'[use CC for separating logical pages]' \
{-f+,--footer-numbering=}'[use STYLE for numbering footer lines]:style:->style' \
{-h+,--header-numbering=}'[use STYLE for numbering header lines]:style:->style' \
{-i+,--line-increment=}'[line number increment at each line]' \
{-l+,--join-blank-lines=}'[group of NUMBER empty lines counted as one]' \
{-n+,--number-format=}'[insert line numbers according to FORMAT]:format:->format' \
{-p,--no-renumber}'[do not reset line numbers at logical pages]' \
{-s+,--number-separator=}'[add STRING after (possible) line number]' \
{-v+,--starting-line-number=}'[first line number on each logical page]' \
{-w+,--number-width=}'[use NUMBER columns for line numbers]' \
--help'[display help and exit]' \
--version'[output version information and exit]' \
'*:filename:_files' && ret=0
case "$state" in
(style)
_describe -t style style style_values && ret=0
;;
(format)
_describe -t format format format_values && ret=0
;;
esac
return $ret

102
src/_ps
View File

@ -1,102 +0,0 @@
#compdef ps
# This works with procps version 3.2.8
local context state state_descr line
typeset -A opt_args
local filterexcl="(-A -a -C -d -e -g -G --group --Group -p --pid --ppid -s --sid -t --tty -u -U --user --User)"
_arguments -s -w \
"$filterexcl-A[all processes]"\
"$filterexcl-a[all w/ tty except session leaders]"\
"--cumulative[include some dead child process data (as a sum with the parent)]"\
"(-f -F --format -l -o -O)--context[display security context format (for SE Linux)]"\
"-c[show different scheduler information]"\
"$filterexcl-C[by command name]:processes:->pname"\
"(--columns)--cols[set screen width]:width:( )"\
"(--cols)--columns[set screen width]:width:( )"\
"--deselect[negate selection]"\
"$filterexcl-d[all except session leaders]"\
"$filterexcl-e[all processes]"\
"--forest[ASCII art process tree]"\
"(--context -F --format -o -O)-f[full format listing]"\
"(--context -f --format -o -O)-F[extra full format]"\
"(--context -f -F -j -l -o -O)--format[user-defined format]:output format:->format"\
"$filterexcl-g[by session OR by effective group name]:groups:_groups"\
"$filterexcl-G[by real group ID (supports names)]:groups:->rgid"\
"$filterexcl--group[by session OR by effective group name]:groups:_groups"\
"$filterexcl--Group[by real group ID (supports names)]:groups:->rgid"\
"-H[show process hierarchy]"\
"(--no-heading)--heading[repeat header lines, one per page of output]"\
"-j[jobs format]"\
"-l[long format. the -y option is often useful with this]"\
"-L[show threads, possibly with LWP and NLWP columns]"\
"-m[show threads after processes]"\
"-M[add a column of security data]"\
"-N[negate selection]"\
"(--heading --header)--no-heading[omit header lines]"\
"(--context -f -F --format -j -l)-o[user-defined format]:output format:->format"\
"(--context -f -F --format -j -l)-O[preloaded -o (user-defined with some)]:output format:->format"\
"$filterexcl-p[by process ID]:process IDs:->pid"\
"$filterexcl--pid[by process ID]:process IDs:->pid"\
"$filterexcl--ppid[select by parent process ID]:process IDs:->ppid"\
"--rows[set screen height.]:height:( )"\
"$filterexcl-s[by session IDs]:sessions:->sid"\
"$filterexcl--sid[by session IDs]:sessions:->sid"\
"--sort[specify sorting order]:sort specs:->sortspec"\
"$filterexcl-t[by tty]:ttys:->tty"\
"-T[show threads, possibly with SPID column]"\
"$filterexcl--tty[by tty]:ttys:->tty"\
"$filterexcl-u[by effective user ID (supports names)]:users:_users"\
"$filterexcl-U[by real user ID (supports names)]:users:_users"\
"$filterexcl--user[by effective user ID (supports names)]:users:_users"\
"$filterexcl--User[by real user ID (supports names)]:users:_users"\
"(--version)-V[print the procps version]"\
"(-V)--version[print the procps version]"\
"-w[wide output]"\
"-y[use with -l, do not show flags, show rss in place of addr]"\
"1:BSD-style options (complete - to see unix & gnu-style options):((T\:'all processes on this terminal' a\:'all w/ tty, including other users' r\:'only running processes' x\:'processes w/o controlling ttys' t\:'list by tty' j\:'BSD jobs control format' l\:'BSD long format' s\:'signal format' v\:'virtual memory format' u\:'user-oriented format' X\:'register format' L\:'list format codes' S\:'sum info of children into parents' c\:'true command name' n\:'numeric WCHAN & UID' H\:'show threads as if they were processes' U\:'by effective user ID' p\:'by process ID'))"\
- debug "--info[print debugging info]"
case "$state" in
pid)
_values -s , 'process id' "${(uonzf)$(ps -A o pid=)}"
;;
rgid)
_values -s , 'process group id' "${(uonzf)$(ps -A o rgid=)}"
;;
pname)
local ispat="pattern matching "
if (( ${+opt_args[-x]} ))
then
ispat=""
fi
if (( ${+opt_args[-f]} ))
then
_wanted pname expl $ispat'process command line' compadd ${(u)${(f)"$(ps -A o cmd=)"}}
else
_wanted pname expl $ispat'process name' compadd ${(u)${(f)"$(ps -A co cmd=)"}}
fi
;;
sid)
_values -s , 'session id' "${(uonzf)$(ps -A o sid=)}"
;;
tty)
local -a ttys
ttys=( /dev/tty*(N) /dev/pts/*(N) )
_values -s , 'terminal device' ${ttys#/dev/}
;;
ppid)
_values -s , 'parent process id' "${(uonzf)$(ps -A o ppid=)}"
;;
sortspec)
_values -s , 'format specifier (prefix with - for decreasing order)' "${(uozf)$(ps L|cut -f 1 -d" ")}"
;;
format)
_values -s , 'format specifier' "${(uozf)$(ps L|cut -f 1 -d" ")}"
;;
esac
# Local Variables:
# mode:shell-script
# End:

View File

@ -1,112 +0,0 @@
#compdef qdbus
#
# Copyright (C) 2015 Thomas Mitterfellner <thomas.mitterfellner@gmail.com>
#
# This file is released under the GPLv2.
#
# version 0.1
# get the type of a method: 1 means function, 2 means property
getType () {
case "$1" in
"method"*) echo 1 ;;
"property"*) echo 2 ;;
*) echo 0 ;;
esac
}
# get the index of a method in an array of methods
getIndex () {
local e
local index
local type_
index=0
for e in "${@:2}"; do
index=$(( index + 1 ))
type_=$(getType "$e")
if [[ $type_ == 1 ]] ; then
if [[ "$e" == *"$1("* ]] ; then
echo $index
return 0
fi
elif [[ $type_ == 2 ]] ; then
if [[ "$e" == *"$1" ]] ; then
echo $index
return 0
fi
fi
done
echo 0
}
_qdbus() {
local curcontext="$curcontext" state line
local services
local path_
local methods
local names
local types
local properties
local index
typeset -A opt_args
_arguments "--system[connect to system bus]"\
"--literal[print literal replies]"\
"1:service name:->service"\
"2:path:->path"\
"3:method:->method"\
"*:arguments:->arguments"
case $state in
service)
services=( $(qdbus ${words[@]:1:-1} | grep -E '^([^:])') )
compadd "$@" $services
;;
path)
path_=( $(qdbus ${words[@]:1:-1} 2>/dev/null) )
compadd "$@" $path_
;;
method)
IFS=$'\n'
methods=( $(qdbus ${words[@]:1:-1} | \
grep -e "^method" | \
sed -r 's/method (.+) (.+)\((.*)\)/\2:\1(\3)/g' 2>/dev/null) )
properties=( $(qdbus ${words[@]:1:-1} | \
grep -e "^property" | \
sed -r 's/property (.+) (.+) (.+)/\3:\1 \2/g' 2>/dev/null) )
_describe properties properties -J properties
_describe methods methods -J methods
;;
arguments)
IFS=$'\n'
path_pos=$(( ${(M)#words:#--*} + 2))
method_pos=$(( $path_pos + 2))
names=( $(qdbus ${words[@]:1:$path_pos} | grep -e '^[mp]' 2>/dev/null) )
index=$(getIndex "${words[$method_pos]}" $names[@])
method=$names[$index]
arg_pos=$(( ${#words} - $method_pos ))
if [[ $(getType "$method") -eq 1 ]] ; then
method_args="$(echo $method | sed -r 's/(.+) (.+) (.+)\((.*)\)/\4/g')"
IFS=$',' method_args_=(${=method_args})
num_args=${#method_args_}
if [[ $arg_pos -le $num_args ]] ; then
_message "${method_args_[$arg_pos]}"
fi
else
property_=$(echo "$method" |\
sed -r 's/property (.+) (.+) (.+)/\1 \2/g')
if [[ $arg_pos -eq 1 ]] ; then
_message ${property_}
fi
fi
;;
esac
}

View File

@ -1,55 +0,0 @@
#compdef watch
# ------------------------------------------------------------------------------
# Copyright (c) 2014 Github zsh-users - http://github.com/zsh-users
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# * Neither the name of the zsh-users nor the
# names of its contributors may be used to endorse or promote products
# derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL ZSH-USERS BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
# ------------------------------------------------------------------------------
# Description
# -----------
#
# Completion script for watch (https://gitorious.org/procps/procps).
#
# ------------------------------------------------------------------------------
# Authors
# -------
#
# * Nicolas Iooss (https://github.com/fishilico)
#
# ------------------------------------------------------------------------------
_arguments \
'(-b --beep)'{-b,--beep}'[beep if command has a non-zero exit]' \
'(-c --color)'{-c,--color}'[interpret ANSI color sequences]' \
'(-d --differences)'{-d,--differences}'[highlight changes between updates]' \
'(-d --differences)--differences=permanent[highlight changes since the first iteration]' \
'(-e --errexit)'{-e,--errexit}'[exit if command has a non-zero exit]' \
'(-g --chgexit)'{-g,--chgexit}'[exit when output from command changes]' \
'(-n --interval)'{-n,--interval}'[seconds to wait between updates]:interval:' \
'(-p --precise)'{-p,--precise}'[attempt run command in precise intervals]' \
'(-t --no-title)'{-t,--no-title}'[turn off showing the header]' \
'(-x --exec)'{-x,--exec}'[pass command to exec instead of "sh -c"]' \
'(-h --help)'{-h,--help}'[display help information]' \
'(-v --version)'{-v,--version}'[output version information]' \
'(-):command: _command_names -e' \
'*::arguments: _normal'

597
src/_zfs
View File

@ -1,597 +0,0 @@
#compdef zfs
# ------------------------------------------------------------------------------
# Copyright (c) 2014 Github zsh-users - http://github.com/zsh-users
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# * Neither the name of the zsh-users nor the
# names of its contributors may be used to endorse or promote products
# derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL ZSH-USERS BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
# ------------------------------------------------------------------------------
# Description
# -----------
#
# Completion script for zfs
#
# Source: https://github.com/zsh-users/zsh/blob/master/Completion/Unix/Command/_zfs
#
# ------------------------------------------------------------------------------
# Authors
# -------
#
# * Rick van Hattem (https://github.com/wolph)
#
# ------------------------------------------------------------------------------
# Synced with the S11U1 man page
_zfs() {
local context state line expl
typeset -A opt_args
local -a subcmds rw_properties rw_propnames ro_properties create_properties
local -a share_nfs_ro_properties share_nfs_rw_properties
local -a share_smb_ro_properties share_nfs_rw_properties
local -a share_ro_properties share_rw_properties
local -a difffields delegatable_perms
subcmds=(
"create" "destroy" "clone" "promote" "rename" "snapshot"
"rollback" "list" "set" "get" "inherit" "mount" "unmount"
"share" "unshare" "send" "receive" "allow" "unallow"
"upgrade" "userspace" "groupspace" "hold" "holds" "release"
"diff" "key" "help"
)
share_nfs_ro_properties=(
"share.nfs.all"
)
share_nfs_rw_properties=(
"share.nfs:value:(on off)"
"share.nfs.aclok:value:(on off)"
"share.nfs.acflfab:value:(on off)"
"share.nfs.anon:uid:"
"share.nfs.charset.euc-cn:access-list:"
"share.nfs.charset.euc-jpms:access-list:"
"share.nfs.charset.euc-kr:access-list:"
"share.nfs.charset.euc-tw:access-list:"
"share.nfs.charset.iso8859-1:access-list:"
"share.nfs.charset.iso8859-2:access-list:"
"share.nfs.charset.iso8859-5:access-list:"
"share.nfs.charset.iso8859-6:access-list:"
"share.nfs.charset.iso8859-7:access-list:"
"share.nfs.charset.iso8859-8:access-list:"
"share.nfs.charset.iso8859-9:access-list:"
"share.nfs.charset.iso8859-13:access-list:"
"share.nfs.charset.iso8859-15:access-list:"
"share.nfs.charset.koi8-r:access-list:"
"share.nfs.index:file:_files"
"share.nfs.log:nfslog.conf tag:"
"share.nfs.nosub:value:(on off)"
"share.nfs.nosuid:value:(on off)"
"share.nfs.public:value:(on off)"
"share.nfs.sec:security-mode-list:"
"share.nfs.sec.default.none:access-list:"
"share.nfs.sec.default.ro:access-list:"
"share.nfs.sec.default.root:access-list:"
"share.nfs.sec.default.root_mapping:uid:"
"share.nfs.sec.default.rw:access-list:"
"share.nfs.sec.default.window:seconds"
"share.nfs.sec.dh.none:access-list:"
"share.nfs.sec.dh.ro:access-list:"
"share.nfs.sec.dh.root:access-list:"
"share.nfs.sec.dh.root_mapping:uid:"
"share.nfs.sec.dh.rw:access-list:"
"share.nfs.sec.dh.window:seconds"
"share.nfs.sec.krb5.none:access-list:"
"share.nfs.sec.krb5.ro:access-list:"
"share.nfs.sec.krb5.root:access-list:"
"share.nfs.sec.krb5.root_mapping:uid:"
"share.nfs.sec.krb5.rw:access-list:"
"share.nfs.sec.krb5.window:seconds"
"share.nfs.sec.krb5i.none:access-list:"
"share.nfs.sec.krb5i.ro:access-list:"
"share.nfs.sec.krb5i.root:access-list:"
"share.nfs.sec.krb5i.root_mapping:uid:"
"share.nfs.sec.krb5i.rw:access-list:"
"share.nfs.sec.krb5i.window:seconds"
"share.nfs.sec.krb5p.none:access-list:"
"share.nfs.sec.krb5p.ro:access-list:"
"share.nfs.sec.krb5p.root:access-list:"
"share.nfs.sec.krb5p.root_mapping:uid:"
"share.nfs.sec.krb5p.rw:access-list:"
"share.nfs.sec.krb5p.window:seconds"
"share.nfs.sec.none.none:access-list:"
"share.nfs.sec.none.ro:access-list:"
"share.nfs.sec.none.root:access-list:"
"share.nfs.sec.none.root_mapping:uid:"
"share.nfs.sec.none.rw:access-list:"
"share.nfs.sec.none.window:seconds"
"share.nfs.sec.sys.none:access-list:"
"share.nfs.sec.sys.ro:access-list:"
"share.nfs.sec.sys.root:access-list:"
"share.nfs.sec.sys.root_mapping:uid:"
"share.nfs.sec.sys.rw:access-list:"
"share.nfs.sec.sys.window:seconds"
)
share_smb_ro_properties=(
"share.smb.all"
)
share_smb_rw_properties=(
"share.smb:value:(on off)"
"share.smb.ad-container"
"share.smb.abe"
"share.smb.csc:value:(disabled manual auto vdo)"
"share.smb.catia:value:(on off)"
"share.smb.dfsroot:value:(on off)"
"share.smb.guestok:value:(on off)"
"share.smb.ro:access-list:"
"share.smb.rw:access-list:"
"share.smb.none:access-list:"
)
share_ro_properties=(
"share.all"
"share.fs"
"share.name"
"share.point"
"share.protocols"
"share.state"
$share_nfs_ro_properties
$share_smb_ro_properties
)
share_rw_properties=(
"share.desc:description:"
"share.noauto:value:(on off)"
"share.path:path:"
$share_nfs_rw_properties
$share_smb_rw_properties
)
# TODO: userused@ and groupused@ could have more extensive handling
ro_properties=(
"name" "type" "creation" "used" "available" "referenced"
"compressratio" "mounted" "origin" "usedbychildren"
"usedbydataset" "usedbyrefreservation" "usedbysnapshots"
"defer_destroy" "userused@" "userrefs" "groupused@"
"keychangedate" "keystatus" "rekeydate"
$share_ro_properties
)
# TODO: Be cleverer about what values can be set. Is there any way to
# set the sorting for *size properties to false by default?
rw_properties=(
"aclinherit:value:(discard noallow restricted passthrough passthrough-x)"
"aclmode:value:(discard mask passthrough)"
"atime:value:(on off)"
"canmount:value:(on off noauto)"
"checksum:value:(on off fletcher2 fletcher4 sha256 sha256+mac)"
"compression:value:(on off lzjb gzip gzip-{1..9} zle)"
"copies:value:(1 2 3)"
"dedup:value:(on off verify sha256 sha256,verify)"
"devices:value:(on off)"
"encryption:value:(off on aes128-ccm aes-192-ccm aes-256-ccm aes-128-gcm aes-192-gcm aes-256-gcm)"
"exec:value:(on off)"
"groupquota@:value:" # TODO: complete group=size|none
"keysource:value:_zfs_keysource_props"
"logbias:value:(latency throughput)"
"mlslabel:value:(none)" # TODO: list sensitivity labels
"mountpoint:path, 'legacy', or 'none':{if [[ -prefix /* ]]; then _path_files -/; else _wanted mountpoints expl 'mountpoint (type \"/\" to start completing paths)' compadd legacy none; fi}"
"multilevel:value:(on off)"
"nbmand:value:(on off)"
"primarycache:value:(all none metadata)"
"quota:number or 'none':{if [[ -prefix [0-9]## ]]; then _message -e 'number'; elif [[ $PREFIX == quota= ]]; then _wanted none expl 'number or none' compadd none; else _wanted none expl 'quota' compadd none; fi}"
"readonly:value:(on off)"
"recordsize:value:(512 1K 2K 4K 8K 16K 32K 64K 128K 256K 512K 1M)"
"refquota:number or 'none':{if [[ -prefix [0-9]## ]]; then _message -e 'number'; elif [[ $PREFIX == refquota= ]]; then _wanted none expl 'number or none' compadd none; else _wanted none expl 'refquota' compadd none; fi}"
"refreservation:number or 'none':{if [[ -prefix [0-9]## ]]; then _message -e 'number'; elif [[ $PREFIX == refreservation= ]]; then _wanted none expl 'number or none' compadd none; else _wanted none expl 'refreservation' compadd none; fi}"
"reservation:value:{if [[ -prefix [0-9]## ]]; then _message -e 'number'; elif [[ $PREFIX == reservation= ]]; then _wanted none expl 'number or none' compadd none; else _wanted none expl 'reservation' compadd none; fi}"
"rstchown:value:(on off)"
"secondarycache:value:(all none metadata)"
"setuid:value:(on off)"
"shadow:value:" # TODO: complete URI|none
"share:share properties:"
"snapdir:value:(hidden visible)"
"sync:value:(standard always disabled)"
"userquota@:value:" # TODO: complete user=size|none
"version:value:(1 2 3 4 current)"
"volsize:value:" # <size>
"vscan:value:(on off)"
"xattr:value:(on off)"
"zoned:value:(on off)"
$share_rw_properties
)
create_properties=(
$rw_properties
"casesensitivity:value:(sensitive insensitive mixed)"
"normalization:value:(none formC formD formKC formKD)"
"utf8only:value:(on off)"
"volblocksize:value:(512 1K 2K 4K 8K 16K 32K 64K 128K 256K 512K 1M)"
)
delegatable_perms=(
"allow" "clone" "create" "destroy" "diff" "hold" "key"
"keychange" "mount" "promote" "receive" "release" "rename"
"rollback" "send" "share" "snapshot"
"groupused" "userused" "userprop"
${create_properties%%:*}
)
rw_propnames=( ${rw_properties%%:*} )
difffields=(
object parent size links linkschange name oldname user group
ctime mtime atime crtime
)
if [[ $service == "zfs" ]]; then
_arguments -C -A "-*" \
'-\?[Help]' \
'*::command:->subcmd' && return 0
if (( CURRENT == 1 )); then
_wanted commands expl "zfs subcommand" compadd -a subcmds
return
fi
service="$words[1]"
curcontext="${curcontext%:*}=$service:"
fi
case $service in
("create")
_arguments -A "-*" \
'-p[Create parent datasets]' \
'-u[Filesystem is not mounted]' \
'-o[Set initial properties]:property:_values -s , "property" $create_properties' \
- set1 \
':filesystem:_zfs_dataset -t fs -e "parent dataset"' \
- set2 \
'-s[Create sparse volume]' \
'-b[Set volblocksize]:blocksize:' \
'-V[Set size]:size:' \
':volume:_zfs_dataset -t fs -e "parent dataset"'
;;
("destroy")
_arguments -A "-*" \
'-r[Recursively destroy all children]' \
'-R[Recursively destroy all dependents]' \
'-n[Do a dry run (No-op)]' \
'-p[Display numbers exactly]' \
'-v[Verbose]' \
- set1 \
'-d[delete or mark deferred]' \
':snapshot:_zfs_dataset -t snap' \
- set2 \
'-f[Force unmounts]' \
':filesystem/volume/snapshot:_zfs_dataset -t fs -t vol'
;;
("snapshot")
_arguments -A "-*" \
'-r[Recursively snapshot all descendant datasets]' \
'-o[Set property]:property:_values -s , "property" $create_properties' \
':filesystem/volume:_zfs_dataset -t fs -t vol -S@'
;;
("rollback")
_arguments -A "-*" \
'-r[Recursively destroy more recent snapshots]' \
'-R[Recursively destroy more recent snapshots and clones]' \
'-f[Force unmounts]' \
':snapshot:_zfs_dataset -t snap'
;;
("clone")
# XXX needs to bail if there are no snapshots
_arguments -A "-*" \
'-p[Create parent datasets]' \
'-K[Create encryption key]' \
'-o[Set property]:property:_values -s , "property" $create_properties' \
':snapshot:_zfs_dataset -t snap' \
':filesystem/volume:_zfs_dataset -t fs -e "parent dataset"'
;;
("promote")
_arguments \
':filesystem:_zfs_dataset -t clone' \
;;
("rename")
_arguments -A "-*" \
'(-r)-p[Create parent datasets]' \
'(-p)-r[Recursively rename snapshots of all descendent datasets]' \
'-u[Do not remount file systems]' \
'-f[Force unmounts]' \
':dataset:_zfs_dataset -r1' \
':dataset:_zfs_dataset -r2'
;;
("list")
_arguments -A "-*" \
'-r[Recursively display children]' \
'-H[Scripting mode]' \
'-d[Depth]:value:' \
'-o[Properties to list]:property:_values -s , "property" $ro_properties $rw_propnames' \
'*-s[Sort key (ascending)]:property:_values "property" $ro_properties $rw_propnames' \
'*-S[Sort key (descending)]:property:_values "property" $ro_properties $rw_propnames' \
'-t[Dataset types to list]:dataset type:_values -s , "dataset type" all filesystem snapshot volume' \
'*:filesystem/volume/snapshot/path:_zfs_dataset -p'
;;
("set")
_arguments \
'-r[Recursively apply value]' \
':property:_values -s , "property" $rw_properties' \
'*:filesystem/volume:_zfs_dataset -t fs -t vol'
;;
("get")
_arguments -A "-*" \
"-r[Recursively display children's properties]" \
'-d[Depth]:value:' \
'-H[Scripting mode]' \
'-p[Display numbers exactly]' \
'-s[Specify sources]:source:_values -s , "source" local default inherited temporary none' \
'-o[Specify fields]:field:_values -s , "field" name property value source' \
':property:_values -s , "property" $ro_properties $rw_propnames all' \
'*:filesystem/volume/snapshot:_zfs_dataset'
;;
("inherit")
_arguments -A "-*" \
'-r[Recursively inherit property for all children]' \
'-S[Revert to received property value]' \
':property:_values -s , "property" $ro_properties $rw_properties' \
'*:filesystem/volume:_zfs_dataset -t fs -t vol'
;;
("userspace"|"groupspace")
_arguments -A "-*" \
'-n[Print numeric ID]' \
'-H[Tab-delimited output with no headers]' \
'-p[Parseable mode]' \
'-o[Properties to list]:property:_values -s , "property" type name used quota' \
'*-s[Sort key (ascending)]:property:_values "property" type name used quota' \
'*-S[Sort key (descending)]:property:_values "property" type name used quota' \
'-t[Types to list]:type:_values -s , "type" all posixuser smbuser posixgroup smbgroup' \
'-i[Translate SID to POSIX ID]' \
'*:filesystem/volume/snapshot:_zfs_dataset'
;;
("mount")
_arguments -A "-*" \
'-o[Mount options]:mount options:_values -s , "option" {,no}{devices,exec,setuid} ro rw' \
'-O[Overlay mount]' \
'-v[Report mount progress]' \
- set1 \
':filesystem:_zfs_dataset -t fs' \
- set2 \
'-a[Mount all available ZFS filesystems]'
;;
("unmount")
_arguments -A "-*" \
- set1 \
'-f[Force unmount]' \
':filesystem:_zfs_dataset -t fs -t mtpt' \
- set2 \
'-a[Unmount all ZFS filesystems]'
;;
("share")
_arguments -A "-*" \
- set1 \
'-a[Share all available ZFS filesystems]' \
- set2 \
'-r[Share filesystems recursively]' \
':filesystem:_zfs_dataset -t fs' \
- set3 \
'*-o[Create a share with these properties]:property:_values -w "share properties" $share_rw_properties' \
'-u[Create a share without sharing it]' \
':filesystem:_zfs_dataset -t fs' \
- set4 \
':filesystem:_zfs_dataset -t fs -t mtpt -t share'
;;
("unshare")
_arguments -A "-*" \
- set1 \
'-a[Unshare all shared ZFS filesystems]' \
- set2 \
'-r[Unshare filesystems recursively]' \
':filesystem:_zfs_dataset -t fs' \
- set3 \
':filesystem:_zfs_dataset -t fs -t mtpt -t share'
;;
("send")
_arguments -A "-*" \
'-b' \
'-i[Generate an incremental stream]:snapshot:_zfs_dataset -t snap' \
'-D[Perform dedup processing]' \
'-p[Send properties]' \
'-n[Do a dry run (No-op)]' \
'-P[Display numbers exactly]' \
'-v[Verbose]' \
- set1 \
'-I[Generate an incremental stream with intermediary snapshots]:snapshot:_zfs_dataset -t snap' \
'-R[Generate a replication stream package]' \
':snapshot:_zfs_dataset -t snap' \
- set2 \
'-c[Create a self-contained stream]' \
'-r[Generate a recursive stream package]' \
':snapshot:_zfs_dataset -t snap'
;;
("receive")
_arguments -A "-*" \
'-v[Verbose]' \
'-n[Do not receive the stream]' \
'-F[Force a rollback if necessary]' \
'-u[Filesystem is not mounted]' \
'-o[Include property change in the stream]::' \
'-x[Exclude property change from the stream]:property:' \
- set1 \
':filesystem/volume/snapshot:_zfs_dataset' \
- set2 \
'(-e)-d[Set path prefix from stream, excluding only pool name]' \
'(-d)-e[Set path prefix from stream, using last path element]' \
'-:filesystem:_zfs_dataset -t fs'
;;
("allow")
_arguments -A "-*" \
- set1 \
':filesystem/volume:_zfs_dataset -t fs -t vol' \
- set2 \
'(-g)-u[User]:user:_users' \
'(-u)-g[Group]:group:_groups' \
'-l[Allow for named dataset]' \
'-d[Allow for descendent datasets]' \
':permissions or sets:_values -s , "permission or set" $delegatable_perms' \
':filesystem/volume:_zfs_dataset -t fs -t vol' \
- set3 \
'-e[Everyone]' \
'-l[Allow for named dataset]' \
'-d[Allow for descendent datasets]' \
':permissions or sets:_values -s , "permission or set" $delegatable_perms' \
':filesystem/volume:_zfs_dataset -t fs -t vol' \
- set4 \
'-c[Create-time permissions]' \
':permissions or sets:_values -s , "permission or set" $delegatable_perms' \
':filesystem/volume:_zfs_dataset -t fs -t vol' \
- set5 \
'-s[Define or modify permission sets]' \
':setname:' \
':permissions or sets:_values -s , "permission or set" $delegatable_perms' \
':filesystem/volume:_zfs_dataset -t fs -t vol'
;;
("unallow")
_arguments -A "-*" \
'-r[Recursive removal]' \
- set1 \
'-s[Remove permissions from or delete a permission set]:permission set:' \
':permissions or sets:_values -s , "permission or set" $delegatable_perms' \
':filesystem/volume:_zfs_dataset -t fs -t vol' \
- set2 \
'(-g)-u[User]:user:_users' \
'(-u)-g[Group]:group:_groups' \
'-l[Allow for named dataset]' \
'-d[Allow for descendent datasets]' \
':permissions or sets:_values -s , "permission or set" $delegatable_perms' \
':filesystem/volume:_zfs_dataset -t fs -t vol' \
- set3 \
'-e[Everyone]' \
'-l[Allow for named dataset]' \
'-d[Allow for descendent datasets]' \
':permissions or sets:_values -s , "permission or set" $delegatable_perms' \
':filesystem/volume:_zfs_dataset -t fs -t vol' \
- set4 \
'-c[Create-time permissions]' \
':permissions or sets:_values -s , "permission or set" $delegatable_perms' \
':filesystem/volume:_zfs_dataset -t fs -t vol'
;;
("upgrade")
_arguments -A "-*" \
- set1 \
'-v[Verbose]' \
- set2 \
'-a[Upgrade all filesystems on all pools]' \
'-r[Upgrade descendent filesystems, too]' \
'-V[Upgrade to specified version]:version:(1 2)' \
- set3 \
'-r[Upgrade descendent filesystems, too]' \
'-V[Upgrade to specified version]:version:(1 2)' \
':filesystem:_zfs_dataset -t fs'
;;
("hold")
_arguments -A "-*" \
'-r[Apply hold recursively]' \
':tag:' \
':snapshot:_zfs_dataset -t snap'
;;
("holds")
_arguments -A "-*" \
'-r[List holds recursively]' \
':snapshot:_zfs_dataset -t snap'
;;
("release")
_arguments -A "-*" \
'-r[Release holds recursively]' \
':tag:' \
':snapshot:_zfs_dataset -t snap'
;;
("diff")
_arguments -A "-*" \
'-F[Add column for filetype character]' \
'-H[Parseable output]' \
'-e[Only show new and changed files]' \
'*-o[Show fields]:field:_values "field" $difffields' \
'-t[Add column for ctime]' \
- set1 \
':snapshot:_zfs_dataset -t snap' \
':snapshot or filesystem:_zfs_dataset -t snap -t fs' \
- set2 \
'-E[Show difference from empty]' \
':snapshot or filesystem:_zfs_dataset -t snap -t fs'
;;
("key")
_arguments -A "-*" \
- set1 \
'-a[Apply to all datasets in all pools]' \
'(-u -K -f)-l[Load the encryption key]' \
'(-l -K)-u[Unload the encryption key]' \
'(-l -u -f)-K[Create a new data encryption key]' \
'(-l -K)-f[Unmount the dataset before unloading the encryption key]' \
'-r[Apply recursively]' \
':filesystem or volume:_zfs_dataset -t fs -t vol' \
- set2 \
'-c[Change the encryption key]' \
'-o[Change a property]:property:_zfs_keysource_props' \
':filesystem or volume:_zfs_dataset -t fs -t vol'
;;
("help")
_arguments -A "-*" \
- set1 \
':command:($subcmds $delegatable_perms $ro_properties ${rw_properties%%:*} properties)' \
- set2 \
'-l[Display property information]' \
': :(properties)'
;;
(*)
_message "unknown zfs subcommand: $service"
;;
esac
}
_zfs "$@"