mirror of
https://github.com/minio/mc.git
synced 2025-11-14 23:42:27 +03:00
Implement console.Fatals, Errors, Infos, Prints for structure input and printing
This commit is contained in:
12
cmd-mb.go
12
cmd-mb.go
@@ -33,14 +33,14 @@ func runMakeBucketCmd(ctx *cli.Context) {
|
||||
cli.ShowCommandHelpAndExit(ctx, "mb", 1) // last argument is exit code
|
||||
}
|
||||
if !isMcConfigExist() {
|
||||
console.Fatalln(ErrorMessage{
|
||||
console.Fatals(ErrorMessage{
|
||||
Message: "Please run \"mc config generate\"",
|
||||
Error: errors.New("\"mc\" is not configured"),
|
||||
})
|
||||
}
|
||||
config, err := getMcConfig()
|
||||
if err != nil {
|
||||
console.Fatalln(ErrorMessage{
|
||||
console.Fatals(ErrorMessage{
|
||||
Message: "Unable to read config file ‘" + mustGetMcConfigPath() + "’",
|
||||
Error: err,
|
||||
})
|
||||
@@ -51,12 +51,12 @@ func runMakeBucketCmd(ctx *cli.Context) {
|
||||
if err != nil {
|
||||
switch e := iodine.ToError(err).(type) {
|
||||
case errUnsupportedScheme:
|
||||
console.Fatalln(ErrorMessage{
|
||||
console.Fatals(ErrorMessage{
|
||||
Message: fmt.Sprintf("Unknown type of URL ‘%s’", e.url),
|
||||
Error: e,
|
||||
})
|
||||
default:
|
||||
console.Fatalln(ErrorMessage{
|
||||
console.Fatals(ErrorMessage{
|
||||
Message: fmt.Sprintf("Unable to parse argument ‘%s’", arg),
|
||||
Error: err,
|
||||
})
|
||||
@@ -64,7 +64,7 @@ func runMakeBucketCmd(ctx *cli.Context) {
|
||||
}
|
||||
targetConfig, err := getHostConfig(targetURL)
|
||||
if err != nil {
|
||||
console.Fatalln(ErrorMessage{
|
||||
console.Fatals(ErrorMessage{
|
||||
Message: fmt.Sprintf("Unable to read host configuration for ‘%s’ from config file ‘%s’", targetURL, mustGetMcConfigPath()),
|
||||
Error: err,
|
||||
})
|
||||
@@ -74,7 +74,7 @@ func runMakeBucketCmd(ctx *cli.Context) {
|
||||
for targetURL, targetConfig := range targetURLConfigMap {
|
||||
errorMsg, err := doMakeBucketCmd(targetURL, targetConfig)
|
||||
if err != nil {
|
||||
console.Errorln(ErrorMessage{
|
||||
console.Errors(ErrorMessage{
|
||||
Message: errorMsg,
|
||||
Error: err,
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user