Merge pull request #169 from PR0M3TH3AN/codex/new-task

Add notes prompt when editing entries
This commit is contained in:
thePR0M3TH3AN
2025-07-02 22:49:54 -04:00
committed by GitHub
2 changed files with 26 additions and 2 deletions

View File

@@ -801,6 +801,7 @@ class PasswordManager:
username = input("Enter the username (optional): ").strip() username = input("Enter the username (optional): ").strip()
url = input("Enter the URL (optional): ").strip() url = input("Enter the URL (optional): ").strip()
notes = input("Enter notes (optional): ").strip()
length_input = input( length_input = input(
f"Enter desired password length (default {DEFAULT_PASSWORD_LENGTH}): " f"Enter desired password length (default {DEFAULT_PASSWORD_LENGTH}): "
@@ -822,7 +823,12 @@ class PasswordManager:
# Add the entry to the index and get the assigned index # Add the entry to the index and get the assigned index
index = self.entry_manager.add_entry( index = self.entry_manager.add_entry(
website_name, length, username, url, blacklisted=False website_name,
length,
username,
url,
blacklisted=False,
notes=notes,
) )
# Mark database as dirty for background sync # Mark database as dirty for background sync
@@ -881,6 +887,10 @@ class PasswordManager:
username = entry.get("username") username = entry.get("username")
url = entry.get("url") url = entry.get("url")
blacklisted = entry.get("blacklisted") blacklisted = entry.get("blacklisted")
notes = entry.get("notes", "")
notes = entry.get("notes", "")
notes = entry.get("notes", "")
notes = entry.get("notes", "")
print( print(
colored( colored(
@@ -947,6 +957,7 @@ class PasswordManager:
username = entry.get("username") username = entry.get("username")
url = entry.get("url") url = entry.get("url")
blacklisted = entry.get("blacklisted") blacklisted = entry.get("blacklisted")
notes = entry.get("notes", "")
# Display current values # Display current values
print( print(
@@ -996,9 +1007,20 @@ class PasswordManager:
) )
new_blacklisted = blacklisted new_blacklisted = blacklisted
new_notes = (
input(
f'Enter new notes (leave blank to keep "{notes or "N/A"}"): '
).strip()
or notes
)
# Update the entry # Update the entry
self.entry_manager.modify_entry( self.entry_manager.modify_entry(
index, new_username, new_url, new_blacklisted index,
new_username,
new_url,
new_blacklisted,
new_notes,
) )
# Mark database as dirty for background sync # Mark database as dirty for background sync

View File

@@ -51,11 +51,13 @@ def test_manager_workflow(monkeypatch):
"", # username "", # username
"", # url "", # url
"", # length (default) "", # length (default)
"", # notes
"0", # retrieve index "0", # retrieve index
"0", # modify index "0", # modify index
"user", # new username "user", # new username
"", # new url "", # new url
"", # blacklist status "", # blacklist status
"", # new notes
] ]
) )
monkeypatch.setattr("builtins.input", lambda *args, **kwargs: next(inputs)) monkeypatch.setattr("builtins.input", lambda *args, **kwargs: next(inputs))