declare -i i=$COMP_CWORD-1
while [ $i -gt 0 ]; do
- if [[ ${COMP_WORDS[i]} != -* ]]; then
+ if [[ ${COMP_WORDS[i]} != -* \
+ || ${COMP_WORDS[i]} == "--cache" \
+ || ${COMP_WORDS[i]} == "--cellar" \
+ || ${COMP_WORDS[i]} == "--prefix" ]]; then
cmd=${COMP_WORDS[i]}
break
fi
done
case "$cmd" in
- "cleanup"|"edit"|"home"|"log"|"prune")
+ "cleanup"|"edit"|"home"|"log"|"prune" \
+ |"--cache"|"--cellar"|"--prefix")
_brew_formula "$cur"
return 0
;;
esac
if [[ "$cur" == -* ]]; then
- COMPREPLY=( $(compgen -W '--cache --help --prefix --version \
- -v -H' -- "$cur") )
+ COMPREPLY=( $(compgen -W '--cache --cellar --help --prefix \
+ --version -v -H' -- "$cur") )
elif [ "$cmd" = "" ]; then
COMPREPLY=( $(compgen -W 'cleanup create edit home info \
install link list log outdated prune remove search \