added while loop for top level config menu, updated delete question to standard we are using
This commit is contained in:
@@ -113,11 +113,12 @@ if __name__ == "__main__":
|
|||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
else:
|
else:
|
||||||
print("This value must be one of the following characters: n, q.")
|
print("This value must be one of the following characters: n, q.")
|
||||||
|
while True:
|
||||||
config = configparser.ConfigParser()
|
config = configparser.ConfigParser()
|
||||||
config.read(secrets_ini_file)
|
config.read(secrets_ini_file)
|
||||||
accounts = config.sections()
|
accounts = config.sections()
|
||||||
print("Current Bitwarden accounts:")
|
print("Current Bitwarden accounts:")
|
||||||
|
print(" ")
|
||||||
for account in accounts:
|
for account in accounts:
|
||||||
print(account)
|
print(account)
|
||||||
print(" ")
|
print(" ")
|
||||||
@@ -128,7 +129,7 @@ if __name__ == "__main__":
|
|||||||
while True:
|
while True:
|
||||||
user_input = input("e/n/d/q> ")
|
user_input = input("e/n/d/q> ")
|
||||||
if user_input.casefold() == "e":
|
if user_input.casefold() == "e":
|
||||||
print("")
|
account_section_to_edit = select_account(accounts)
|
||||||
elif user_input.casefold() == "n":
|
elif user_input.casefold() == "n":
|
||||||
account_details = ask_for_account_details()
|
account_details = ask_for_account_details()
|
||||||
config.add_section(account_details["account_email_address"])
|
config.add_section(account_details["account_email_address"])
|
||||||
@@ -140,7 +141,8 @@ if __name__ == "__main__":
|
|||||||
break
|
break
|
||||||
elif user_input.casefold() == "d":
|
elif user_input.casefold() == "d":
|
||||||
account_section_to_delete = select_account(accounts, "delete")
|
account_section_to_delete = select_account(accounts, "delete")
|
||||||
confirmation = input("Are you sure you wish to delete {} account?".format(account_section_to_delete))
|
print("Are you sure you wish to delete {} account? ".format(account_section_to_delete))
|
||||||
|
confirmation = input("y/n> ")
|
||||||
if not confirmation.casefold() in ["y","yes"]:
|
if not confirmation.casefold() in ["y","yes"]:
|
||||||
break
|
break
|
||||||
config.remove_section(account_section_to_delete)
|
config.remove_section(account_section_to_delete)
|
||||||
|
|||||||
Reference in New Issue
Block a user