-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
feat: support FORCE_COLOR
env variable
#9274
base: main
Are you sure you want to change the base?
Conversation
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. |
@@ -205,7 +205,8 @@ func NewSkaffoldCommand(out, errOut io.Writer) *cobra.Command { | |||
templates.ActsAsRootCommand(rootCmd, nil, groups...) | |||
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a way I should deprecate this option?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changing the name of the flag is a breaking change, we shouldn't do this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
@@ -205,7 +205,8 @@ func NewSkaffoldCommand(out, errOut io.Writer) *cobra.Command { | |||
templates.ActsAsRootCommand(rootCmd, nil, groups...) | |||
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changing the name of the flag is a breaking change, we shouldn't do this.
@@ -205,7 +205,8 @@ func NewSkaffoldCommand(out, errOut io.Writer) *cobra.Command { | |||
templates.ActsAsRootCommand(rootCmd, nil, groups...) | |||
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The flag is being initialized twice, in line 208 and 209.
Related: #2033
Description
Adds support for the common
FORCE_COLOR
environmental variable to force the use of color output. I also decided to rename--force-colors
to--force-color
for 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.