brew server - use search method
This commit is contained in:
parent
410f633310
commit
db9b20216b
@ -75,16 +75,10 @@ get '/' do
|
|||||||
end
|
end
|
||||||
|
|
||||||
get '/search' do
|
get '/search' do
|
||||||
|
require 'brew.h'
|
||||||
q = params['q']
|
q = params['q']
|
||||||
|
results = search_brews(q)
|
||||||
|
|
||||||
formulae = Formulary.names with_aliases=true
|
|
||||||
|
|
||||||
if q =~ /^\/(.*)\/$/
|
|
||||||
results = formulae.grep(Regexp.new($1))
|
|
||||||
else
|
|
||||||
search_term = Regexp.escape(q || "")
|
|
||||||
results = formulae.grep(/.*#{search_term}.*/)
|
|
||||||
end
|
|
||||||
s = <<-HTML
|
s = <<-HTML
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user