my xfce4 dotfiles
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.

29 lines
506 B

3 years ago
  1. # Yii2 command completion
  2. _yii2_format_command () {
  3. awk '/^- [a-z]+/ { sub(":", "", $2); print $2 }'
  4. }
  5. _yii2 () {
  6. if [ -f ./yii ]; then
  7. _arguments \
  8. '1: :->command'\
  9. '*: :->params'
  10. case $state in
  11. command)
  12. local -a commands
  13. local -a name
  14. if [[ $words[2] == *\/ ]]; then
  15. name=$words[2]
  16. fi
  17. commands=(${(f)"$(./yii help $name --color=0 | _yii2_format_command)"})
  18. compadd -Q -S '' -a -- commands
  19. esac
  20. fi
  21. }
  22. compdef _yii2 yii