Commit 792c364a authored by Benjamin REED's avatar Benjamin REED

added rename command

parent 245788f3
......@@ -20,6 +20,7 @@ USAGES = {
"undo": "undo - undoes the latest deletion/modification",
"history": "history - prints all the deleted passwords",
"cfg": "config [ <param=newparam> ] - configures the current program state or lists it when run without arguments. Example: 'config hints=False'",
"rename": "rename <label> <newlabel> - renames a password",
}
DEFAULT_KEYGEN_ITERATIONS = 100_000
LOWERCASE_ALPHABET = set([chr(e) for e in range(ord('a'), ord('a') + 25)])
......@@ -323,6 +324,17 @@ def main():
print(f"Restored {og_label}")
else:
print(f"Label '{og_label}' could not be found in deleted or overwritten passwords")
elif command == "rename" or command == "rn":
if len(args) < 3:
print(f"Too few args for {command}. Usage: {USAGES['rename']}.")
continue
if args[1] in state.passwords:
state.passwords[args[2]] = state.passwords[args[1]]
del state.passwords[args[1]]
print(f"{args[1]} -> {args[2]}")
else:
print(f"{args[1]} is not a known password label")
elif command == "history" or command == "his" or command == "undolist":
print("Deleted:")
for remd in state.to_remove:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment