Last active
January 4, 2021 19:00
-
-
Save unique1984/12535b8af45567554d7da8d9b86119af to your computer and use it in GitHub Desktop.
Composer bash_completion
This file contains hidden or 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 | awk '$0 ~ /^ .*/' | awk {'print $1'} | grep -io '[^/_,]*' | grep -v 'command')" -- $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
Composer Bash Completion
sudo wget -O "/etc/bash_completion.d/composer-completion" https://gist.githubusercontent.com/unique1984/12535b8af45567554d7da8d9b86119af/raw/3c84b4d1a7e678257d7e779dd5ccf86e1d32d380/composer-completion
source /etc/bash_completion.d/composer-completion