Parent directory

cakephp3.plugin.zsh

911 bytes
 1# CakePHP 3 basic command completion
 2_cakephp3_get_command_list () {
 3	bin/cake completion commands
 4}
 5
 6_cakephp3_get_sub_command_list () {
 7	bin/cake completion subcommands ${words[2]}
 8}
 9
10_cakephp3_get_3rd_argument () {
11	bin/cake ${words[2]} ${words[3]} | \grep '\-\ '| \awk '{print $2}'
12}
13
14_cakephp3 () {
15	local -a has3rdargument
16	has3rdargument=("all" "controller" "fixture" "model" "template")
17	if [ -f bin/cake ]; then
18		if (( CURRENT == 2 )); then
19			compadd $(_cakephp3_get_command_list)
20		fi
21		if (( CURRENT == 3 )); then
22			compadd $(_cakephp3_get_sub_command_list)
23		fi
24		if (( CURRENT == 4 )); then
25			if [[ ${has3rdargument[(i)${words[3]}]} -le ${#has3rdargument} ]]; then
26				compadd $(_cakephp3_get_3rd_argument)
27			fi
28		fi
29  fi
30}
31
32compdef _cakephp3 bin/cake
33compdef _cakephp3 cake
34
35#Alias
36alias c3='bin/cake'
37alias c3cache='bin/cake schema_cache clear'
38alias c3migrate='bin/cake migrations migrate'