Verify if mc config exists for cp and cast commands
This commit is contained in:
+3
-1
@@ -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
@@ -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 {
|
||||
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user