From 6003da8daa05206ba0a33d47feab7f9c69bde18b Mon Sep 17 00:00:00 2001 From: Harshavardhana Date: Thu, 27 Jun 2019 15:43:14 -0700 Subject: [PATCH] update command with json flag shouldn't throw prompt (#2809) --- cmd/mb-main.go | 2 +- cmd/rm-main.go | 4 ++-- cmd/update-main.go | 10 +++++----- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/cmd/mb-main.go b/cmd/mb-main.go index 06c49f2f..4b56853b 100644 --- a/cmd/mb-main.go +++ b/cmd/mb-main.go @@ -69,7 +69,7 @@ EXAMPLES: 6. Create multiple directories including its missing parents (behavior similar to 'mkdir -p'). $ {{.HelpName}} /mnt/sdb/mydisk /mnt/sdc/mydisk /mnt/sdd/mydisk - + 7. Ignore if bucket/directory already exists. $ {{.HelpName}} --ignore-existing myminio/mynewbucket diff --git a/cmd/rm-main.go b/cmd/rm-main.go index 93654402..9511afa3 100644 --- a/cmd/rm-main.go +++ b/cmd/rm-main.go @@ -89,9 +89,9 @@ ENVIRONMENT VARIABLES: EXAMPLES: 1. Remove a file. $ {{.HelpName}} 1999/old-backup.tgz - + 2. Perform a fake remove operation. - $ {{.HelpName}} --fake 1999/old-backup.tgz + $ {{.HelpName}} --fake 1999/old-backup.tgz 3. Remove all objects recursively from bucket 'jazz-songs' matching the prefix 'louis'. $ {{.HelpName}} --recursive --force s3/jazz-songs/louis/ diff --git a/cmd/update-main.go b/cmd/update-main.go index 14c3630e..81e1ba2d 100644 --- a/cmd/update-main.go +++ b/cmd/update-main.go @@ -462,10 +462,9 @@ func mainUpdate(ctx *cli.Context) { cli.ShowCommandHelpAndExit(ctx, "update", -1) } - quiet := ctx.Bool("quiet") || ctx.GlobalBool("quiet") - if ctx.Bool("json") || ctx.GlobalBool("json") { - globalJSON = true - } + globalQuiet = ctx.Bool("quiet") || ctx.GlobalBool("quiet") + globalJSON = ctx.Bool("json") || ctx.GlobalBool("json") + updateMsg, sha256Hex, _, latestReleaseTime, err := getUpdateInfo(10 * time.Second) if err != nil { errorIf(err, "Unable to update ‘mc’.") @@ -489,9 +488,10 @@ func mainUpdate(ctx *cli.Context) { // Avoid updating mc development, source builds. if strings.Contains(updateMsg, mcReleaseURL) { + isUpdate := shouldUpdate(globalQuiet || globalJSON, sha256Hex, latestReleaseTime) var updateStatusMsg string var err *probe.Error - updateStatusMsg, err = doUpdate(sha256Hex, latestReleaseTime, shouldUpdate(quiet, sha256Hex, latestReleaseTime)) + updateStatusMsg, err = doUpdate(sha256Hex, latestReleaseTime, isUpdate) if err != nil { errorIf(err, "Unable to update ‘mc’.") os.Exit(-1)