Merge pull request #1237 from zsh-users/refactor-cask
Refactor cask completion
This commit is contained in:
commit
51025ba738
46
src/_cask
46
src/_cask
|
|
@ -41,14 +41,29 @@
|
||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
|
|
||||||
function _cask() {
|
function _cask() {
|
||||||
local ret=1 state
|
typeset -A opt_args
|
||||||
_arguments \
|
local context state line ret=1
|
||||||
|
local curcontext="$curcontext"
|
||||||
|
|
||||||
|
_arguments -C \
|
||||||
|
'(--proxy --http-proxy --https-proxy)--proxy[Set emacs proxy for HTTPS and HTTPS]:host:_hosts' \
|
||||||
|
'(--proxy --http-proxy)--http-proxy[Set emacs proxy for HTTP]:host:_hosts' \
|
||||||
|
'(--proxy --https-proxy)--https-proxy[Set emacs proxy for HTTPS]:host:_hosts' \
|
||||||
|
'(--proxy --http-proxy --https-proxy)--proxy[Set emacs proxy for HTTPS and HTTPS]:host:_hosts' \
|
||||||
|
'--no-proxy[Set Emacs no-proxy to HOST]:host:_hosts' \
|
||||||
|
'(- *)--version[Print Cask version and exit]' \
|
||||||
|
'(- *)'{-h,--help}'[Display usage or information for command]::command:->subcommand' \
|
||||||
|
'--debug[Turn on debug output]' \
|
||||||
|
'--path[Run command in this PATH instead of default-directory]:dir:_files -/' \
|
||||||
|
'(--verbose --silent)--verbose[Be verbose and show debug output]' \
|
||||||
|
'(--verbose --silent)--verbose[Be slient and do not show anything]' \
|
||||||
':subcommand:->subcommand' \
|
':subcommand:->subcommand' \
|
||||||
'*:: :->subcmds' && ret=0
|
'*:: :->subcmds' \
|
||||||
|
&& ret=0
|
||||||
|
|
||||||
case $state in
|
case $state in
|
||||||
subcommand)
|
(subcommand)
|
||||||
subcommands=(
|
local -a subcommands=(
|
||||||
"build:build all Elisp files in the files directive"
|
"build:build all Elisp files in the files directive"
|
||||||
"clean-elc:remove all byte compiled Elisp files in the files directive"
|
"clean-elc:remove all byte compiled Elisp files in the files directive"
|
||||||
"exec:execute command with correct 'exec-path' and 'load-path'"
|
"exec:execute command with correct 'exec-path' and 'load-path'"
|
||||||
|
|
@ -71,15 +86,20 @@ function _cask() {
|
||||||
"upgrade:upgrade Cask itself and its dependencies"
|
"upgrade:upgrade Cask itself and its dependencies"
|
||||||
"version:print program version"
|
"version:print program version"
|
||||||
)
|
)
|
||||||
_describe -t subcommands 'cask subcommands' subcommands && ret=0
|
|
||||||
esac
|
|
||||||
|
|
||||||
case "$words[1]" in
|
_describe -t subcommands 'cask subcommands' subcommands && ret=0
|
||||||
init)
|
;;
|
||||||
_arguments \
|
(subcmds)
|
||||||
'(--dev)--dev[Run in dev mode]' && ret=0 ;;
|
case "$words[1]" in
|
||||||
exec)
|
(init)
|
||||||
_generic
|
_arguments \
|
||||||
|
'(--dev)--dev[Run in dev mode]' \
|
||||||
|
&& ret=0
|
||||||
|
;;
|
||||||
|
(exec)
|
||||||
|
_generic
|
||||||
|
;;
|
||||||
|
esac
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue