Add confirmation before deleting a project or a sdk.
[src/xds/xds-cli.git] / cmd-projects.go
index 6e7241a..713e3f8 100644 (file)
@@ -92,6 +92,10 @@ func initCmdProjects(cmdDef *[]cli.Command) {
                                                Usage:  "project id",
                                                EnvVar: "XDS_PROJECT_ID",
                                        },
+                                       cli.BoolFlag{
+                                               Name:  "force, f",
+                                               Usage: "remove confirmation prompt before removal",
+                                       },
                                },
                        },
                        {
@@ -209,6 +213,12 @@ func projectsRemove(ctx *cli.Context) error {
                return cli.NewExitError("id parameter or option must be set", 1)
        }
 
+       if !ctx.Bool("force") {
+               if !Confirm("Do you permanently remove project id '" + id + "' [yes/No] ? ") {
+                       return nil
+               }
+       }
+
        if err := HTTPCli.Delete("/projects/"+id, &res); err != nil {
                return cli.NewExitError(err, 1)
        }