fixed: cm-cli.py - save-snapshot: use default path if --output is not given

https://github.com/Comfy-Org/comfy-cli/issues/254#issuecomment-2758584763
This commit is contained in:
Dr.Lt.Data 2025-03-28 12:49:09 +09:00
parent fb9c68fc32
commit 908a1009d2
3 changed files with 11 additions and 13 deletions

View File

@ -1047,18 +1047,16 @@ def save_snapshot(
): ):
cmd_ctx.set_user_directory(user_directory) cmd_ctx.set_user_directory(user_directory)
if output is None: if output is not None:
print("[bold red]ERROR: missing output path[/bold red]") if(not output.endswith('.json') and not output.endswith('.yaml')):
raise typer.Exit(code=1) print("[bold red]ERROR: output path should be either '.json' or '.yaml' file.[/bold red]")
raise typer.Exit(code=1)
if(not output.endswith('.json') and not output.endswith('.yaml')): dir_path = os.path.dirname(output)
print("[bold red]ERROR: output path should be either '.json' or '.yaml' file.[/bold red]")
raise typer.Exit(code=1)
dir_path = os.path.dirname(output) if(dir_path != '' and not os.path.exists(dir_path)):
if(dir_path != '' and not os.path.exists(dir_path)): print(f"[bold red]ERROR: {output} path not exists.[/bold red]")
print(f"[bold red]ERROR: {output} path not exists.[/bold red]") raise typer.Exit(code=1)
raise typer.Exit(code=1)
path = asyncio.run(core.save_snapshot_with_postfix('snapshot', output, not full_snapshot)) path = asyncio.run(core.save_snapshot_with_postfix('snapshot', output, not full_snapshot))
print(f"Current snapshot is saved as `{path}`") print(f"Current snapshot is saved as `{path}`")

View File

@ -43,7 +43,7 @@ import manager_downloader
from node_package import InstalledNodePackage from node_package import InstalledNodePackage
version_code = [3, 31, 8] version_code = [3, 31, 9]
version_str = f"V{version_code[0]}.{version_code[1]}" + (f'.{version_code[2]}' if len(version_code) > 2 else '') version_str = f"V{version_code[0]}.{version_code[1]}" + (f'.{version_code[2]}' if len(version_code) > 2 else '')

View File

@ -1,7 +1,7 @@
[project] [project]
name = "comfyui-manager" name = "comfyui-manager"
description = "ComfyUI-Manager provides features to install and manage custom nodes for ComfyUI, as well as various functionalities to assist with ComfyUI." description = "ComfyUI-Manager provides features to install and manage custom nodes for ComfyUI, as well as various functionalities to assist with ComfyUI."
version = "3.31.8" version = "3.31.9"
license = { file = "LICENSE.txt" } license = { file = "LICENSE.txt" }
dependencies = ["GitPython", "PyGithub", "matrix-client==0.4.0", "transformers", "huggingface-hub>0.20", "typer", "rich", "typing-extensions", "toml", "uv", "chardet"] dependencies = ["GitPython", "PyGithub", "matrix-client==0.4.0", "transformers", "huggingface-hub>0.20", "typer", "rich", "typing-extensions", "toml", "uv", "chardet"]