cmd/install: mention brew reinstall

If people are trying to `brew install` an existing version it’s worth
pointing out to them how they can reinstall (as it’s pretty much the
only case where we’re not already suggesting another command).
This commit is contained in:
Mike McQuaid 2018-03-30 14:58:36 +01:00
parent 4c07685258
commit ed8cae93ab

View File

@ -166,7 +166,8 @@ module Homebrew
formulae << f
else
opoo <<~EOS
#{f.full_name} #{f.pkg_version} is already installed
#{f.full_name} #{f.pkg_version} is already installed and up-to-date
To reinstall #{f.pkg_version}, run `brew reinstall #{f.name}`
EOS
end
elsif (ARGV.build_head? && new_head_installed) || prefix_installed
@ -190,12 +191,17 @@ module Homebrew
EOS
elsif !f.linked? || f.keg_only?
msg = <<~EOS
#{msg}, it's just not linked.
#{msg}, it's just not linked
You can use `brew link #{f}` to link this version.
EOS
elsif ARGV.only_deps?
msg = nil
formulae << f
else
msg = <<~EOS
#{msg} and up-to-date
To reinstall #{f.pkg_version}, run `brew reinstall #{f.name}`
EOS
end
opoo msg if msg
elsif !f.any_version_installed? && old_formula = f.old_installed_formulae.first