install: make search output more intuitive.
Closes Homebrew/homebrew#42222. Closes Homebrew/homebrew#44892. Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
This commit is contained in:
parent
cfb913b2c2
commit
5ec396ed38
@ -98,10 +98,36 @@ module Homebrew
|
|||||||
else
|
else
|
||||||
ofail e.message
|
ofail e.message
|
||||||
query = query_regexp(e.name)
|
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..."
|
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
|
# If they haven't updated in 48 hours (172800 seconds), that
|
||||||
# might explain the error
|
# might explain the error
|
||||||
|
|||||||
@ -47,7 +47,7 @@ class FormulaUnavailableError < RuntimeError
|
|||||||
end
|
end
|
||||||
|
|
||||||
def to_s
|
def to_s
|
||||||
"No available formula for #{name} #{dependent_s}"
|
"No available formula with the name \"#{name}\" #{dependent_s}"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user