From 8a544f401b71c006992c5cf25482e1c03a8d6572 Mon Sep 17 00:00:00 2001 From: Alexander Barton Date: Tue, 22 Jun 2010 17:59:21 +0200 Subject: [PATCH] Added support for external brew commands stored in /usr/local/bin --- brew-completion.sh | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/brew-completion.sh b/brew-completion.sh index 0934cff..e723534 100644 --- a/brew-completion.sh +++ b/brew-completion.sh @@ -30,6 +30,10 @@ _brew() 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]} != -* \ @@ -91,6 +95,13 @@ _brew() "search"|"update") return 0 ;; + *) + for c in $EXTCMD; do + if [ "$cmd" = "$c" ]; then + _brew_formula "$cur" + return 0 + fi + done esac if [[ "$cur" == -* ]]; then @@ -99,7 +110,7 @@ _brew() 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 -- 2.39.2