Skip to content

Instantly share code, notes, and snippets.

@saksmt
Created September 1, 2014 08:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save saksmt/47a60373c70072b636c4 to your computer and use it in GitHub Desktop.
Save saksmt/47a60373c70072b636c4 to your computer and use it in GitHub Desktop.
Bash completion for app/console(symfony2)
#!/bin/bash
_sf_console()
{
local curr=${COMP_WORDS[COMP_CWORD]}
local out=''
local str=" | sed -r 's/\s+.*$//' | xargs"
if [[ -e "app/console" ]]; then
out="app/console list --raw"$str
else if [[ -e "console" ]]; then
out="console list --raw"$str
fi; fi
COMPREPLY=( $(compgen -W "$(eval $out)" -- "$curr") )
}
complete -F _sf_console app/console
complete -F _sf_console console
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment