Skip to content

Color Writer: NO_COLOR support #8

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Sep 29, 2021
Merged

Conversation

SimonRichardson
Copy link
Member

The following supports the NO_COLOR standard. The idea is that we don't
write color to the term if the env var of NO_COLOR is set to anything
that can be truthy.

This brings juju inline with more new CLI.

See: https://no-color.org/

Copy link

@achilleasa achilleasa left a comment

Choose a reason for hiding this comment

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

LGTM. Once this lands in juju we might want to reach out to the no-color.org folks and add juju to the list.

The following supports the NO_COLOR standard. The idea is that we don't
write color to the term if the env var of NO_COLOR is set.

The spec states:

  > Command-line software which adds ANSI color to its output by default
  should check for the presence of a NO_COLOR environment variable that,
  when present (regardless of its value), prevents the addition of ANSI
  color.
file, err := ioutil.TempFile("", "")
c.Assert(err, gc.IsNil)

os.Setenv("NO_COLOR", "")
Copy link
Member

Choose a reason for hiding this comment

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

should we be deferring something to restore NO_COLOR to its original value? Otherwise parts of the test suite will be running in a different context than the rest.

@SimonRichardson
Copy link
Member Author

!!build!!

4 similar comments
@SimonRichardson
Copy link
Member Author

!!build!!

@SimonRichardson
Copy link
Member Author

!!build!!

@SimonRichardson
Copy link
Member Author

!!build!!

@jameinel
Copy link
Member

!!build!!

@jujubot
Copy link
Contributor

jujubot commented Sep 29, 2021

Build finished.

@SimonRichardson
Copy link
Member Author

$$merge$$

@jujubot
Copy link
Contributor

jujubot commented Sep 29, 2021

Build finished.

@SimonRichardson
Copy link
Member Author

!!build!!

@jujubot
Copy link
Contributor

jujubot commented Sep 29, 2021

Build finished.

@SimonRichardson
Copy link
Member Author

$$merge$$

@jujubot
Copy link
Contributor

jujubot commented Sep 29, 2021

Build finished.

1 similar comment
@jujubot
Copy link
Contributor

jujubot commented Sep 29, 2021

Build finished.

@jameinel
Copy link
Member

$$merge$$

@jujubot jujubot merged commit 8b71cc9 into juju:master Sep 29, 2021
@SimonRichardson SimonRichardson deleted the no_color branch September 29, 2021 14:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants