Skip to content
Snippets Groups Projects
Commit 5ec396ed authored by Eric Andrew Lewis's avatar Eric Andrew Lewis Committed by Mike McQuaid
Browse files

install: make search output more intuitive.


Closes Homebrew/homebrew#42222.
Closes Homebrew/homebrew#44892.

Signed-off-by: default avatarMike McQuaid <mike@mikemcquaid.com>
parent cfb913b2
No related branches found
No related tags found
No related merge requests found
......@@ -98,10 +98,36 @@ module Homebrew
else
ofail e.message
query = query_regexp(e.name)
ohai "Searching formulae..."
puts_columns(search_formulae(query))
ohai "Searching for similarly named formulae..."
formulae_search_results = search_formulae(query)
case formulae_search_results.length
when 0
ofail "No similarly named formulae found."
when 1
puts "This similarly named formula was found:"
puts_columns(formulae_search_results)
puts "To install it, run:\n brew install #{formulae_search_results.first}"
else
puts "These similarly named formulae were found:"
puts_columns(formulae_search_results)
puts "To install one of them, run (for example):\n brew install #{formulae_search_results.first}"
end
ohai "Searching taps..."
puts_columns(search_taps(query))
taps_search_results = search_taps(query)
case taps_search_results.length
when 0
ofail "No formulae found in taps."
when 1
puts "This formula was found in a tap:"
puts_columns(taps_search_results)
puts "To install it, run:\n brew install #{taps_search_results.first}"
else
puts "These formulae were found in taps:"
puts_columns(taps_search_results)
puts "To install one of them, run (for example):\n brew install #{taps_search_results.first}"
end
# If they haven't updated in 48 hours (172800 seconds), that
# might explain the error
......
......@@ -47,7 +47,7 @@ class FormulaUnavailableError < RuntimeError
end
def to_s
"No available formula for #{name} #{dependent_s}"
"No available formula with the name \"#{name}\" #{dependent_s}"
end
end
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment