From 287c3296c064d40deaec4a57469e05d7b14e792b Mon Sep 17 00:00:00 2001 From: eberlep Date: Wed, 13 Sep 2023 13:58:57 +0200 Subject: [PATCH] Honour the --yes-i-really-mean-it flag when deleting database backups (#256) Co-authored-by: Gerrit --- cmd/postgres.go | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/cmd/postgres.go b/cmd/postgres.go index 9cdb9dd2..ace19a90 100644 --- a/cmd/postgres.go +++ b/cmd/postgres.go @@ -985,17 +985,19 @@ func (c *config) postgresBackupDelete(args []string) error { return err } - idParts := strings.Split(id, "-") - firstPartOfID := idParts[0] - lastPartOfID := idParts[len(idParts)-1] - fmt.Println("Please answer some security questions to delete this postgres database backup") - err = helper.Prompt("first part of ID:", firstPartOfID) - if err != nil { - return err - } - err = helper.Prompt("last part of ID:", lastPartOfID) - if err != nil { - return err + if !viper.GetBool("yes-i-really-mean-it") { + idParts := strings.Split(id, "-") + firstPartOfID := idParts[0] + lastPartOfID := idParts[len(idParts)-1] + fmt.Println("Please answer some security questions to delete this postgres database backup") + err = helper.Prompt("first part of ID:", firstPartOfID) + if err != nil { + return err + } + err = helper.Prompt("last part of ID:", lastPartOfID) + if err != nil { + return err + } } request := database.NewDeletePostgresBackupConfigParams().WithID(id)