Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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