# auto-complete for composer COMPOSER_COMMANDS=`composer --raw --no-ansi list | sed "s/[[:space:]].*//g"` _composer() { COMP_WORDBREAKS=${COMP_WORDBREAKS//:} COMPREPLY=(`compgen -W "$COMPOSER_COMMANDS" -- "${COMP_WORDS[COMP_CWORD]}"`) return 0 } complete -F _composer composer
看看效果
1 2 3 4 5
$ composer [TAB][TAB] about clear-cache create-project dumpautoload home install prohibits search status upgrade archive clearcache depends exec i licenses remove self-update suggests validate browse command diagnose global info list require selfupdate u why check-platform-reqs config dump-autoload help init outdated run-script show update why-not