Merge pull request #106 from abperiasamy/debug_flag

replace --verbose with --debug and --quiet bool flags
This commit is contained in:
Anand Babu (AB) Periasamy
2015-03-11 12:57:07 -07:00
2 changed files with 8 additions and 21 deletions
+1 -17
View File
@@ -17,10 +17,8 @@
package main
import (
"fmt"
"net/http"
"net/url"
"os"
"path"
"strings"
@@ -30,26 +28,12 @@ import (
// NewClient - get new client
func getNewClient(c *cli.Context) (*s3.Client, error) {
switch c.GlobalString("verbose") {
case "trace":
case "quiet":
case "":
if c.GlobalBool("verbose") {
fmt.Printf("Error: No value specified for --verbose=[quiet|trace]\n")
os.Exit(1)
}
default:
fmt.Printf("Error: Invalid value specified for --verbose=[%s]\n", c.GlobalString("verbose"))
os.Exit(1)
}
config, err := getMcConfig()
if err != nil {
fatal(err.Error())
}
if c.GlobalString("verbose") == "trace" {
if c.GlobalBool("debug") {
traceTransport := s3.RoundTripTrace{
Trace: s3Trace{BodyTraceFlag: false, RequestTransportFlag: true, Writer: nil},
Transport: http.DefaultTransport,
+7 -4
View File
@@ -98,9 +98,12 @@ var options = []cli.Command{
}
var flags = []cli.Flag{
cli.StringFlag{
Name: "verbose, V",
Value: "trace, quiet",
Usage: "[trace] enables HTTP tracing. [quiet] disables progress bar.",
cli.BoolFlag{
Name: "debug",
Usage: "enable HTTP tracing",
},
cli.BoolFlag{
Name: "quiet, q",
Usage: "disable chatty output, such as the progress bar",
},
}