From 795cbffb81673a1d5bd0f4876c63f6ac22a4b21e Mon Sep 17 00:00:00 2001 From: Gandhi <142811767+gandhibhai@users.noreply.github.com> Date: Sat, 17 Aug 2024 16:53:18 +0530 Subject: [PATCH] Update storage.py --- main/storage.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/main/storage.py b/main/storage.py index 95836e1..2343a4f 100644 --- a/main/storage.py +++ b/main/storage.py @@ -25,3 +25,15 @@ def load_passwords() -> dict: # Handle case where the JSON file is corrupted or empty print(f"{Fore.RED}🚨 Error: Corrupted or empty passwords file.") return {} + +def delete_service(service: str): + """ + Deletes a specific service from the passwords file. + """ + passwords = load_passwords() + if service in passwords: + del passwords[service] + save_passwords(passwords) + print(f"{Fore.GREEN}✅ {service} has been removed successfully.") + else: + print(f"{Fore.RED}🚨 No such service found.")