feat: support FORCE_COLOR env variable#9274
feat: support FORCE_COLOR env variable#9274omus wants to merge 3 commits intoGoogleContainerTools:mainfrom
FORCE_COLOR env variable#9274Conversation
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
| rootCmd.PersistentFlags().StringVarP(&v, "verbosity", "v", log.DefaultLogLevel.String(), fmt.Sprintf("Log level: one of %v", log.AllLevels)) | ||
| rootCmd.PersistentFlags().IntVar(&defaultColor, "color", int(output.DefaultColorCode), "Specify the default output color in ANSI escape codes") | ||
| rootCmd.PersistentFlags().BoolVar(&forceColors, "force-colors", false, "Always print color codes (hidden)") | ||
| rootCmd.PersistentFlags().BoolVar(&forceColor, "force-colors", false, "Always print color codes (hidden)") |
There was a problem hiding this comment.
Is there a way I should deprecate this option?
There was a problem hiding this comment.
Changing the name of the flag is a breaking change, we shouldn't do this.
There was a problem hiding this comment.
We can keep both --force-colors and --force-color as flags to avoid any breakage. How does Skaffold deal with informing users about upcoming breaking changes?
FORCE_COLOR env variableFORCE_COLOR env variable
| rootCmd.PersistentFlags().StringVarP(&v, "verbosity", "v", log.DefaultLogLevel.String(), fmt.Sprintf("Log level: one of %v", log.AllLevels)) | ||
| rootCmd.PersistentFlags().IntVar(&defaultColor, "color", int(output.DefaultColorCode), "Specify the default output color in ANSI escape codes") | ||
| rootCmd.PersistentFlags().BoolVar(&forceColors, "force-colors", false, "Always print color codes (hidden)") | ||
| rootCmd.PersistentFlags().BoolVar(&forceColor, "force-colors", false, "Always print color codes (hidden)") |
There was a problem hiding this comment.
Changing the name of the flag is a breaking change, we shouldn't do this.
| rootCmd.PersistentFlags().StringVarP(&v, "verbosity", "v", log.DefaultLogLevel.String(), fmt.Sprintf("Log level: one of %v", log.AllLevels)) | ||
| rootCmd.PersistentFlags().IntVar(&defaultColor, "color", int(output.DefaultColorCode), "Specify the default output color in ANSI escape codes") | ||
| rootCmd.PersistentFlags().BoolVar(&forceColors, "force-colors", false, "Always print color codes (hidden)") | ||
| rootCmd.PersistentFlags().BoolVar(&forceColor, "force-colors", false, "Always print color codes (hidden)") |
There was a problem hiding this comment.
The flag is being initialized twice, in line 208 and 209.
Related: #2033
Description
Adds support for the common
FORCE_COLORenvironmental variable to force the use of color output. I also decided to rename--force-colorsto--force-colorfor consistency with the environmental variable and have made the option no longer hidden as it makes it hard to discover.User facing changes
Makes discovery of the global option and the associated environmental variable easier to discover.