Multi-shell diagnostic check
This commit is contained in:
parent
f1ce358551
commit
f0cc815d86
@ -476,7 +476,7 @@ module Homebrew
|
||||
|
||||
Consider setting your PATH so that #{HOMEBREW_PREFIX}/bin
|
||||
occurs before /usr/bin. Here is a one-liner:
|
||||
echo 'export PATH="#{HOMEBREW_PREFIX}/bin:$PATH"' >> #{Utils::Shell.shell_profile}
|
||||
#{Utils::Shell.prepend_path_in_shell_profile("#{HOMEBREW_PREFIX}/bin")}
|
||||
EOS
|
||||
end
|
||||
end
|
||||
@ -496,7 +496,7 @@ module Homebrew
|
||||
<<-EOS.undent
|
||||
Homebrew's bin was not found in your PATH.
|
||||
Consider setting the PATH for example like so
|
||||
echo 'export PATH="#{HOMEBREW_PREFIX}/bin:$PATH"' >> #{Utils::Shell.shell_profile}
|
||||
#{Utils::Shell.prepend_path_in_shell_profile("#{HOMEBREW_PREFIX}/bin:$PATH")}
|
||||
EOS
|
||||
end
|
||||
|
||||
@ -511,7 +511,7 @@ module Homebrew
|
||||
Homebrew's sbin was not found in your PATH but you have installed
|
||||
formulae that put executables in #{HOMEBREW_PREFIX}/sbin.
|
||||
Consider setting the PATH for example like so
|
||||
echo 'export PATH="#{HOMEBREW_PREFIX}/sbin:$PATH"' >> #{Utils::Shell.shell_profile}
|
||||
#{Utils::Shell.prepend_path_in_shell_profile("#{HOMEBREW_PREFIX}/sbin:$PATH")}
|
||||
EOS
|
||||
end
|
||||
|
||||
|
||||
@ -69,5 +69,16 @@ module Utils
|
||||
def self.shell_profile
|
||||
SHELL_PROFILE_MAP.fetch(preferred_shell, "~/.bash_profile")
|
||||
end
|
||||
|
||||
def self.prepend_path_in_shell_profile(path)
|
||||
case preferred_shell
|
||||
when :bash, :ksh, :sh, :zsh
|
||||
"echo 'export PATH=\"#{sh_quote(path)}:$PATH >> #{shell_profile}"
|
||||
when :csh, :tcsh
|
||||
"echo 'setenv PATH #{csh_quote(path)}:$PATH' >> #{shell_profile}"
|
||||
when :fish
|
||||
"echo 'set -g fish_user_paths $fish_user_paths >> #{sh_quote(path)}' >> #{shell_profile}"
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user