aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJack Nagel2013-04-30 01:24:11 -0500
committerJack Nagel2013-04-30 01:24:11 -0500
commit819fb643bd5ca3f0103d43fa3303692f675b63c9 (patch)
tree57a1fbbf3b80daf1bc83ff68299e4db53fbcf4d2
parent70a60ba56436dff286a41d0decdc842038393313 (diff)
downloadhomebrew-819fb643bd5ca3f0103d43fa3303692f675b63c9.tar.bz2
completion: avoid unnecessary `brew` invocations
-rw-r--r--Library/Contributions/brew_bash_completion.sh9
1 files changed, 5 insertions, 4 deletions
diff --git a/Library/Contributions/brew_bash_completion.sh b/Library/Contributions/brew_bash_completion.sh
index 9a72e7704..31f714b22 100644
--- a/Library/Contributions/brew_bash_completion.sh
+++ b/Library/Contributions/brew_bash_completion.sh
@@ -60,13 +60,14 @@ __brewcomp ()
__brew_complete_formulae ()
{
local cur="${COMP_WORDS[COMP_CWORD]}"
- local ff=$(\ls $(brew --repository)/Library/Formula 2>/dev/null | sed 's/\.rb//g')
- local af=$(\ls $(brew --repository)/Library/Aliases 2>/dev/null | sed 's/\.rb//g')
+ local lib=$(brew --repository)/Library
+ local ff=$(\ls ${lib}/Formula 2>/dev/null | sed 's/\.rb//g')
+ local af=$(\ls ${lib}/Aliases 2>/dev/null | sed 's/\.rb//g')
local tf tap
- for dir in $(\ls $(brew --repository)/Library/Taps 2>/dev/null); do
+ for dir in $(\ls ${lib}/Taps 2>/dev/null); do
tap="$(echo "$dir" | sed 's|-|/|g')"
- tf="$tf $(\ls -1R "$(brew --repository)/Library/Taps/$dir" 2>/dev/null |
+ tf="$tf $(\ls -1R "${lib}/Taps/${dir}" 2>/dev/null |
grep '.\+.rb' | sed -E 's|(.+)\.rb|'"${tap}"'/\1|g')"
done