mirror of
https://github.com/NVIDIA/nvidia-container-toolkit
synced 2025-04-30 10:34:01 +00:00
Rename config struct options to avoid conflict
This change renames the struct for storing CLI flag values options over config to avoid a conflict with the config package. Signed-off-by: Evan Lezar <elezar@nvidia.com>
This commit is contained in:
parent
2e3a12438a
commit
4165961d31
@ -32,16 +32,16 @@ import (
|
||||
|
||||
var logger = log.New()
|
||||
|
||||
// config defines the options that can be set for the CLI through config files,
|
||||
// options defines the options that can be set for the CLI through config files,
|
||||
// environment variables, or command line flags
|
||||
type config struct {
|
||||
type options struct {
|
||||
// Debug indicates whether the CLI is started in "debug" mode
|
||||
Debug bool
|
||||
}
|
||||
|
||||
func main() {
|
||||
// Create a config struct to hold the parsed environment variables or command line flags
|
||||
config := config{}
|
||||
// Create a options struct to hold the parsed environment variables or command line flags
|
||||
opts := options{}
|
||||
|
||||
// Create the top-level CLI
|
||||
c := cli.NewApp()
|
||||
@ -57,7 +57,7 @@ func main() {
|
||||
Name: "debug",
|
||||
Aliases: []string{"d"},
|
||||
Usage: "Enable debug-level logging",
|
||||
Destination: &config.Debug,
|
||||
Destination: &opts.Debug,
|
||||
EnvVars: []string{"NVIDIA_CTK_DEBUG"},
|
||||
},
|
||||
}
|
||||
@ -65,7 +65,7 @@ func main() {
|
||||
// Set log-level for all subcommands
|
||||
c.Before = func(c *cli.Context) error {
|
||||
logLevel := log.InfoLevel
|
||||
if config.Debug {
|
||||
if opts.Debug {
|
||||
logLevel = log.DebugLevel
|
||||
}
|
||||
logger.SetLevel(logLevel)
|
||||
|
Loading…
Reference in New Issue
Block a user