Skip to content

Instantly share code, notes, and snippets.

@acacha
Created February 28, 2015 09:23
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 acacha/4ca4b66287bd54e64e01 to your computer and use it in GitHub Desktop.
Save acacha/4ca4b66287bd54e64e01 to your computer and use it in GitHub Desktop.
Composer bash autocompletion
_composer()
{
local cur=${COMP_WORDS[COMP_CWORD]}
local cmd=${COMP_WORDS[0]}
if ($cmd > /dev/null 2>&1)
then
COMPREPLY=( $(compgen -W "$($cmd list --raw | cut -f 1 -d " " | tr "\n" " ")" -- $cur) )
fi
}
complete -F _composer composer
complete -F _composer composer.phar
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment