Skip to content
Merged
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
52 changes: 18 additions & 34 deletions comfy_cli/command/custom_nodes/command.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import subprocess
import sys
import uuid
from enum import Enum
from typing import Annotated, Optional

import typer
Expand Down Expand Up @@ -36,6 +37,17 @@
registry_api = RegistryAPI()


# Enum for show command target
class ShowTarget(str, Enum):
INSTALLED = "installed"
ENABLED = "enabled"
NOT_INSTALLED = "not-installed"
DISABLED = "disabled"
ALL = "all"
SNAPSHOT = "snapshot"
SNAPSHOT_LIST = "snapshot-list"


def validate_comfyui_manager(_env_checker):
manager_path = _env_checker.get_comfyui_manager_path()

Expand Down Expand Up @@ -304,9 +316,8 @@ def validate_mode(mode):
@app.command(help="Show node list")
@tracking.track_command("node")
def show(
arg: str = typer.Argument(
help="[installed|enabled|not-installed|disabled|all|snapshot|snapshot-list]",
autocompletion=show_completer,
arg: ShowTarget = typer.Argument(
help="Target to display",
),
channel: Annotated[
Optional[str],
Expand All @@ -322,30 +333,16 @@ def show(
autocompletion=mode_completer,
),
):
valid_commands = [
"installed",
"enabled",
"not-installed",
"disabled",
"all",
"snapshot",
"snapshot-list",
]
if arg not in valid_commands:
typer.echo(f"Invalid command: `show {arg}`", err=True)
raise typer.Exit(code=1)

validate_mode(mode)

execute_cm_cli(["show", arg], channel=channel, mode=mode)
execute_cm_cli(["show", arg.value], channel=channel, mode=mode)


@app.command("simple-show", help="Show node list (simple mode)")
@tracking.track_command("node")
def simple_show(
arg: str = typer.Argument(
help="[installed|enabled|not-installed|disabled|all|snapshot|snapshot-list]",
autocompletion=show_completer,
arg: ShowTarget = typer.Argument(
help="Target to display",
),
channel: Annotated[
Optional[str],
Expand All @@ -361,22 +358,9 @@ def simple_show(
autocompletion=mode_completer,
),
):
valid_commands = [
"installed",
"enabled",
"not-installed",
"disabled",
"all",
"snapshot",
"snapshot-list",
]
if arg not in valid_commands:
typer.echo(f"Invalid command: `show {arg}`", err=True)
raise typer.Exit(code=1)

validate_mode(mode)

execute_cm_cli(["simple-show", arg], channel=channel, mode=mode)
execute_cm_cli(["simple-show", arg.value], channel=channel, mode=mode)


# install, reinstall, uninstall
Expand Down