From 7bac97dce01fea5901d032982daefbb275a0ae6c Mon Sep 17 00:00:00 2001 From: "Dr.Lt.Data" Date: Thu, 25 Apr 2024 23:13:03 +0900 Subject: [PATCH] enhance: cm-cli - restore-snapshot - arbitrary file path is available - show - show unregistered custom nodes --- cm-cli.py | 41 +++++++++++++++++++++++++++++++++++++---- glob/manager_core.py | 2 +- 2 files changed, 38 insertions(+), 5 deletions(-) diff --git a/cm-cli.py b/cm-cli.py index 1e43180..dbb799a 100644 --- a/cm-cli.py +++ b/cm-cli.py @@ -108,10 +108,11 @@ def restore_dependencies(): def restore_snapshot(snapshot_name): global processed_install - snapshot_path = os.path.join(core.comfyui_manager_path, 'snapshots', snapshot_name) - if not os.path.exists(snapshot_path): - print(f"ERROR: `{snapshot_path}` is not exists.") - exit(-1) + if not os.path.exists(snapshot_name): + snapshot_path = os.path.join(core.comfyui_manager_path, 'snapshots', snapshot_name) + if not os.path.exists(snapshot_path): + print(f"ERROR: `{snapshot_path}` is not exists.") + exit(-1) try: cloned_repos = [] @@ -420,6 +421,38 @@ def show_list(kind, simple=False): else: print(f"{prefix} {k:50}(author: {v['author']})") + # unregistered nodes + candidates = os.listdir(os.path.realpath(custom_nodes_path)) + + for k in candidates: + fullpath = os.path.join(custom_nodes_path, k) + + if os.path.isfile(fullpath): + continue + + if k in ['__pycache__']: + continue + + states = set() + if k.endswith('.disabled'): + prefix = '[ DISABLED ] ' + states.add('installed') + states.add('disabled') + states.add('all') + k = k[:-9] + else: + prefix = '[ ENABLED ] ' + states.add('installed') + states.add('enabled') + states.add('all') + + if k not in custom_node_map: + if kind in states: + if simple: + print(f"{k:50}") + else: + print(f"{prefix} {k:50}(author: N/A)") + def show_snapshot(simple_mode=False): json_obj = core.get_current_snapshot() diff --git a/glob/manager_core.py b/glob/manager_core.py index 7a6ee4f..5c5cc4b 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, 22, 4] +version = [2, 23] 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__), '..'))