menu tree mockup
This commit is contained in:
parent
57543e139a
commit
02e7221149
7 changed files with 145 additions and 23 deletions
38
cli/app.py
Normal file
38
cli/app.py
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
from cli.war_menu import war_menu
|
||||
from cli.utils import choose_from_list
|
||||
|
||||
def app_menu(data):
|
||||
while True:
|
||||
print("\n=== Warmachron ===")
|
||||
print("1. Select war")
|
||||
print("2. Create war")
|
||||
print("3. Manage players")
|
||||
print("0. Exit")
|
||||
|
||||
choice = input("> ").strip()
|
||||
|
||||
if choice == "1":
|
||||
war = select_war(data)
|
||||
if war:
|
||||
war_menu(data, war)
|
||||
|
||||
elif choice == "2":
|
||||
create_war(data)
|
||||
|
||||
elif choice == "3":
|
||||
manage_players(data)
|
||||
|
||||
elif choice == "0":
|
||||
return
|
||||
|
||||
def select_war(data):
|
||||
wars = data["wars"]
|
||||
if not wars:
|
||||
print("No wars available.")
|
||||
return None
|
||||
|
||||
return choose_from_list(
|
||||
wars,
|
||||
lambda w: f"{w['name']} ({w['year']})"
|
||||
)
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue