- put
symfony
in your PATH dir and make it executable - add
.symfony_completion
content to completion script cd /path/to/symfony/project
and runsymfony
Created
September 25, 2012 09:17
-
-
Save fredipevcin/3780808 to your computer and use it in GitHub Desktop.
Symfony2 console autocomplete
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# SYMFONY | |
_symfony() { | |
local cur cmd | |
COMPREPLY=() | |
cur="${COMP_WORDS[${COMP_CWORD}]}" | |
command="${COMP_WORDS[1]}" | |
if [ ${COMP_CWORD} == 1 ]; then | |
cmds="$(symfony list --no-ansi | grep -e '^\s\s[a-z]' | awk '{ print $1}')" | |
COMPREPLY=( $(compgen -W '$cmds' -- $cur)) | |
elif [ ${COMP_CWORD} -ge 2 ]; then | |
cmds="$(symfony | grep -e '^\s\s--' | awk '{print $1}')" | |
cmds="$(symfony help $command | grep -e '^\s--' | awk '{print $1}') $cmds" | |
COMPREPLY=($(compgen -W '$cmds' -- $cur)) | |
fi | |
return 0 | |
} | |
complete -F _symfony symfony | |
COMP_WORDBREAKS=${COMP_WORDBREAKS//:} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if [ ! -f "app/console" ]; then | |
echo "Command can only be run in Symfony root folder"; | |
exit 1; | |
fi; | |
env php app/console $@ |
@adrienbrault This not easier... you need to install zsh, then oh-my-zsh, the sf2 plugin !
@adrienbrault i'm using bash not zsh
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
There an easier way: install oh-my-zsh, and enable the symfony2 plugin.
https://github.com/robbyrussell/oh-my-zsh