feat(internal): add quiet flag
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Tom Neuber 2024-08-19 20:22:41 +02:00
parent 153e452e4f
commit 535ed5a5c6
Signed by: tom
GPG key ID: F17EFE4272D89FF6
2 changed files with 4 additions and 0 deletions

View file

@ -32,6 +32,8 @@ func NewRootCommand(c *config.Config) *cobra.Command {
zerolog.SetGlobalLevel(zerolog.InfoLevel)
if c.Debug {
zerolog.SetGlobalLevel(zerolog.DebugLevel)
} else if c.Quiet {
zerolog.SetGlobalLevel(zerolog.ErrorLevel)
}
if c.JSONFormat {
@ -47,6 +49,7 @@ func NewRootCommand(c *config.Config) *cobra.Command {
rootCmd.PersistentFlags().BoolVarP(&c.Debug, "debug", "d", false, "Debug output")
rootCmd.PersistentFlags().BoolVar(&c.JSONFormat, "json", false, "JSON output")
rootCmd.PersistentFlags().BoolVar(&c.Quiet, "quiet", false, "Quiet output (only errors)")
rootCmd.PersistentFlags().StringVar(&c.GrafanaURL, "grafana-url", "", "Grafana URL to access the API")
rootCmd.PersistentFlags().StringVar(&c.GrafanaToken, "grafana-token", "", "Grafana auth token to access the API")
rootCmd.PersistentFlags().StringVar(&c.GitBranch, "git-branch", "main", "Git branch name")

View file

@ -19,6 +19,7 @@ type Config struct {
GitUser string
GitPass string
GPGKey string
Quiet bool
Output io.Writer
Logger zerolog.Logger