prev=${COMP_WORDS[COMP_CWORD-1]}
cmd=""
+ # Get list of all available external commands
+ EXTCMD=`cd /usr/local/bin; ls -1 brew-* | cut -d'.' -f1 \
+ | cut -d'-' -f2- | sed -e 's/\*//g'`
+
declare -i i=$COMP_CWORD-1
while [ $i -gt 0 ]; do
if [[ ${COMP_WORDS[i]} != -* \
"search"|"update")
return 0
;;
+ *)
+ for c in $EXTCMD; do
+ if [ "$cmd" = "$c" ]; then
+ _brew_formula "$cur"
+ return 0
+ fi
+ done
esac
if [[ "$cur" == -* ]]; then
elif [ "$cmd" = "" ]; then
COMPREPLY=( $(compgen -W 'cleanup create edit home info \
install link list log outdated prune remove search \
- uninstall unlink update' -- "$cur") )
+ uninstall unlink update $EXTCMD' -- "$cur") )
fi
}
complete -F _brew brew