summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc Cornellà <marc.cornella@live.com>2016-05-23 12:34:45 +0200
committerMarc Cornellà <marc.cornella@live.com>2016-05-23 12:34:45 +0200
commit222d84300febdc7d59696ac4876cf06e0d535436 (patch)
treedd32bacd763f84c8d5bad2741aed54e61615a554
parent9ad9ac69a66cb3f61a642241b4723ae7e0789033 (diff)
parent87cbf3fcf1e295f11ef3e0b6f928861575854fe6 (diff)
downloadzsh-222d84300febdc7d59696ac4876cf06e0d535436.tar.gz
zsh-222d84300febdc7d59696ac4876cf06e0d535436.tar.bz2
zsh-222d84300febdc7d59696ac4876cf06e0d535436.zip
Merge branch 'Draniu/patch-1'
Close #5101
-rw-r--r--plugins/cakephp3/cakephp3.plugin.zsh27
1 files changed, 23 insertions, 4 deletions
diff --git a/plugins/cakephp3/cakephp3.plugin.zsh b/plugins/cakephp3/cakephp3.plugin.zsh
index 28d5af2ea..dbfbeba3b 100644
--- a/plugins/cakephp3/cakephp3.plugin.zsh
+++ b/plugins/cakephp3/cakephp3.plugin.zsh
@@ -1,11 +1,31 @@
# CakePHP 3 basic command completion
_cakephp3_get_command_list () {
- cakephp3commands=($(bin/cake completion commands));printf "%s\n" "${cakephp3commands[@]}"
+ bin/cake Completion commands
+}
+
+_cakephp3_get_sub_command_list () {
+ bin/cake Completion subcommands ${words[2]}
+}
+
+_cakephp3_get_3rd_argument () {
+ bin/cake ${words[2]} ${words[3]} | \grep '\-\ '| \awk '{print $2}'
}
_cakephp3 () {
- if [ -f bin/cake ]; then
- compadd `_cakephp3_get_command_list`
+ local -a has3rdargument
+ has3rdargument=("all" "controller" "fixture" "model" "template")
+ if [ -f bin/cake ]; then
+ if (( CURRENT == 2 )); then
+ compadd $(_cakephp3_get_command_list)
+ fi
+ if (( CURRENT == 3 )); then
+ compadd $(_cakephp3_get_sub_command_list)
+ fi
+ if (( CURRENT == 4 )); then
+ if [[ ${has3rdargument[(i)${words[3]}]} -le ${#has3rdargument} ]]; then
+ compadd $(_cakephp3_get_3rd_argument)
+ fi
+ fi
fi
}
@@ -14,6 +34,5 @@ compdef _cakephp3 cake
#Alias
alias c3='bin/cake'
-
alias c3cache='bin/cake orm_cache clear'
alias c3migrate='bin/cake migrations migrate'