diff --git a/cm-cli.py b/cm-cli.py index 36077c0..7972e3f 100644 --- a/cm-cli.py +++ b/cm-cli.py @@ -6,7 +6,8 @@ import json import asyncio import subprocess -sys.path.append("./glob") +sys.path.append(os.path.dirname(__file__)) +sys.path.append(os.path.join(os.path.dirname(__file__), "glob")) import manager_core as core import cm_global import git @@ -14,6 +15,21 @@ import git print(f"\n-= ComfyUI-Manager CLI ({core.version_str}) =-\n") + +if not (len(sys.argv) == 2 and sys.argv[1] in ['save-snapshot', 'restore-dependencies', 'clear']) and len(sys.argv) < 3: + print(f"\npython cm-cli.py [OPTIONS]\n\n" + f"OPTIONS:\n" + f" [install|uninstall|update|disable|enable|fix] node_name ... ?[--channel ] ?[--mode [remote|local|cache]]\n" + f" [update|disable|enable|fix] all ?[--channel ] ?[--mode [remote|local|cache]]\n" + f" [simple-show|show] [installed|enabled|not-installed|disabled|all|snapshot|snapshot-list] ?[--channel ] ?[--mode [remote|local|cache]]\n" + f" save-snapshot\n" + f" restore-snapshot \n" + f" cli-only-mode [enable|disable]\n" + f" restore-dependencies\n" + f" clear\n") + exit(-1) + + comfyui_manager_path = os.path.dirname(__file__) comfy_path = os.environ.get('COMFYUI_PATH') @@ -75,6 +91,19 @@ def post_install(url): print(f"ERROR: Restoring '{url}' is failed.") +def restore_dependencies(): + node_paths = [os.path.join(custom_nodes_path, name) for name in os.listdir(custom_nodes_path) + if os.path.isdir(os.path.join(custom_nodes_path, name)) and not name.endswith('.disabled')] + + total = len(node_paths) + i = 1 + for x in node_paths: + print(f"----------------------------------------------------------------------------------------------------") + print(f"Restoring [{i}/{total}]: {x}") + post_install(x) + i += 1 + + def restore_snapshot(snapshot_name): global processed_install @@ -168,21 +197,6 @@ def read_downgrade_blacklist(): read_downgrade_blacklist() - -if not (len(sys.argv) == 2 and sys.argv[1] == 'save-snapshot') and len(sys.argv) < 3: - print(f"\npython cm-cli.py [OPTIONS]\n\n" - f"OPTIONS:\n" - f" [install|uninstall|update|disable|enable|fix] node_name ... ?[--channel ] ?[--mode [remote|local|cache]]\n" - f" [update|disable|enable|fix] all ?[--channel ] ?[--mode [remote|local|cache]]\n" - f" [simple-show|show] [installed|enabled|not-installed|disabled|all|snapshot|snapshot-list] ?[--channel ] ?[--mode [remote|local|cache]]\n" - f" save-snapshot\n" - f" restore-snapshot \n" - f" cli-only-mode [enable|disable]\n" - f" restore-dependencies -- NOT YET\n" - f" clear\n") - exit(-1) - - channel = 'default' mode = 'remote' nodes = set() @@ -458,7 +472,7 @@ elif op == 'restore-snapshot': restore_snapshot(sys.argv[2]) elif op == 'restore-dependencies': - print(f"TODO: NOT YET IMPLEMENTED") + restore_dependencies() elif op == 'clear': cancel() diff --git a/glob/manager_core.py b/glob/manager_core.py index 566e687..18395ad 100644 --- a/glob/manager_core.py +++ b/glob/manager_core.py @@ -21,7 +21,7 @@ sys.path.append(glob_path) import cm_global from manager_util import * -version = [2, 20, 2] +version = [2, 21, 1] version_str = f"V{version[0]}.{version[1]}" + (f'.{version[2]}' if len(version) > 2 else '') comfyui_manager_path = os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))