Merge pull request #923 from harshavardhana/pr_out_verify_for_mc_config_exists_for_cp_and_cast_commands

Verify if mc config exists for cp and cast commands
This commit is contained in:
Harshavardhana
2015-07-24 05:50:03 +00:00
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 {