Merge pull request #378 from abperiasamy/quiet
issue#371 implement --quiet
This commit is contained in:
@@ -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...)
|
||||
|
||||
@@ -223,6 +223,10 @@ var (
|
||||
Name: "debug",
|
||||
Usage: "Enable HTTP tracing",
|
||||
},
|
||||
cli.BoolFlag{
|
||||
Name: "quiet, q",
|
||||
Usage: "Supress chatty console output",
|
||||
},
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
@@ -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] +
|
||||
|
||||
Reference in New Issue
Block a user