Skip to content

Instantly share code, notes, and snippets.

@charlieman
Created August 24, 2011 21:37
Show Gist options
  • Save charlieman/1169320 to your computer and use it in GitHub Desktop.
Save charlieman/1169320 to your computer and use it in GitHub Desktop.
bash completion for Symfony2's console requires xmlstartlet to work
_symfony2()
{
local cur prev opts
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}"
opts=$(app/console list --xml | xmlstarlet sel -t -m "//namespaces//command" -v . -o " " | tr ":" "\:")
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
return 0
}
complete -F _symfony2 app/console
COMP_WORDBREAKS=${COMP_WORDBREAKS//:}
# ex: ts=4 sw=4 et filetype=sh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment