Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/update #18

Merged
merged 5 commits into from
May 3, 2024
Merged
Changes from 3 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
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)
ltdrdata marked this conversation as resolved.
Show resolved Hide resolved

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
Loading