forked from webflo/drush_zsh_completion
-
Notifications
You must be signed in to change notification settings - Fork 1
/
_drush
60 lines (46 loc) · 1.19 KB
/
_drush
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#compdef drush
#autoload
local ret=1 state
local -a _1st_arguments
local -a drush_commands
drush_commands=`drush zsh-commands --pipe`
local -a drush_common_opts
drush_common_opts=`drush zsh-options --pipe`
subcommands=(${(f)drush_common_opts});
declare -ga common_opts
common_opts=(${(f)drush_common_opts})
typeset -A opt_args
_arguments \
$common_opts \
':subcommand:->subcommand' \
'*::options:->options' && ret=0
case $state in
subcommand)
subcommands=(${(f)drush_commands})
_describe -t subcommands 'drush subcommand' subcommands && ret=0
;;
options)
declare -a args
declare -a local_opts
declare -a drush_local_opts
drush_local_opts=`drush zsh-options --pipe $words[1]`
local_opts=(${(f)drush_local_opts})
args=(
$excl_opts
$local_opts
)
case $words[1] in
features-update|fu|feature-revert|fr)
declare -a drush_features
declare -a local_features
drush_features=`drush zsh-features-list --pipe`
local_features={$drush_features}
args+=(
'*:feature:('$local_features')'
)
;;
esac
_arguments $args && ret=0
;;
esac
return ret