link: tell users of brew link --force about opt.
If people are force-linking keg-only things they should probably be told that they can add the opt prefix to their PATH instead.
This commit is contained in:
parent
08a22d013e
commit
4cae6a724e
@ -44,6 +44,7 @@ module Homebrew
|
|||||||
elsif keg_only && !ARGV.force?
|
elsif keg_only && !ARGV.force?
|
||||||
opoo "#{keg.name} is keg-only and must be linked with --force"
|
opoo "#{keg.name} is keg-only and must be linked with --force"
|
||||||
puts "Note that doing so can interfere with building software."
|
puts "Note that doing so can interfere with building software."
|
||||||
|
puts_keg_only_path_message(keg)
|
||||||
next
|
next
|
||||||
elsif mode.dry_run && mode.overwrite
|
elsif mode.dry_run && mode.overwrite
|
||||||
puts "Would remove:"
|
puts "Would remove:"
|
||||||
@ -53,6 +54,7 @@ module Homebrew
|
|||||||
elsif mode.dry_run
|
elsif mode.dry_run
|
||||||
puts "Would link:"
|
puts "Would link:"
|
||||||
keg.link(mode)
|
keg.link(mode)
|
||||||
|
puts_keg_only_path_message(keg) if keg_only
|
||||||
|
|
||||||
next
|
next
|
||||||
end
|
end
|
||||||
@ -69,10 +71,25 @@ module Homebrew
|
|||||||
else
|
else
|
||||||
puts "#{n} symlinks created"
|
puts "#{n} symlinks created"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if keg_only && !ARGV.homebrew_developer?
|
||||||
|
puts_keg_only_path_message(keg)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def puts_keg_only_path_message(keg)
|
||||||
|
bin = keg/"bin"
|
||||||
|
sbin = keg/"sbin"
|
||||||
|
return if !bin.directory? && !sbin.directory?
|
||||||
|
|
||||||
|
opt = HOMEBREW_PREFIX/"opt/#{keg.name}"
|
||||||
|
puts "\nIf you need to have this software first in your PATH instead consider running:"
|
||||||
|
puts " #{Utils::Shell.prepend_path_in_shell_profile(opt)}/bin" if bin.directory?
|
||||||
|
puts " #{Utils::Shell.prepend_path_in_shell_profile(opt)}/sbin" if sbin.directory?
|
||||||
|
end
|
||||||
|
|
||||||
def keg_only?(rack)
|
def keg_only?(rack)
|
||||||
Formulary.from_rack(rack).keg_only?
|
Formulary.from_rack(rack).keg_only?
|
||||||
rescue FormulaUnavailableError, TapFormulaAmbiguityError, TapFormulaWithOldnameAmbiguityError
|
rescue FormulaUnavailableError, TapFormulaAmbiguityError, TapFormulaWithOldnameAmbiguityError
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user