Wargame_campaign_app/cli/app.py

39 lines
812 B
Python
Raw Permalink Normal View History

2025-12-19 12:18:35 +01:00
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']})"
)