update command with json flag shouldn't throw prompt (#2809)

This commit is contained in:
Harshavardhana
2019-06-27 15:43:14 -07:00
committed by kannappanr
parent 41e3ea5664
commit c079a8fa9a
3 changed files with 8 additions and 8 deletions
+1 -1
View File
@@ -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
+2 -2
View File
@@ -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/
+5 -5
View File
@@ -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)