Brew: $HOMEBREW_NO_BOLD to disable bold in output

Created on 16 Jun 2020  路  7Comments  路  Source: Homebrew/brew

A detailed description of the proposed feature

I'd like setting $HOMEBREW_NO_BOLD to disable bold in the output. This is different from $HOMEBREW_NO_COLOR as it keeps color in the output otherwise.

The motivation for the feature

I bold my prompt so that I can easily scan for it in my output but when another program has bold in its output, it becomes difficult to easily scan for my prompt.

Screen Shot 2020-06-16 at 4 19 36 PM

How the feature would be relevant to at least 90% of Homebrew users

This seems to be a very high bar, I strongly doubt even 10% of Homebrew's users enable $HOMEBREW_NO_COLOR. I feel like a lot of people would prefer this as a middle ground between $HOMEBREW_NO_COLOR and $HOMEBREW_COLOR as it's really only the bolds that make the colors so aggressive.

What alternatives to the feature have been considered

I use $HOMEBREW_NO_COLOR right now but it makes it much harder to scan Homebrew's output with zero colors. I can also use set $HOMEBREW_COLOR to force color and then use sed to replace the bold escape sequences but like I mentioned above, I feel like a lot of people would enjoy this.

Most helpful comment

This is something we may reconsider in future but we'd want to see demand from non-trivial numbers of users for this (particularly given there's a workaround for this).

You can also get rid of the brew emoji as so:

HOMEBREW_NO_EMOJI will do this for you. It's documented in man brew.

All 7 comments

No strong opinion about the proposal but:

This seems to be a very high bar, I strongly doubt even 10% of Homebrew's users enable $HOMEBREW_NO_COLOR.

Thank you for being honest.

In case my proposal is rejected, I worked out how to do this with sed:

brew() {
  HOMEBREW_COLOR=1 command brew "$@" | sed -E "s/"$'\e'"\[1m//g"
}

You can also get rid of the brew emoji as so:

brew() {
  HOMEBREW_COLOR=1 command brew "$@" | sed -e "s/"$'\e'"\[1m//g" -e "s/馃嵑/  /"
}

Screen Shot 2020-06-16 at 4 40 00 PM

This is something we may reconsider in future but we'd want to see demand from non-trivial numbers of users for this (particularly given there's a workaround for this).

You can also get rid of the brew emoji as so:

HOMEBREW_NO_EMOJI will do this for you. It's documented in man brew.

Got it. I've ended up rocking the following to underline instead of bold and remove the emoji.

export HOMEBREW_NO_EMOJI=1

brew() {
  # Replace bold with underline.
  # https://github.com/Homebrew/brew/issues/7753
  HOMEBREW_COLOR=1 command brew "$@" | sed "s/"$'\e'"\[1m/"$'\e'"\[4m/g"
}

Harder to read the output without bold or underlines.

oo you don't have to hard code the sequences.

export HOMEBREW_NO_EMOJI=1

tputq() {
  tput "$@" | sed "s#\[#\\\[#"
}

brew() {
  # Replace bold with underline.
  # https://github.com/Homebrew/brew/issues/7753
  HOMEBREW_COLOR=1 command brew "$@" | sed "s/$(tputq bold)/$(tputq smul)/g"
}
Was this page helpful?
0 / 5 - 0 ratings