(prompt: str, items: List[str])
| 1422 | # Menu helpers |
| 1423 | # ---------------------------- |
| 1424 | def pick_from_list(prompt: str, items: List[str]) -> Optional[str]: |
| 1425 | if not items: |
| 1426 | return None |
| 1427 | for i, d in enumerate(items, 1): |
| 1428 | print(f" {i}) {d}") |
| 1429 | try: |
| 1430 | idx = int(input("\n" + prompt).strip()) |
| 1431 | if 1 <= idx <= len(items): |
| 1432 | return items[idx - 1] |
| 1433 | return None |
| 1434 | except Exception: |
| 1435 | return None |
| 1436 | |
| 1437 | # ---------------------------- |
| 1438 | # Actions |
no test coverage detected