Skip to content
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

Disabling color through environment variables #598

Merged
merged 4 commits into from
Aug 21, 2020

Conversation

bugficks
Copy link
Contributor

@bugficks bugficks commented Jul 8, 2020

This patch adds support for disabling color through environment variables.

@bugficks
Copy link
Contributor Author

bugficks commented Jul 9, 2020 via email

@piksel
Copy link
Member

piksel commented Jul 9, 2020

Yeah, I noticed, so I removed the comment. I don't think there are any issues with this.

Copy link
Member

@simskij simskij left a comment

Choose a reason for hiding this comment

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

Thank you for your contribution! While I really like the feature you've added, I'd kindly like to ask you to implement it the same way as all other flags and env vars in watchtower, namely in https://github.com/containrrr/watchtower/blob/master/internal/flags/flags.go using viper and cobra. I'd also like to ask you to document this feature in https://github.com/containrrr/watchtower/blob/master/docs/arguments.md

Thanks again. 🙇

cmd/root.go Outdated
@@ -61,6 +61,18 @@ func Execute() {
func PreRun(cmd *cobra.Command, args []string) {
f := cmd.PersistentFlags()

// https://no-color.org/
if _, enabled := os.LookupEnv("NO_COLOR"); enabled {
Copy link
Member

Choose a reason for hiding this comment

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

Should be implemented the same way as all other flags and env vars.

@simskij simskij merged commit 158b693 into containrrr:master Aug 21, 2020
@simskij
Copy link
Member

simskij commented Aug 21, 2020

@all-contributors add @bugficks for code

@simskij
Copy link
Member

simskij commented Aug 21, 2020

Thank you for your contribution! 🙇

@allcontributors
Copy link
Contributor

@simskij

I've put up a pull request to add @bugficks! 🎉

@bugficks bugficks deleted the no-color branch March 3, 2021 16:38
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.

3 participants