From fadf4ab0a3f013adb9857b5117b44c535234a008 Mon Sep 17 00:00:00 2001 From: Steven Guiheux Date: Fri, 24 Feb 2023 12:07:11 +0100 Subject: [PATCH] fix: do not ask service question if there is no service name --- cli/cdsctl/consumer.go | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/cli/cdsctl/consumer.go b/cli/cdsctl/consumer.go index 8d6c6641e2..94b7b4b282 100644 --- a/cli/cdsctl/consumer.go +++ b/cli/cdsctl/consumer.go @@ -185,18 +185,21 @@ func authConsumerNewRun(v cli.Values) error { } var svcType = v.GetString("service-type") - if svcType == "" && !v.GetBool("no-interactive") { - svcType = cli.AskValue("Service type") - } - var svcRegion = v.GetString("service-region") - if svcRegion == "" && !v.GetBool("no-interactive") { - svcRegion = cli.AskValue("Service region") - } - var svcIgnoreJobWithNoRegion = v.GetBool("service-ignore-job-with-no-region") - if !svcIgnoreJobWithNoRegion && !v.GetBool("no-interactive") { - svcIgnoreJobWithNoRegion = cli.AskConfirm("Service ignore job with no region") + + if svcName != "" { + if svcType == "" && !v.GetBool("no-interactive") { + svcType = cli.AskValue("Service type") + } + + if svcRegion == "" && !v.GetBool("no-interactive") { + svcRegion = cli.AskValue("Service region") + } + + if !svcIgnoreJobWithNoRegion && !v.GetBool("no-interactive") { + svcIgnoreJobWithNoRegion = cli.AskConfirm("Service ignore job with no region") + } } var consumer = sdk.AuthUserConsumer{