feat(internal): add quiet flag
This commit is contained in:
parent
1f0d76ba9e
commit
64a96bc8e2
2 changed files with 4 additions and 0 deletions
|
@ -32,6 +32,8 @@ func NewRootCommand(c *config.Config) *cobra.Command {
|
||||||
zerolog.SetGlobalLevel(zerolog.InfoLevel)
|
zerolog.SetGlobalLevel(zerolog.InfoLevel)
|
||||||
if c.Debug {
|
if c.Debug {
|
||||||
zerolog.SetGlobalLevel(zerolog.DebugLevel)
|
zerolog.SetGlobalLevel(zerolog.DebugLevel)
|
||||||
|
} else if c.Quiet {
|
||||||
|
zerolog.SetGlobalLevel(zerolog.ErrorLevel)
|
||||||
}
|
}
|
||||||
|
|
||||||
if c.JSONFormat {
|
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().BoolVarP(&c.Debug, "debug", "d", false, "Debug output")
|
||||||
rootCmd.PersistentFlags().BoolVar(&c.JSONFormat, "json", false, "JSON 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.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.GrafanaToken, "grafana-token", "", "Grafana auth token to access the API")
|
||||||
rootCmd.PersistentFlags().StringVar(&c.GitBranch, "git-branch", "main", "Git branch name")
|
rootCmd.PersistentFlags().StringVar(&c.GitBranch, "git-branch", "main", "Git branch name")
|
||||||
|
|
|
@ -19,6 +19,7 @@ type Config struct {
|
||||||
GitUser string
|
GitUser string
|
||||||
GitPass string
|
GitPass string
|
||||||
GPGKey string
|
GPGKey string
|
||||||
|
Quiet bool
|
||||||
|
|
||||||
Output io.Writer
|
Output io.Writer
|
||||||
Logger zerolog.Logger
|
Logger zerolog.Logger
|
||||||
|
|
Loading…
Reference in a new issue