]> arthur.barton.de Git - brew-completion.git/commitdiff
Enhance support for external brew commands
authorAlexander Barton <alex@barton.de>
Tue, 17 Aug 2010 19:34:40 +0000 (21:34 +0200)
committerAlexander Barton <alex@barton.de>
Tue, 17 Aug 2010 19:34:40 +0000 (21:34 +0200)
brew-completion.sh

index 60e92140a16f4c276d170d01cd3e6565bc34bc69..20691214fbf807c52399ea1e952f2fc982c9fb5c 100644 (file)
@@ -31,8 +31,11 @@ _brew()
        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'`
+       extpath="`brew --prefix`/Library/Contributions/examples"
+       if [ -d "$extpath" ]; then
+               EXTCMD=`cd "$extpath"; ls -1 brew-* 2>/dev/null \
+                       | cut -d'.' -f1 | cut -d'-' -f2- | sed -e 's/\*//g'`
+       fi
 
        declare -i i=$COMP_CWORD-1
        while [ $i -gt 0 ]; do