Extract search_brews method
This commit is contained in:
parent
6aeb848bd8
commit
d84b8cf288
@ -399,6 +399,17 @@ def outdated_brews
|
|||||||
return results
|
return results
|
||||||
end
|
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
|
||||||
class PrettyListing
|
class PrettyListing
|
||||||
def initialize path
|
def initialize path
|
||||||
|
|||||||
11
bin/brew
11
bin/brew
@ -130,16 +130,7 @@ begin
|
|||||||
|
|
||||||
when 'search', '-S'
|
when 'search', '-S'
|
||||||
check_for_blacklisted_formula(ARGV.named)
|
check_for_blacklisted_formula(ARGV.named)
|
||||||
|
puts_columns search_brews(ARGV.first)
|
||||||
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
|
|
||||||
|
|
||||||
when 'edit'
|
when 'edit'
|
||||||
if ARGV.named.empty?
|
if ARGV.named.empty?
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user