From 341d79ec73044d3515876f2e2bca8bd5eb08b485 Mon Sep 17 00:00:00 2001 From: Benjamin Pujol Date: Fri, 2 Aug 2024 14:51:48 +0200 Subject: [PATCH] feat: Validate Config Existence in config rm Enhanced the config rm command to check if the specified configuration exists before attempting to remove it. Modified the deleteCmd function in config/cli.go to include a call to validateServerExistence, ensuring the configuration is present. If the configuration does not exist, the command now returns an error, preventing further execution and improving user feedback. This change addresses user concerns about the lack of feedback when removing non-existent configurations, providing a clearer and more robust user experience. Signed-off-by: Benjamin Pujol --- config/cli.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/config/cli.go b/config/cli.go index b55d5dadc..fe6545eca 100644 --- a/config/cli.go +++ b/config/cli.go @@ -163,6 +163,12 @@ func deleteCmd(c *cli.Context) error { // Delete single configuration serverId := c.Args()[0] + + // Check if the configuration exists + if err := validateServerExistence(serverId, editOperation); err != nil { + return err + } + if !quiet && !coreutils.AskYesNo("Are you sure you want to delete \""+serverId+"\" configuration?", false) { return nil }