[V3 Launcher] Fix asking for cli flags after invalid instance selection (#1200)

This commit is contained in:
Tobotimus 2018-01-15 15:11:24 +11:00 committed by palmtree5
parent 980e8eeb3e
commit 4ac606b468

View File

@ -202,24 +202,24 @@ def instance_menu():
return None return None
counter = 0 counter = 0
print("Red instance menu\n") print("Red instance menu\n")
name_num_map = {} name_num_map = {}
for name in list(instances.keys()): for name in list(instances.keys()):
print("{}. {}\n".format(counter+1, name)) print("{}. {}\n".format(counter+1, name))
name_num_map[str(counter+1)] = name name_num_map[str(counter+1)] = name
counter += 1 counter += 1
selection = user_choice()
try: while True:
selection = int(selection) selection = user_choice()
except ValueError: try:
print("Invalid input! Try again.") selection = int(selection)
return None except ValueError:
else: print("Invalid input! Please enter a number corresponding to an instance.")
if selection not in list(range(1, counter+1)):
print("Invalid selection! Please try again")
return None
else: else:
return name_num_map[str(selection)] if selection not in list(range(1, counter+1)):
print("Invalid selection! Please try again")
else:
return name_num_map[str(selection)]
def clear_screen(): def clear_screen():