mc: Inherit global flags for initialization messages. (#2189)
Fixes #2089
This commit is contained in:
+6
-4
@@ -181,7 +181,9 @@ func initMC() {
|
||||
err := saveMcConfig(newMcConfig())
|
||||
fatalIf(err.Trace(), "Unable to save new mc config.")
|
||||
|
||||
console.Infoln("Configuration written to `" + mustGetMcConfigPath() + "`. Please update your access credentials.")
|
||||
if !globalQuiet && !globalJSON {
|
||||
console.Infoln("Configuration written to `" + mustGetMcConfigPath() + "`. Please update your access credentials.")
|
||||
}
|
||||
}
|
||||
|
||||
// Check if mc session folder exists.
|
||||
@@ -218,12 +220,12 @@ func registerBefore(ctx *cli.Context) error {
|
||||
// Migrate any old version of config / state files to newer format.
|
||||
migrate()
|
||||
|
||||
// Initialize default config files.
|
||||
initMC()
|
||||
|
||||
// Set global flags.
|
||||
setGlobalsFromContext(ctx)
|
||||
|
||||
// Initialize default config files.
|
||||
initMC()
|
||||
|
||||
// Check if config can be read.
|
||||
checkConfig()
|
||||
|
||||
|
||||
+9
-3
@@ -178,20 +178,26 @@ func initShareConfig() {
|
||||
if !isShareDirExists() {
|
||||
fatalIf(createShareDir().Trace(mustGetShareDir()),
|
||||
"Failed to create share `"+mustGetShareDir()+"` folder.")
|
||||
console.Infof("Successfully created `%s`.\n", mustGetShareDir())
|
||||
if !globalQuiet && !globalJSON {
|
||||
console.Infof("Successfully created `%s`.\n", mustGetShareDir())
|
||||
}
|
||||
}
|
||||
|
||||
// Uploads share file.
|
||||
if !isShareUploadsExists() {
|
||||
fatalIf(initShareUploadsFile().Trace(getShareUploadsFile()),
|
||||
"Failed to initialize share uploads `"+getShareUploadsFile()+"` file.")
|
||||
console.Infof("Initialized share uploads `%s` file.\n", getShareUploadsFile())
|
||||
if !globalQuiet && !globalJSON {
|
||||
console.Infof("Initialized share uploads `%s` file.\n", getShareUploadsFile())
|
||||
}
|
||||
}
|
||||
|
||||
// Downloads share file.
|
||||
if !isShareDownloadsExists() {
|
||||
fatalIf(initShareDownloadsFile().Trace(getShareDownloadsFile()),
|
||||
"Failed to initialize share downloads `"+getShareDownloadsFile()+"` file.")
|
||||
console.Infof("Initialized share downloads `%s` file.\n", getShareDownloadsFile())
|
||||
if !globalQuiet && !globalJSON {
|
||||
console.Infof("Initialized share downloads `%s` file.\n", getShareDownloadsFile())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user