Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 664ea38

Browse files
committed
Add confirm prompt to delete workspace
1 parent a44b1fc commit 664ea38

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

cli/delete.go

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,21 @@ import (
1212

1313
// nolint
1414
func delete() *cobra.Command {
15-
return &cobra.Command{
15+
cmd := &cobra.Command{
1616
Annotations: workspaceCommand,
1717
Use: "delete <workspace>",
1818
Short: "Delete a workspace",
1919
Aliases: []string{"rm"},
2020
Args: cobra.ExactArgs(1),
2121
RunE: func(cmd *cobra.Command, args []string) error {
22+
_, err := cliui.Prompt(cmd, cliui.PromptOptions{
23+
Text: "Confirm delete workspace?",
24+
IsConfirm: true,
25+
})
26+
if err != nil {
27+
return err
28+
}
29+
2230
client, err := createClient(cmd)
2331
if err != nil {
2432
return err
@@ -41,4 +49,6 @@ func delete() *cobra.Command {
4149
return cliui.WorkspaceBuild(cmd.Context(), cmd.OutOrStdout(), client, build.ID, before)
4250
},
4351
}
52+
cliui.AllowSkipPrompt(cmd)
53+
return cmd
4454
}

0 commit comments

Comments
 (0)