From 68feff92e9d383037f9fe8df66997ef342e2365f Mon Sep 17 00:00:00 2001 From: Paul Date: Tue, 20 Feb 2024 22:22:51 -0700 Subject: [PATCH] ask user if they are ok with proceeding and deleting (#27) --- pkg/actions/reset.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/pkg/actions/reset.go b/pkg/actions/reset.go index e9b348e..3be0227 100644 --- a/pkg/actions/reset.go +++ b/pkg/actions/reset.go @@ -61,7 +61,15 @@ func Reset(c *cli.Context) error { return err } if resp.StatusCode != http.StatusOK { - return fmt.Errorf("unexpected status code: %d", resp.StatusCode) + fmt.Printf("unexpected status code when attempting to delete machine from endpoint: %d\n Continue with deletion? (y/n): ", resp.StatusCode) + scanner := bufio.NewScanner(os.Stdin) + var answer string + if err := utils.ReadLineFromStdin(scanner, &answer); err != nil { + return err + } + if answer != "y" { + return fmt.Errorf("unexpected status code: %d", resp.StatusCode) + } } user, err := user.Current() if err != nil {