def list_command(  # type: ignore
    cluster: str | None,
    search: str | None,
    labels: tuple[str, ...] | None,
    output: t.Literal["json", "yaml", "table"],
) -> None:
    """List existing deployments on BentoCloud."""
    if labels is not None:
        # For labels like ["env=prod", "team=infra"]
        # This will output: "label:env=prod label:team=infra"
        labels_query = " ".join(f"label:{label}" for label in labels)

    try:
        d_list = bentoml.deployment.list(cluster=cluster, search=search, q=labels_query)
    except BentoMLException as e:
        raise_deployment_config_error(e, "list")
    res: list[dict[str, t.Any]] = [d.to_dict() for d in d_list]
    if output == "table":
        table = Table(box=None, expand=True)
        table.add_column("Deployment", overflow="fold")
        table.add_column("created_at", overflow="fold")
        table.add_column("Bento", overflow="fold")
        table.add_column("Status", overflow="fold")
        table.add_column("Region", overflow="fold")
        for info in d_list:
            table.add_row(
                info.name,
                info.created_at,
                info.get_bento(refetch=False),
                info.get_status(refetch=False).status,
                info.cluster,
            )
        rich.print(table)
    elif output == "json":
        info = json.dumps(res, indent=2, default=str)
        rich.print_json(info)
    else:
        info = yaml.dump(res, indent=2, sort_keys=False)
        rich.print(Syntax(info, "yaml", background_color="default"))
List existing deployments on BentoCloud.
src/bentoml_cli/deployment.py