Fix 'mc mb' to guide the user when bucket is not passed (#2476)
Additionally this PR also allows for creating prefixes on S3 compatible object storage backends in the following form ``` mc mb s3/harshavardhana/object/prefix/ ```
This commit is contained in:
committed by
kannappanr
parent
4070902cda
commit
29f2dbca6b
+5
-3
@@ -41,7 +41,7 @@ type errorMessage struct {
|
||||
}
|
||||
|
||||
// fatalIf wrapper function which takes error and selectively prints stack frames if available on debug
|
||||
func fatalIf(err *probe.Error, msg string) {
|
||||
func fatalIf(err *probe.Error, msg string, data ...interface{}) {
|
||||
if err == nil {
|
||||
return
|
||||
}
|
||||
@@ -71,6 +71,7 @@ func fatalIf(err *probe.Error, msg string) {
|
||||
console.Println(string(json))
|
||||
console.Fatalln()
|
||||
}
|
||||
msg = fmt.Sprintf(msg, data...)
|
||||
if !globalDebug {
|
||||
console.Fatalln(fmt.Sprintf("%s %s", msg, err.ToGoError()))
|
||||
}
|
||||
@@ -87,13 +88,13 @@ func exitStatus(status int) error {
|
||||
}
|
||||
|
||||
// errorIf synonymous with fatalIf but doesn't exit on error != nil
|
||||
func errorIf(err *probe.Error, msg string) {
|
||||
func errorIf(err *probe.Error, msg string, data ...interface{}) {
|
||||
if err == nil {
|
||||
return
|
||||
}
|
||||
if globalJSON {
|
||||
errorMsg := errorMessage{
|
||||
Message: msg,
|
||||
Message: fmt.Sprintf(msg, data...),
|
||||
Type: "error",
|
||||
Cause: causeMessage{
|
||||
Message: err.ToGoError().Error(),
|
||||
@@ -117,6 +118,7 @@ func errorIf(err *probe.Error, msg string) {
|
||||
console.Println(string(json))
|
||||
return
|
||||
}
|
||||
msg = fmt.Sprintf(msg, data...)
|
||||
if !globalDebug {
|
||||
console.Errorln(fmt.Sprintf("%s %s", msg, err.ToGoError()))
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user