diff --git a/cli/cli.go b/cli/cli.go index 1d2aa7e8..1ab5bb6d 100644 --- a/cli/cli.go +++ b/cli/cli.go @@ -30,18 +30,6 @@ var VerboseFlag = &cli.BoolFlag{ Usage: "Show INFO messages", } -// Debug stores the variable from DebugFlag. -var Debug bool - -// DebugFlag turns on/off verbose logging down to the DEBUG level. -var DebugFlag = &cli.BoolFlag{ - Name: "debug", - Aliases: []string{"d"}, - Value: false, - Destination: &Debug, - Usage: "Show DEBUG messages", -} - func newAbraApp(version, commit string) *cli.App { app := &cli.App{ Name: "abra", @@ -66,7 +54,7 @@ func newAbraApp(version, commit string) *cli.App { }, Flags: []cli.Flag{ VerboseFlag, - DebugFlag, + internal.DebugFlag, internal.NoInputFlag, }, Authors: []*cli.Author{ @@ -80,7 +68,7 @@ func newAbraApp(version, commit string) *cli.App { app.EnableBashCompletion = true app.Before = func(c *cli.Context) error { - if Debug { + if internal.Debug { logrus.SetLevel(logrus.DebugLevel) logrus.SetFormatter(&logrus.TextFormatter{}) logrus.SetOutput(os.Stderr) diff --git a/cli/internal/common.go b/cli/internal/common.go index 1cf6a403..9968f0c7 100644 --- a/cli/internal/common.go +++ b/cli/internal/common.go @@ -259,3 +259,15 @@ var HetznerCloudAPITokenFlag = &cli.StringFlag{ EnvVars: []string{"HCLOUD_TOKEN"}, Destination: &HetznerCloudAPIToken, } + +// Debug stores the variable from DebugFlag. +var Debug bool + +// DebugFlag turns on/off verbose logging down to the DEBUG level. +var DebugFlag = &cli.BoolFlag{ + Name: "debug", + Aliases: []string{"d"}, + Value: false, + Destination: &Debug, + Usage: "Show DEBUG messages", +}