diff --git a/cmd-cp.go b/cmd-cp.go index c299b881..c6dc81da 100644 --- a/cmd-cp.go +++ b/cmd-cp.go @@ -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...) diff --git a/cmd-options.go b/cmd-options.go index f90e1345..30c2eadb 100644 --- a/cmd-options.go +++ b/cmd-options.go @@ -223,6 +223,10 @@ var ( Name: "debug", Usage: "Enable HTTP tracing", }, + cli.BoolFlag{ + Name: "quiet, q", + Usage: "Supress chatty console output", + }, } ) diff --git a/globals.go b/globals.go index 45886101..85396120 100644 --- a/globals.go +++ b/globals.go @@ -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] + diff --git a/main.go b/main.go index 101754dd..a911a45b 100644 --- a/main.go +++ b/main.go @@ -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()