Skip to content

Instantly share code, notes, and snippets.

@tonglil
Created July 14, 2015 19:01
Show Gist options
  • Save tonglil/753d59d6d649f85600fe to your computer and use it in GitHub Desktop.
Save tonglil/753d59d6d649f85600fe to your computer and use it in GitHub Desktop.
composer-completion.sh
#!/bin/bash
# Originally from: http://stackoverflow.com/a/16693385/2461761
_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 composer.phar
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment