from concurrent.futures import Future import click def click_prompt(options: dict[int, str], text: str, default: int) -> Future[int | None]: for idx, label in options.items(): if label: click.echo(f"{idx}: {label}") user_choice = click.prompt(text=text, default=default) user_choice = int(user_choice) ret = Future() if user_choice not in options: click.echo("Invalid choice.") ret.set_result(None) else: ret.set_result(user_choice) return ret