mirror of
https://github.com/Belphemur/CBZOptimizer.git
synced 2025-10-14 04:28:51 +02:00
fix: add autocomplete defintion for log level
This commit is contained in:
@@ -54,10 +54,20 @@ func init() {
|
|||||||
viper.AutomaticEnv()
|
viper.AutomaticEnv()
|
||||||
|
|
||||||
// Add log level flag (accepts zerolog levels: panic, fatal, error, warn, info, debug, trace)
|
// Add log level flag (accepts zerolog levels: panic, fatal, error, warn, info, debug, trace)
|
||||||
|
ef := enumflag.New(&logLevel, "log", LogLevelIds, enumflag.EnumCaseInsensitive)
|
||||||
rootCmd.PersistentFlags().VarP(
|
rootCmd.PersistentFlags().VarP(
|
||||||
enumflag.New(&logLevel, "log", LogLevelIds, enumflag.EnumCaseInsensitive),
|
ef,
|
||||||
"log", "l",
|
"log", "l",
|
||||||
"Set log level; can be 'panic', 'fatal', 'error', 'warn', 'info', 'debug', or 'trace'")
|
"Set log level; can be 'panic', 'fatal', 'error', 'warn', 'info', 'debug', or 'trace'")
|
||||||
|
ef.RegisterCompletion(rootCmd, "log", enumflag.Help[zerolog.Level]{
|
||||||
|
zerolog.PanicLevel: "Only log panic messages",
|
||||||
|
zerolog.FatalLevel: "Log fatal and panic messages",
|
||||||
|
zerolog.ErrorLevel: "Log error, fatal, and panic messages",
|
||||||
|
zerolog.WarnLevel: "Log warn, error, fatal, and panic messages",
|
||||||
|
zerolog.InfoLevel: "Log info, warn, error, fatal, and panic messages",
|
||||||
|
zerolog.DebugLevel: "Log debug, info, warn, error, fatal, and panic messages",
|
||||||
|
zerolog.TraceLevel: "Log all messages including trace",
|
||||||
|
})
|
||||||
|
|
||||||
// Add log level environment variable support
|
// Add log level environment variable support
|
||||||
viper.BindEnv("log", "LOG_LEVEL")
|
viper.BindEnv("log", "LOG_LEVEL")
|
||||||
|
Reference in New Issue
Block a user