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