Skip to content

Commit

Permalink
Update storage.py
Browse files Browse the repository at this point in the history
  • Loading branch information
hackergandhi authored Aug 17, 2024
1 parent efb3557 commit 795cbff
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions main/storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.")

0 comments on commit 795cbff

Please sign in to comment.