]> src.twobees.de Git - dotfiles.git/blob - stow/oh-my-zsh/.oh-my-zsh/plugins/cakephp3/cakephp3.plugin.zsh
...
[dotfiles.git] / stow / oh-my-zsh / .oh-my-zsh / plugins / cakephp3 / cakephp3.plugin.zsh
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
32 compdef _cakephp3 bin/cake
33 compdef _cakephp3 cake
34
35 #Alias
36 alias c3='bin/cake'
37 alias c3cache='bin/cake orm_cache clear'
38 alias c3migrate='bin/cake migrations migrate'