Created
February 28, 2015 09:23
-
-
Save acacha/4ca4b66287bd54e64e01 to your computer and use it in GitHub Desktop.
Composer bash autocompletion
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
_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