Merge pull request #6247 from zachauten/suggest-cask-cmd

brew install will suggest brew cask install
This commit is contained in:
Mike McQuaid 2019-06-24 15:15:25 +01:00 committed by GitHub
commit 573acc85a6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 1 deletions

View File

@ -19,7 +19,11 @@ module Homebrew
cask = Cask::CaskLoader.load(name) cask = Cask::CaskLoader.load(name)
reason = +"Found a cask named \"#{name}\" instead.\n" reason = +"Found a cask named \"#{name}\" instead.\n"
reason << Cask::Cmd::Info.get_info(cask) if show_info if show_info
reason << Cask::Cmd::Info.get_info(cask)
else
reason << "Did you mean to type \"brew cask install #{name}\"?\n"
end
reason.freeze reason.freeze
rescue Cask::CaskUnavailableError rescue Cask::CaskUnavailableError
nil nil

View File

@ -100,6 +100,7 @@ describe Homebrew::MissingFormula do
let(:show_info) { false } let(:show_info) { false }
it { is_expected.to match(/Found a cask named "local-caffeine" instead./) } it { is_expected.to match(/Found a cask named "local-caffeine" instead./) }
it { is_expected.to match(/Did you mean to type "brew cask install local-caffeine"?/) }
end end
context "with a formula name that is a cask and show_info: true" do context "with a formula name that is a cask and show_info: true" do