Merge pull request #7242 from dawidd6/patch-1

brew.sh: obey HOMEBREW_COLOR
This commit is contained in:
Mike McQuaid 2020-03-31 09:05:09 +01:00 committed by GitHub
commit d9f8ad3b39
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -27,7 +27,7 @@ esac
export HOMEBREW_COMMAND_DEPTH=$((HOMEBREW_COMMAND_DEPTH + 1)) export HOMEBREW_COMMAND_DEPTH=$((HOMEBREW_COMMAND_DEPTH + 1))
ohai() { ohai() {
if [[ -t 1 && -z "$HOMEBREW_NO_COLOR" ]] # check whether stdout is a tty. if [[ -n "$HOMEBREW_COLOR" || (-t 1 && -z "$HOMEBREW_NO_COLOR") ]] # check whether stdout is a tty.
then then
echo -e "\\033[34m==>\\033[0m \\033[1m$*\\033[0m" # blue arrow and bold text echo -e "\\033[34m==>\\033[0m \\033[1m$*\\033[0m" # blue arrow and bold text
else else
@ -36,7 +36,7 @@ ohai() {
} }
onoe() { onoe() {
if [[ -t 2 && -z "$HOMEBREW_NO_COLOR" ]] # check whether stderr is a tty. if [[ -n "$HOMEBREW_COLOR" || (-t 2 && -z "$HOMEBREW_NO_COLOR") ]] # check whether stderr is a tty.
then then
echo -ne "\\033[4;31mError\\033[0m: " >&2 # highlight Error with underline and red color echo -ne "\\033[4;31mError\\033[0m: " >&2 # highlight Error with underline and red color
else else