
@cli.command(name="list", help="List pending tasks")
@click.option("--all", "show_all", is_flag=True, help="List all tasks")
@db.setup()
async def list_tasks(show_all: bool) -> None:
    rows: list[tuple[str, str, str, str, str]] = [
        ("Task ID", "Name", "Arguments", "Run at", "Schedule ID")
    ]
    rows.extend(
        (str(task_id), name, str(arguments), run_at.isoformat(), str(from_schedule_id))
        for task_id, name, arguments, run_at, from_schedule_id in await get_tasks(
            show_all=show_all
        )