Skip to content

shell commands: colourize messages#6765

Merged
MikeMcQuaid merged 1 commit intoHomebrew:masterfrom
EricFromCanada:shell-ohai
Nov 22, 2019
Merged

shell commands: colourize messages#6765
MikeMcQuaid merged 1 commit intoHomebrew:masterfrom
EricFromCanada:shell-ohai

Conversation

@EricFromCanada
Copy link
Copy Markdown
Member

  • Have you followed the guidelines in our Contributing document?
  • Have you checked to ensure there aren't other open Pull Requests for the same change?
  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you written new tests for your changes? Here's an example.
  • Have you successfully run brew style with your changes locally?
  • Have you successfully run brew tests with your changes locally?

Adds colour to shell-based commands via a new ohai function, and adds a check for HOMEBREW_NO_COLOR where necessary.

@issyl0
Copy link
Copy Markdown
Member

issyl0 commented Nov 21, 2019

What benefits does this have?

@EricFromCanada
Copy link
Copy Markdown
Member Author

Consistency with .rb-based commands and readability. It's something I noticed, as one who has several VM windows open for testing and runs brew update-reset frequently.

Copy link
Copy Markdown
Member

@issyl0 issyl0 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense - thanks!

Copy link
Copy Markdown
Member

@MikeMcQuaid MikeMcQuaid left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work here @EricFromCanada, I like it!

Comment thread Library/Homebrew/brew.sh
export HOMEBREW_COMMAND_DEPTH=$((HOMEBREW_COMMAND_DEPTH + 1))

ohai() {
if [[ -t 1 && -z "$HOMEBREW_NO_COLOR" ]] # check whether stdout is a tty.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would be good to also use colours unconditionally if HOMEBREW_COLOR is set (but that can be a follow-up PR).

@MikeMcQuaid MikeMcQuaid merged commit a5550aa into Homebrew:master Nov 22, 2019
@EricFromCanada EricFromCanada deleted the shell-ohai branch November 22, 2019 13:54
@lock lock bot added the outdated PR was locked due to age label Jan 1, 2020
@lock lock bot locked as resolved and limited conversation to collaborators Jan 1, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

outdated PR was locked due to age

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants