diff options
| author | Mike McQuaid | 2017-03-23 08:42:27 +0000 |
|---|---|---|
| committer | Mike McQuaid | 2017-03-23 08:42:29 +0000 |
| commit | 4cae6a724e6d684eb157dd6d7328755694f228b2 (patch) | |
| tree | f7c2693ac6e4726d82b6182519086047d304d7e3 | |
| parent | 08a22d013e9ba44aa7c4ed4d08bb2fd6aebf7c05 (diff) | |
| download | brew-4cae6a724e6d684eb157dd6d7328755694f228b2.tar.bz2 | |
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.
| -rw-r--r-- | Library/Homebrew/cmd/link.rb | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/Library/Homebrew/cmd/link.rb b/Library/Homebrew/cmd/link.rb index 98cf98bf7..293f09eef 100644 --- a/Library/Homebrew/cmd/link.rb +++ b/Library/Homebrew/cmd/link.rb @@ -44,6 +44,7 @@ module Homebrew elsif keg_only && !ARGV.force? opoo "#{keg.name} is keg-only and must be linked with --force" puts "Note that doing so can interfere with building software." + puts_keg_only_path_message(keg) next elsif mode.dry_run && mode.overwrite puts "Would remove:" @@ -53,6 +54,7 @@ module Homebrew elsif mode.dry_run puts "Would link:" keg.link(mode) + puts_keg_only_path_message(keg) if keg_only next end @@ -69,10 +71,25 @@ module Homebrew else puts "#{n} symlinks created" end + + if keg_only && !ARGV.homebrew_developer? + puts_keg_only_path_message(keg) + 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) Formulary.from_rack(rack).keg_only? rescue FormulaUnavailableError, TapFormulaAmbiguityError, TapFormulaWithOldnameAmbiguityError |
