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
+8 -2
View File
@@ -1,5 +1,5 @@
/*
* Minio Cloud Storage, (C) 2015, 2016, 2017 Minio, Inc.
* Minio Cloud Storage, (C) 2015, 2016, 2017, 2018 Minio, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -32,7 +32,13 @@ var globalFlags = []cli.Flag{
cli.StringFlag{
Name: "config-dir, C",
Value: getConfigDir(),
Usage: "Path to configuration directory.",
Usage: func() string {
usage := "Path to configuration directory."
if getConfigDir() == "" {
usage = usage + " This option must be set."
}
return usage
}(),
},
cli.BoolFlag{
Name: "quiet",