mirror of
https://github.com/NVIDIA/nvidia-container-toolkit
synced 2024-11-29 07:21:46 +00:00
Add quiet mode to nvidia-ctk cli
Signed-off-by: Evan Lezar <elezar@nvidia.com>
This commit is contained in:
parent
2299c9588d
commit
ba24338122
@ -36,6 +36,8 @@ import (
|
|||||||
type options struct {
|
type options struct {
|
||||||
// Debug indicates whether the CLI is started in "debug" mode
|
// Debug indicates whether the CLI is started in "debug" mode
|
||||||
Debug bool
|
Debug bool
|
||||||
|
// Quiet indicates whether the CLI is started in "quiet" mode
|
||||||
|
Quiet bool
|
||||||
}
|
}
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
@ -61,6 +63,12 @@ func main() {
|
|||||||
Destination: &opts.Debug,
|
Destination: &opts.Debug,
|
||||||
EnvVars: []string{"NVIDIA_CTK_DEBUG"},
|
EnvVars: []string{"NVIDIA_CTK_DEBUG"},
|
||||||
},
|
},
|
||||||
|
&cli.BoolFlag{
|
||||||
|
Name: "quiet",
|
||||||
|
Usage: "Suppress all output except for errors; overrides --debug",
|
||||||
|
Destination: &opts.Quiet,
|
||||||
|
EnvVars: []string{"NVIDIA_CTK_QUIET"},
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set log-level for all subcommands
|
// Set log-level for all subcommands
|
||||||
@ -69,6 +77,9 @@ func main() {
|
|||||||
if opts.Debug {
|
if opts.Debug {
|
||||||
logLevel = logrus.DebugLevel
|
logLevel = logrus.DebugLevel
|
||||||
}
|
}
|
||||||
|
if opts.Quiet {
|
||||||
|
logLevel = logrus.ErrorLevel
|
||||||
|
}
|
||||||
logger.SetLevel(logLevel)
|
logger.SetLevel(logLevel)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user