Verify if mc config exists for cp and cast commands

This commit is contained in:
Harshavardhana
2015-07-23 22:49:12 -07:00
parent 615852d4e6
commit 2f253f68b6
3 changed files with 10 additions and 3 deletions
+3 -1
View File
@@ -55,7 +55,9 @@ func checkCastSyntax(ctx *cli.Context) {
if len(ctx.Args()) < 2 || ctx.Args().First() == "help" {
cli.ShowCommandHelpAndExit(ctx, "cast", 1) // last argument is exit code.
}
if !isMcConfigExists() {
console.Fatalf("Please run \"mc config generate\". %s\n", errNotConfigured{})
}
// extract URLs.
URLs, err := args2URLs(ctx.Args())
if err != nil {
+4 -1
View File
@@ -62,10 +62,13 @@ func runConfigCmd(ctx *cli.Context) {
if !ctx.Args().Present() || ctx.Args().First() == "help" {
cli.ShowCommandHelpAndExit(ctx, "config", 1) // last argument is exit code
}
if strings.TrimSpace(ctx.Args().First()) == "" {
cli.ShowCommandHelpAndExit(ctx, "config", 1) // last argument is exit code
}
arg := ctx.Args().First()
tailArgs := ctx.Args().Tail()
if len(tailArgs) > 2 {
console.Fatalf("Incorrect number of arguments, please use \"mc config help\". %s", errInvalidArgument{})
console.Fatalf("Incorrect number of arguments, please read \"mc config help\". %s", errInvalidArgument{})
}
msg, err := doConfig(arg, tailArgs)
if err != nil {
+3 -1
View File
@@ -60,7 +60,9 @@ func checkCopySyntax(ctx *cli.Context) {
if len(ctx.Args()) < 2 || ctx.Args().First() == "help" {
cli.ShowCommandHelpAndExit(ctx, "cp", 1) // last argument is exit code.
}
if !isMcConfigExists() {
console.Fatalf("Please run \"mc config generate\". %s\n", errNotConfigured{})
}
// extract URLs.
URLs, err := args2URLs(ctx.Args())
if err != nil {