diff options
| author | Adam Vandenberg | 2010-06-17 10:45:16 -0700 |
|---|---|---|
| committer | Adam Vandenberg | 2010-06-17 11:42:24 -0700 |
| commit | d84b8cf2885b79854221ad5968d8ec03955a9969 (patch) | |
| tree | 6f0dcfae35f483ba45fdcf526c3b7a410cc020d2 /Library | |
| parent | 6aeb848bd8f7535d2c9ba7504eba53e5fe2b4240 (diff) | |
| download | brew-d84b8cf2885b79854221ad5968d8ec03955a9969.tar.bz2 | |
Extract search_brews method
Diffstat (limited to 'Library')
| -rw-r--r-- | Library/Homebrew/brew.h.rb | 11 |
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 |
