Add global --debug flag. Unless this is set, debug information is now suppressed.
diff --git a/cmd/msg.go b/cmd/msg.go index 5f7e555..861db75 100644 --- a/cmd/msg.go +++ b/cmd/msg.go
@@ -39,7 +39,7 @@ // Debug logs debug information func Debug(msg string, args ...interface{}) { - if Quiet { + if Quiet || !IsDebugging { return } fmt.Print("[DEBUG] ")
diff --git a/cmd/msg_windows.go b/cmd/msg_windows.go index 604dba6..6774ebd 100644 --- a/cmd/msg_windows.go +++ b/cmd/msg_windows.go
@@ -19,7 +19,7 @@ // Debug logs debug information func Debug(msg string, args ...interface{}) { - if Quiet { + if Quiet || !IsDebugging { return } fmt.Print("[DEBUG] ")
diff --git a/cmd/util.go b/cmd/util.go index 9169f54..5527153 100644 --- a/cmd/util.go +++ b/cmd/util.go
@@ -15,10 +15,12 @@ // Quiet, when set to true, can suppress Info and Debug messages. var Quiet = false +var IsDebugging = false // BeQuiet supresses Info and Debug messages. func BeQuiet(c cookoo.Context, p *cookoo.Params) (interface{}, cookoo.Interrupt) { Quiet = p.Get("quiet", false).(bool) + IsDebugging = p.Get("debug", false).(bool) return Quiet, nil }
diff --git a/cmd/yaml.go b/cmd/yaml.go index c629e1e..f0fbbdf 100644 --- a/cmd/yaml.go +++ b/cmd/yaml.go
@@ -432,7 +432,6 @@ UpdateAsVendored bool Flatten bool Flattened bool - dirty bool } // DependencyFromYaml creates a dependency from a yaml.Node.
diff --git a/glide.go b/glide.go index 88f62ee..130a951 100644 --- a/glide.go +++ b/glide.go
@@ -90,6 +90,10 @@ Name: "quiet, q", Usage: "Quiet (no info or debug messages)", }, + cli.BoolFlag{ + Name: "debug", + Usage: "Print Debug messages (verbose)", + }, } app.CommandNotFound = func(c *cli.Context, command string) { cxt.Put("os.Args", os.Args) @@ -389,6 +393,7 @@ func setupHandler(c *cli.Context, route string, cxt cookoo.Context, router *cookoo.Router) { cxt.Put("q", c.GlobalBool("quiet")) + cxt.Put("debug", c.GlobalBool("debug")) cxt.Put("yaml", c.GlobalString("yaml")) cxt.Put("cliArgs", c.Args()) if err := router.HandleRequest(route, cxt, false); err != nil { @@ -402,6 +407,7 @@ // TODO: Add setup for debug in addition to quiet. Does(cmd.BeQuiet, "quiet"). Using("quiet").From("cxt:q"). + Using("debug").From("cxt:debug"). Does(cmd.VersionGuard, "v") reg.Route("@ready", "Prepare for glide commands.").