-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Closed
Labels
area/v3relates to / is being considered for v3relates to / is being considered for v3kind/bugdescribes or fixes a bugdescribes or fixes a bug
Description
Checklist
- Are you running the latest v3 release? The list of releases is here.
v3.0.0-beta1 - Did you check the manual for your release? The v3 manual is here.
- Did you perform a search about this feature? Here's the GitHub guide about searching.
What problem does this solve?
Fix action beeing called for all circumstances when a value is set by either a flag or alternative source. Currently the flag action is only executed when given as argument.
example:
Flags: []cli.Flag{
&cli.StringFlag{
Name: flag_log_level,
Usage: "The log level (trace, debug, info, warn, error, fatal, panic)",
Value: "info",
Sources: cli.EnvVars(flagEnv(flag_log_level)),
Action: func(ctx context.Context, cmd *cli.Command, value string) error {
log.Info("Setting log level to ", value)
level, err := log.ParseLevel(value)
if err != nil {
return err
}
log.SetLevel(level)
return nil
},
},
Solution description
When a env var is set, the action should be called.
Describe alternatives you've considered
not using in this case as it is has no consistent experience for users.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
area/v3relates to / is being considered for v3relates to / is being considered for v3kind/bugdescribes or fixes a bugdescribes or fixes a bug