You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

48 lines
1.3KB

  1. #
  2. # Bash completion file for CakePHP console.
  3. # Copy this file to a file named `cake` under `/etc/bash_completion.d/`.
  4. # For more info check https://book.cakephp.org/5/en/console-commands/completion.html#how-to-enable-bash-autocompletion-for-the-cakephp-console
  5. #
  6. _cake()
  7. {
  8. local cur prev opts cake
  9. COMPREPLY=()
  10. cake="${COMP_WORDS[0]}"
  11. cur="${COMP_WORDS[COMP_CWORD]}"
  12. prev="${COMP_WORDS[COMP_CWORD-1]}"
  13. if [[ "$cur" == -* ]] ; then
  14. if [[ ${COMP_CWORD} = 1 ]] ; then
  15. opts=$(${cake} completion options)
  16. elif [[ ${COMP_CWORD} = 2 ]] ; then
  17. opts=$(${cake} completion options "${COMP_WORDS[1]}")
  18. else
  19. opts=$(${cake} completion options "${COMP_WORDS[1]}" "${COMP_WORDS[2]}")
  20. fi
  21. COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
  22. return 0
  23. fi
  24. if [[ ${COMP_CWORD} = 1 ]] ; then
  25. opts=$(${cake} completion commands)
  26. COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
  27. return 0
  28. fi
  29. if [[ ${COMP_CWORD} = 2 ]] ; then
  30. opts=$(${cake} completion subcommands $prev)
  31. COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
  32. if [[ $COMPREPLY = "" ]] ; then
  33. _filedir
  34. return 0
  35. fi
  36. return 0
  37. fi
  38. return 0
  39. }
  40. complete -F _cake cake bin/cake

Powered by TurnKey Linux.