aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/cmd/search.rb
diff options
context:
space:
mode:
authorMax Howell2010-11-14 03:52:59 +0000
committerAdam Vandenberg2011-03-12 11:55:02 -0800
commit719e6c8999928f45dfca2d640cd6f9a3e784e9a1 (patch)
tree7326f00409608fcb06b57467fa6f2c451593c0d0 /Library/Homebrew/cmd/search.rb
parentcf295690995c579e80c2dfdd1e2fc091c6431f26 (diff)
downloadbrew-719e6c8999928f45dfca2d640cd6f9a3e784e9a1.tar.bz2
Refactor the blacklists
Also don't abort searches if the query matches a blacklist. Eg. `brew search vim` should return macvim and the information that vim itself is not packaged.
Diffstat (limited to 'Library/Homebrew/cmd/search.rb')
-rw-r--r--Library/Homebrew/cmd/search.rb21
1 files changed, 14 insertions, 7 deletions
diff --git a/Library/Homebrew/cmd/search.rb b/Library/Homebrew/cmd/search.rb
index b6a0e971d..ccbf784d4 100644
--- a/Library/Homebrew/cmd/search.rb
+++ b/Library/Homebrew/cmd/search.rb
@@ -1,4 +1,5 @@
require "formula"
+require "blacklist"
module Homebrew extend self
def search
@@ -6,14 +7,20 @@ module Homebrew extend self
exec "open", "http://www.macports.org/ports.php?by=name&substr=#{ARGV.next}"
elsif ARGV.include? '--fink'
exec "open", "http://pdb.finkproject.org/pdb/browse.php?summary=#{ARGV.next}"
- end
-
- require 'cmd/install' # for blacklisted? function
- blacklisted? ARGV.named do |msg, _|
- abort msg
- end unless ARGV.force?
+ else
+ query = ARGV.first
+ search_results = search_brews query
+ puts_columns search_results
- puts_columns search_brews(ARGV.first)
+ if $stdout.tty? and msg = blacklisted?(query)
+ unless search_results.empty?
+ puts
+ puts "If you meant `#{query}' precisely:"
+ puts
+ end
+ puts msg
+ end
+ end
end
def search_brews text