SatisfactoryPlusCalculator/factorygame/helper.py
Ben 91a0edda5b
Add first visualisation revision
Caveats:
UI hangs while selecting recipes
No calculation is done based on input resource flow
2024-01-30 01:32:04 +01:00

14 lines
327 B
Python

import click
def prompt(options: dict[int, str], **kwargs) -> int | None:
for idx, label in options.items():
if label:
click.echo(f"{idx}: {label}")
ret = click.prompt(**kwargs)
ret = int(ret)
if ret not in options:
click.echo("Invalid choice.")
return None
return ret