menu tree mockup

This commit is contained in:
Maxime Réaux 2025-12-19 12:18:35 +01:00
parent 57543e139a
commit 02e7221149
7 changed files with 145 additions and 23 deletions

14
cli/utils.py Normal file
View file

@ -0,0 +1,14 @@
def choose_from_list(items, label_fn):
for i, item in enumerate(items, start=1):
print(f"{i}. {label_fn(item)}")
print("0. Back")
choice = input("> ").strip()
if choice == "0":
return None
try:
return items[int(choice) - 1]
except (ValueError, IndexError):
print("Invalid choice")
return None