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()
|
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
|
// environment variables, or command line flags
|
||||||
type config 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
|
||||||
}
|
}
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
// Create a config struct to hold the parsed environment variables or command line flags
|
// Create a options struct to hold the parsed environment variables or command line flags
|
||||||
config := config{}
|
opts := options{}
|
||||||
|
|
||||||
// Create the top-level CLI
|
// Create the top-level CLI
|
||||||
c := cli.NewApp()
|
c := cli.NewApp()
|
||||||
@ -57,7 +57,7 @@ func main() {
|
|||||||
Name: "debug",
|
Name: "debug",
|
||||||
Aliases: []string{"d"},
|
Aliases: []string{"d"},
|
||||||
Usage: "Enable debug-level logging",
|
Usage: "Enable debug-level logging",
|
||||||
Destination: &config.Debug,
|
Destination: &opts.Debug,
|
||||||
EnvVars: []string{"NVIDIA_CTK_DEBUG"},
|
EnvVars: []string{"NVIDIA_CTK_DEBUG"},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
@ -65,7 +65,7 @@ func main() {
|
|||||||
// Set log-level for all subcommands
|
// Set log-level for all subcommands
|
||||||
c.Before = func(c *cli.Context) error {
|
c.Before = func(c *cli.Context) error {
|
||||||
logLevel := log.InfoLevel
|
logLevel := log.InfoLevel
|
||||||
if config.Debug {
|
if opts.Debug {
|
||||||
logLevel = log.DebugLevel
|
logLevel = log.DebugLevel
|
||||||
}
|
}
|
||||||
logger.SetLevel(logLevel)
|
logger.SetLevel(logLevel)
|
||||||
|
Loading…
Reference in New Issue
Block a user