From f8b53d114bc0607b6ebd36534793013d5761cafd Mon Sep 17 00:00:00 2001 From: Luiz Aoqui Date: Thu, 7 Nov 2024 10:19:24 -0300 Subject: [PATCH] cmd: fix --log-level help message and viper bind Add the missing descriptive help message to the `--log-level` flag and fix the Viper config bind. Signed-off-by: Luiz Aoqui --- pkg/command/command.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/command/command.go b/pkg/command/command.go index be53d6a..ff75db6 100644 --- a/pkg/command/command.go +++ b/pkg/command/command.go @@ -239,8 +239,8 @@ func (c *Command[T]) runCmd(ctx context.Context, commandType Type) error { } c.logLevel = types.InfoLevel - c.command.PersistentFlags().VarP(&c.logLevel, "log-level", "", "") - if err = viper.BindPFlag("log-level", c.command.PersistentFlags().Lookup("debug")); err != nil { + c.command.PersistentFlags().VarP(&c.logLevel, "log-level", "", "Specifies the level of log verbosity. Possible values: [fatal, error, warn, info, debug, trace]") + if err = viper.BindPFlag("log-level", c.command.PersistentFlags().Lookup("log-level")); err != nil { return err } _ = c.command.RegisterFlagCompletionFunc("log-level", func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {