aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJack Nagel2014-04-14 22:32:24 -0500
committerJack Nagel2014-04-14 22:36:40 -0500
commit47d24c461c3ec6db5c75f2ccdefb2f8ad9998119 (patch)
tree9535fda2dba784385b300f345ffa4b92d5741854
parent76b0140af5335aec06ff57e9979e26817ee17c4b (diff)
downloadbrew-47d24c461c3ec6db5c75f2ccdefb2f8ad9998119.tar.bz2
Do path and string manipulation in pure bash
-rw-r--r--Library/Contributions/brew_bash_completion.sh16
1 files changed, 10 insertions, 6 deletions
diff --git a/Library/Contributions/brew_bash_completion.sh b/Library/Contributions/brew_bash_completion.sh
index e0cda943a..5f7a45db5 100644
--- a/Library/Contributions/brew_bash_completion.sh
+++ b/Library/Contributions/brew_bash_completion.sh
@@ -61,14 +61,18 @@ __brew_complete_formulae ()
{
local cur="${COMP_WORDS[COMP_CWORD]}"
local lib=$(brew --repository)/Library
+ local taps=${lib}/Taps
local ff=$(\ls ${lib}/Formula 2>/dev/null | sed 's/\.rb//g')
local af=$(\ls ${lib}/Aliases 2>/dev/null)
- local tf tap
-
- for dir in $(\ls ${lib}/Taps 2>/dev/null); do
- tap="$(echo "$dir" | sed 's|-|/|g')"
- tf="$tf $(\ls -1R "${lib}/Taps/${dir}" 2>/dev/null |
- grep '.\+.rb' | sed -E 's|(.+)\.rb|'"${tap}"'/\1|g')"
+ local tf file
+
+ for file in ${taps}/*/*.rb ${taps}/*/Formula/*.rb ${taps}/*/HomebrewFormula/*.rb; do
+ file=${file/"Formula/"/}
+ file=${file/"HomebrewFormula/"/}
+ file=${file#${lib}/Taps/}
+ file=${file%.rb}
+ file=${file/-//}
+ tf="${tf} ${file}"
done
COMPREPLY=($(compgen -W "$ff $af $tf" -- "$cur"))