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:
Harshavardhana
2018-06-29 14:56:07 -07:00
committed by kannappanr
parent 4070902cda
commit 29f2dbca6b
4 changed files with 28 additions and 7 deletions
+5 -3
View File
@@ -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