Skip to content

Instantly share code, notes, and snippets.

@grachevko
Forked from danielhauck/symfony
Created February 5, 2017 21:09
Show Gist options
  • Save grachevko/e3dc0563b2b2a21027348e9ef4ef383e to your computer and use it in GitHub Desktop.
Save grachevko/e3dc0563b2b2a21027348e9ef4ef383e to your computer and use it in GitHub Desktop.
Symfony Bash Completion
## add me to /etc/bash_completion.d/
## cp FILE /etc/bash_completion.d/
## reload completion
## exec bash
_available_commands()
{
bin/console list --raw | awk '{print $1}'
}
_symfony()
{
local cur
cur="${COMP_WORDS[COMP_CWORD]}"
prev=${COMP_WORDS[COMP_CWORD-1]}
if [ $COMP_CWORD -eq 1 ]
then
COMPREPLY=( $( compgen -W '$(_available_commands)' -- $cur) )
fi
}
complete -F _symfony bin/console
COMP_WORDBREAKS=${COMP_WORDBREAKS//:}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment