composer.plugin.zsh 965 B

1234567891011121314151617181920212223242526272829303132
  1. # ------------------------------------------------------------------------------
  2. # FILE: composer.plugin.zsh
  3. # DESCRIPTION: oh-my-zsh composer plugin file.
  4. # AUTHOR: Daniel Gomes (me@danielcsgomes.com)
  5. # VERSION: 1.0.0
  6. # ------------------------------------------------------------------------------
  7. # Composer basic command completion
  8. _composer_get_command_list () {
  9. composer --no-ansi | sed "1,/Available commands/d" | awk '/^ [a-z]+/ { print $1 }'
  10. }
  11. _composer () {
  12. if [ -f composer.json ]; then
  13. compadd `_composer_get_command_list`
  14. else
  15. compadd create-project init search selfupdate show
  16. fi
  17. }
  18. compdef _composer composer
  19. # Aliases
  20. alias c='composer'
  21. alias csu='composer self-update'
  22. alias cu='composer update'
  23. alias ci='composer install'
  24. alias ccp='composer create-project'
  25. alias cdu='composer dump-autoload'
  26. # install composer in the current directory
  27. alias cget='curl -s https://getcomposer.org/installer | php'