Honor global flags irrespective of the position. (#5486)

Flags like `json, config-dir, quiet` are now honored even if they are
between minio and gateway in the cli, like, `minio --json gateway s3`.

Fixes #5403
This commit is contained in:
kannappanr
2018-02-28 20:13:33 -08:00
committed by Dee Koder
parent 6faa1ef11a
commit d32f90fe95
5 changed files with 46 additions and 25 deletions

View File

@@ -156,13 +156,13 @@ func serverMain(ctx *cli.Context) {
// Get "json" flag from command line argument and
// enable json and quite modes if jason flag is turned on.
jsonFlag := ctx.Bool("json") || ctx.GlobalBool("json")
jsonFlag := ctx.IsSet("json") || ctx.GlobalIsSet("json")
if jsonFlag {
log.EnableJSON()
}
// Get quiet flag from command line argument.
quietFlag := ctx.Bool("quiet") || ctx.GlobalBool("quiet")
quietFlag := ctx.IsSet("quiet") || ctx.GlobalIsSet("quiet")
if quietFlag {
log.EnableQuiet()
}