diff options
| author | Eric Andrew Lewis | 2015-10-13 11:56:39 -0400 |
|---|---|---|
| committer | Mike McQuaid | 2015-10-19 10:16:40 +0100 |
| commit | 5ec396ed38ce9b48108715376c7ff38d7ad48cf9 (patch) | |
| tree | c029f6c144e2db1023056f3cf875e3f06ee8c181 /Library/Homebrew | |
| parent | cfb913b2c2ad520f4c9c85bdddf59bfcd79242d3 (diff) | |
| download | brew-5ec396ed38ce9b48108715376c7ff38d7ad48cf9.tar.bz2 | |
install: make search output more intuitive.
Closes Homebrew/homebrew#42222.
Closes Homebrew/homebrew#44892.
Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
Diffstat (limited to 'Library/Homebrew')
| -rw-r--r-- | Library/Homebrew/cmd/install.rb | 32 | ||||
| -rw-r--r-- | Library/Homebrew/exceptions.rb | 2 |
2 files changed, 30 insertions, 4 deletions
diff --git a/Library/Homebrew/cmd/install.rb b/Library/Homebrew/cmd/install.rb index f7087ad8b..ac1b37b72 100644 --- a/Library/Homebrew/cmd/install.rb +++ b/Library/Homebrew/cmd/install.rb @@ -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 diff --git a/Library/Homebrew/exceptions.rb b/Library/Homebrew/exceptions.rb index 957fc42b9..29cd480d5 100644 --- a/Library/Homebrew/exceptions.rb +++ b/Library/Homebrew/exceptions.rb @@ -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 |
