Add confirmation before deleting a project or a sdk.
[src/xds/xds-cli.git] / cmd-sdks.go
index e140856..f34d8b1 100644 (file)
@@ -102,6 +102,10 @@ func initCmdSdks(cmdDef *[]cli.Command) {
                                                Usage:  "sdk id to un-install",
                                                EnvVar: "XDS_SDK_ID",
                                        },
+                                       cli.BoolFlag{
+                                               Name:  "force, f",
+                                               Usage: "remove confirmation prompt before removal",
+                                       },
                                },
                        },
                        {
@@ -289,6 +293,12 @@ func sdksUnInstall(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 SDK id '" + id + "' [yes/No] ? ") {
+                       return nil
+               }
+       }
+
        delSdk := xaapiv1.SDK{}
        url := XdsServerComputeURL("/sdks/" + id)
        if err := HTTPCli.Delete(url, &delSdk); err != nil {