Merge pull request #378 from abperiasamy/quiet

issue#371 implement --quiet
This commit is contained in:
Anand Babu (AB) Periasamy
2015-04-14 19:39:22 -07:00
4 changed files with 16 additions and 4 deletions
+10 -4
View File
@@ -19,6 +19,7 @@ package main
import (
"io"
"github.com/cheggaaa/pb"
"github.com/minio-io/cli"
"github.com/minio-io/mc/pkg/console"
"github.com/minio-io/minio/pkg/iodine"
@@ -95,14 +96,19 @@ func doCopyCmd(ctx *cli.Context) {
log.Debug.Println(iodine.New(err, nil))
console.Fatalln("Unable to open targets for writing")
}
// set up progress bar
var writers []io.Writer
for _, writer := range writeClosers {
writers = append(writers, writer)
}
bar := startBar(length)
bar.Start()
writers = append(writers, bar)
// set up progress bar
var bar *pb.ProgressBar
if !globalQuietFlag {
bar = startBar(length)
bar.Start()
writers = append(writers, bar)
}
// write progress bar
multiWriter := io.MultiWriter(writers...)
+4
View File
@@ -223,6 +223,10 @@ var (
Name: "debug",
Usage: "Enable HTTP tracing",
},
cli.BoolFlag{
Name: "quiet, q",
Usage: "Supress chatty console output",
},
}
)
+1
View File
@@ -25,6 +25,7 @@ import (
var (
globalDebugFlag = false // Debug flag set via command line
globalQuietFlag = false // Quiet flag set via command line
mcUserAgent = "Minio/" +
strings.SplitN(mcGitCommitHash, " ", 3)[1] +
+1
View File
@@ -94,6 +94,7 @@ func main() {
app.Author = "Minio.io"
app.EnableBashCompletion = true
app.Before = func(ctx *cli.Context) error {
globalQuietFlag = ctx.GlobalBool("quiet")
globalDebugFlag = ctx.GlobalBool("debug")
if globalDebugFlag {
app.ExtraInfo = getSystemData()