cakephp3.plugin.zsh 883 B

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