Merge pull request #7424 from EricFromCanada/shell-prompt-fix

sh: fix custom shell prompt for zsh
This commit is contained in:
Mike McQuaid 2020-04-23 08:35:05 +01:00 committed by GitHub
commit 36a1c5cdc3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -40,10 +40,10 @@ module Homebrew
# superenv stopped adding brew's bin but generally users will want it
ENV["PATH"] = PATH.new(ENV["PATH"]).insert(1, HOMEBREW_PREFIX/"bin")
end
ENV["PS1"] = if ENV["SHELL"].include?("zsh")
"brew %B%F{green}~%f%b$ "
subshell = if ENV["SHELL"].include?("zsh")
"PS1='brew %B%F{green}%~%f%b$ ' #{ENV["SHELL"]} -d"
else
'brew \[\033[1;32m\]\w\[\033[0m\]$ '
"PS1=\"brew \\[\\033[1;32m\\]\\w\\[\\033[0m\\]$ \" #{ENV["SHELL"]}"
end
ENV["VERBOSE"] = "1"
puts <<~EOS
@ -55,6 +55,6 @@ module Homebrew
When done, type `exit`.
EOS
$stdout.flush
safe_system ENV["SHELL"]
safe_system subshell
end
end