Add --quiet flag

parent 6018082f
Pipeline #85839786 passed with stage
in 51 seconds
......@@ -15,6 +15,7 @@ var logger zerolog.Logger
var registry string
var repository string
var verbose bool
var quiet bool
var sessions *sessionfile.Manager
var longNames bool
var showVersion bool
......@@ -41,10 +42,14 @@ var rootCmd = &cobra.Command{
fmt.Printf("%v, commit %v, built at %v", version, commit, date)
os.Exit(0)
}
if verbose {
logger = logger.Level(zerolog.DebugLevel)
if quiet {
logger = logger.Level(zerolog.ErrorLevel)
} else {
logger = logger.Level(zerolog.InfoLevel)
if verbose {
logger = logger.Level(zerolog.DebugLevel)
} else {
logger = logger.Level(zerolog.InfoLevel)
}
}
u, err := user.Current()
if err != nil {
......@@ -61,6 +66,7 @@ func init() {
rootCmd.PersistentFlags().StringVarP(&sessionName, "session", "s", "", "Session name")
rootCmd.PersistentFlags().BoolVarP(&longNames, "long", "l", false, "Display long names of tags and repositories including the registry path")
rootCmd.PersistentFlags().BoolVar(&verbose, "verbose", false, "Verbose logging")
rootCmd.PersistentFlags().BoolVar(&quiet, "quiet", false, "Quiet logging")
rootCmd.PersistentFlags().BoolVar(&showVersion, "version", false, "Show version information")
}
......
......@@ -8,3 +8,5 @@ require (
github.com/spf13/cobra v0.0.3
github.com/spf13/pflag v1.0.3 // indirect
)
go 1.13
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment