Skip to content

Commit 5b51ea3

Browse files
committed
prompt for confirmation before deleting templates (#2830)
1 parent 4f1e9da commit 5b51ea3

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

cli/templatedelete.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package cli
22

33
import (
44
"fmt"
5+
"strings"
56

67
"github.com/spf13/cobra"
78
"golang.org/x/xerrors"
@@ -70,6 +71,16 @@ func templateDelete() *cobra.Command {
7071
templates = append(templates, template)
7172
}
7273

74+
// Confirm deletion of the template.
75+
_, err = cliui.Prompt(cmd, cliui.PromptOptions{
76+
Text: fmt.Sprintf("Delete these templates: %s?", cliui.Styles.Code.Render(strings.Join(templateNames, ", "))),
77+
IsConfirm: true,
78+
Default: "no",
79+
})
80+
if err != nil {
81+
return err
82+
}
83+
7384
for _, template := range templates {
7485
err := client.DeleteTemplate(ctx, template.ID)
7586
if err != nil {

0 commit comments

Comments
 (0)