Disabling color through environment variables (#598)

* This patch adds support for disabling color through environment variables.
- NO_COLOR: https://no-color.org/
- CLICOLOR,CLICOLOR_FORCE: https://bixense.com/clicolors/ ( [logrus built-in](6699a89a23/text_formatter.go (L46)) )

* use viper/cobra and add documentation. (https://github.com/containrrr/watchtower/pull/598#pullrequestreview-463814669)

Co-authored-by: Simon Aronsson <simme@arcticbit.se>
This commit is contained in:
bugficks 2020-08-21 22:54:16 +02:00 committed by GitHub
parent 9bd3913a11
commit 158b6935d4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 39 additions and 13 deletions

View file

@ -140,7 +140,12 @@ func RegisterSystemFlags(rootCmd *cobra.Command) {
"",
viper.GetString("WATCHTOWER_HTTP_API_TOKEN"),
"Sets an authentication token to HTTP API requests.")
// https://no-color.org/
flags.BoolP(
"no-color",
"",
viper.IsSet("NO_COLOR"),
"Disable ANSI color escape codes in log output")
flags.StringP(
"scope",
"",