Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions comfy_cli/command/models/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import os
import pathlib
import sys
from typing import Annotated, Optional
from typing import Annotated, List, Optional
from urllib.parse import parse_qs, unquote, urlparse

import requests
Expand Down Expand Up @@ -339,7 +339,7 @@ def remove(
help="The relative path from the current workspace where the models are stored.",
show_default=True,
),
model_names: Optional[list[str]] = typer.Option(
model_names: Optional[List[str]] = typer.Option(
None,
help="List of model filenames to delete, separated by spaces",
show_default=False,
Expand Down Expand Up @@ -394,6 +394,11 @@ def remove(
typer.echo("Deletion canceled.")


def list_models(path: pathlib.Path) -> list:

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No functional change here, but if we were to redefine the built-in list, we'll need to make sure that any possible references to list should happen before the def list() function.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No functional change here, but if we were to redefine the built-in list, we'll need to make sure that any possible references to list should happen before the def list() function.

Addressed separately in #330.

"""List all models in the specified directory."""
return [file for file in path.iterdir() if file.is_file()]


@app.command()
@tracking.track_command("model")
def list(
Expand All @@ -416,8 +421,3 @@ def list(
data = [(model.name, f"{model.stat().st_size // 1024} KB") for model in models]
column_names = ["Model Name", "Size"]
ui.display_table(data, column_names)


def list_models(path: pathlib.Path) -> list:
"""List all models in the specified directory."""
return [file for file in path.iterdir() if file.is_file()]