Skip to content

Commit

Permalink
feat: comfy update [all|comfy] command
Browse files Browse the repository at this point in the history
  • Loading branch information
ltdrdata committed May 2, 2024
1 parent f88804e commit 8489169
Showing 1 changed file with 25 additions and 7 deletions.
32 changes: 25 additions & 7 deletions comfy_cli/cmdline.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,14 +133,31 @@ def install(
workspace_manager.set_recent_workspace(workspace_path)


def update(self):
@app.command(help="Stop background ComfyUI")
@tracking.track_command()
def update(
ctx: typer.Context,
target: str = typer.Argument("comfy", help="[all|comfy]")
):
if target not in ['all', 'comfy']:
typer.echo(
f"Invalid target: {target}. Allowed targets are 'all', 'comfy'.",
err=True,
)
raise typer.Exit(code=1)

_env_checker = EnvChecker()
print(f"Updating ComfyUI in {self.workspace}...")
os.chdir(self.workspace)
subprocess.run(["git", "pull"], check=True)
subprocess.run(
[sys.executable, "-m", "pip", "install", "-r", "requirements.txt"], check=True
)
comfy_path = workspace_manager.get_workspace_comfy_path(ctx)

if 'all' == target:
custom_nodes.command.execute_cm_cli(ctx, ['update', 'all'])
else:
print(f"Updating ComfyUI in {comfy_path}...")
os.chdir(comfy_path)
subprocess.run(["git", "pull"], check=True)
subprocess.run(
[sys.executable, "-m", "pip", "install", "-r", "requirements.txt"], check=True
)


# @app.command(help="Run workflow file")
Expand Down Expand Up @@ -236,6 +253,7 @@ def launch_comfyui(_env_checker, _config_manager, extra, background=False):


@app.command(help="Stop background ComfyUI")
@tracking.track_command()
def stop():
_config_manager = ConfigManager()

Expand Down

0 comments on commit 8489169

Please sign in to comment.