forked from toolshed/abra
		
	refactor: move debug to internal
This commit is contained in:
		
							
								
								
									
										16
									
								
								cli/cli.go
									
									
									
									
									
								
							
							
						
						
									
										16
									
								
								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) | ||||
|  | ||||
| @ -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", | ||||
| } | ||||
|  | ||||
		Reference in New Issue
	
	Block a user