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 29, 2024
1 parent 3f32291 commit 6d15023
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions openage/convert/service/init/modpack_search.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2023-2023 the openage authors. See copying.md for legal info.
# Copyright 2023-2024 the openage authors. See copying.md for legal info.

"""
Search for and enumerate openage modpacks.
Expand Down 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 6d15023

Please sign in to comment.