Skip to content

Commit

Permalink
main: Make modpack selection more reliable.
Browse files Browse the repository at this point in the history
  • Loading branch information
heinezen committed Jul 28, 2024
1 parent c7839d2 commit f02be6a
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions openage/convert/service/init/modpack_search.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,17 +86,21 @@ def query_modpack(proposals: set[str]) -> str:
Query interactively for a modpack from a selection of proposals.
"""
print("\nPlease select a modpack before starting.")
print("Insert the index of one of the proposals (Default = 0):")
print("Enter the index of one of the proposals (Default = 0):")

proposals = sorted(proposals)
for index, proposal in enumerate(proposals):
print(f"({index}) {proposal}")

user_selection = input("> ")
if user_selection.isdecimal() and int(user_selection) < len(proposals):
selection = proposals[int(user_selection)]
if user_selection == "":
selection = proposals[0]

else:
selection = proposals[0]
while not (user_selection.isdecimal() and int(user_selection) < len(proposals)):
print(f"'{user_selection}' is not a valid index. Please try again.")
user_selection = input("> ")

selection = proposals[int(user_selection)]

return selection

0 comments on commit f02be6a

Please sign in to comment.