ohmyzsh/plugins/symfony2/symfony2.plugin.zsh
Manuel Transfeld c1bf209462
Add support for Symfony Client
Symfony has a new [Symfony Client](https://github.com/symfony/cli), which is a binary called `symfony`.
You can use `symfony console` the same way as the old way with `php bin/console` with an incredible difference: It loads a local `php.ini`. [docs](https://symfony.com/doc/current/setup/symfony_server.html#overriding-php-config-options-per-project)
2019-05-28 18:19:00 +02:00

40 lines
1.1 KiB
Bash

# Symfony2 basic command completion
_symfony_console () {
if [ -x symfony ]; then
echo "./symfony console"
else if command -v symfony >/dev/null 2>&1; then
echo "$(command -v symfony) console"
else
echo "php $(find . -maxdepth 2 -mindepth 1 -name 'console' -type f | head -n 1)"
fi
}
_symfony2_get_command_list () {
`_symfony_console` --no-ansi | sed "1,/Available commands/d" | awk '/^ ?[^ ]+ / { print $1 }'
}
_symfony2 () {
compadd `_symfony2_get_command_list`
}
compdef _symfony2 '`_symfony_console`'
compdef _symfony2 'app/console'
compdef _symfony2 'bin/console'
compdef _symfony2 sf
#Alias
alias sf='`_symfony_console`'
alias sfcl='sf cache:clear'
alias sfsr='sf server:run -vvv'
alias sfcw='sf cache:warmup'
alias sfroute='sf debug:router'
alias sfcontainer='sf debug:container'
alias sfgb='sf generate:bundle'
alias sfgc='sf generate:controller'
alias sfgcom='sf generate:command'
alias sfge='sf doctrine:generate:entity'
alias sfsu='sf doctrine:schema:update'
alias sfdc='sf doctrine:database:create'
alias sfdev='sf --env=dev'
alias sfprod='sf --env=prod'