From 2b9f80e4af70da631c773f75737ebd44de305979 Mon Sep 17 00:00:00 2001 From: Clement Denoix Date: Fri, 15 Jul 2022 09:18:40 +0200 Subject: [PATCH] [DEX-94] fix(cmd) application remove - add check if app exists --- pkg/cmd/application/remove/remove.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/pkg/cmd/application/remove/remove.go b/pkg/cmd/application/remove/remove.go index 4bc8671c..ae30bfae 100644 --- a/pkg/cmd/application/remove/remove.go +++ b/pkg/cmd/application/remove/remove.go @@ -64,6 +64,11 @@ func NewRemoveCmd(f *cmdutil.Factory, runF func(*RemoveOptions) error) *cobra.Co // runRemoveCmd executes the remove command func runRemoveCmd(opts *RemoveOptions) error { + _, err := opts.config.Application.GetID() + if err != nil { + return fmt.Errorf("unable to find application %s", opts.config.Application.Name) + } + if opts.DoConfirm { var confirmed bool err := prompt.Confirm(fmt.Sprintf("Are you sure you want to remove the application %q?", opts.config.Application.Name), &confirmed) @@ -75,7 +80,7 @@ func runRemoveCmd(opts *RemoveOptions) error { } } - err := opts.config.Application.Remove() + err = opts.config.Application.Remove() if err != nil { return err }