add a while loop to the menu function

This way the script will keep running after a selection in the menu.
This commit is contained in:
Andreas 2016-11-14 18:08:19 +01:00
parent 7b2caf78f6
commit 78f2584787
1 changed files with 16 additions and 16 deletions

View File

@ -2,22 +2,22 @@
import os
import borg_variables
import sys
chosen_activity = 100
# Setting the environment variables
os.environ['BORG_REPO'] = str(borg_variables.repository)
os.environ['BORG_PASSPHRASE'] = str(borg_variables.password)
print("What would you like to do?")
# Start the chosen activity and go back to the activity selector.
print("1: List Backups, 2: Show archive details, 0: Exit")
try:
chosen_activity = int(input("Choose the desired activity:"))
if chosen_activity == 1:
os.system('borg list')
if chosen_activity == 2:
archive_name = input("Please enter the archive name ")
os.system('borg info ::' + archive_name)
elif chosen_activity == 0:
sys.exit()
except ValueError:
print("test")
while chosen_activity != 0:
print("What would you like to do?")
# Start the chosen activity and go back to the activity selector.
print("1: List Backups, 2: Show archive details, 0: Exit")
try:
chosen_activity = int(input("Choose the desired activity:"))
if chosen_activity == 1:
os.system('borg list')
if chosen_activity == 2:
archive_name = input("Please enter the archive name ")
os.system('borg info ::' + archive_name)
elif chosen_activity == 0:
print()
except ValueError:
print("test")