Extract search_brews method
This commit is contained in:
parent
6aeb848bd8
commit
d84b8cf288
@ -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
|
||||
|
||||
11
bin/brew
11
bin/brew
@ -130,16 +130,7 @@ begin
|
||||
|
||||
when 'search', '-S'
|
||||
check_for_blacklisted_formula(ARGV.named)
|
||||
|
||||
require "formula"
|
||||
formulae = Formulary.names with_aliases=true
|
||||
|
||||
if ARGV.first =~ /^\/(.*)\/$/
|
||||
puts_columns formulae.grep(Regexp.new($1))
|
||||
else
|
||||
search_term = Regexp.escape(ARGV.first || "")
|
||||
puts_columns formulae.grep(/.*#{search_term}.*/)
|
||||
end
|
||||
puts_columns search_brews(ARGV.first)
|
||||
|
||||
when 'edit'
|
||||
if ARGV.named.empty?
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user