aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
authorAdam Vandenberg2010-06-17 10:45:16 -0700
committerAdam Vandenberg2010-06-17 11:42:24 -0700
commitd84b8cf2885b79854221ad5968d8ec03955a9969 (patch)
tree6f0dcfae35f483ba45fdcf526c3b7a410cc020d2 /Library
parent6aeb848bd8f7535d2c9ba7504eba53e5fe2b4240 (diff)
downloadbrew-d84b8cf2885b79854221ad5968d8ec03955a9969.tar.bz2
Extract search_brews method
Diffstat (limited to 'Library')
-rw-r--r--Library/Homebrew/brew.h.rb11
1 files changed, 11 insertions, 0 deletions
diff --git a/Library/Homebrew/brew.h.rb b/Library/Homebrew/brew.h.rb
index bd4153b16..24f51108f 100644
--- a/Library/Homebrew/brew.h.rb
+++ b/Library/Homebrew/brew.h.rb
@@ -399,6 +399,17 @@ def outdated_brews
return results
end
+def search_brews text
+ require "formula"
+ formulae = Formulary.names with_aliases=true
+ if text =~ /^\/(.*)\/$/
+ return formulae.grep(Regexp.new($1))
+ else
+ search_term = Regexp.escape(text || "")
+ return formulae.grep(/.*#{search_term}.*/)
+ end
+end
+
########################################################## class PrettyListing
class PrettyListing
def initialize path