Skip to content

Commit ab42efc

Browse files
committed
Restored.
1 parent 234550f commit ab42efc

2 files changed

Lines changed: 16 additions & 20 deletions

File tree

comfy_cli/cmdline.py

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
from comfy_cli.standalone import StandalonePython
2323
from comfy_cli.update import check_for_updates
2424
from comfy_cli.uv import DependencyCompiler
25-
from comfy_cli.validators import MutuallyExclusiveValidator
2625
from comfy_cli.workspace_manager import WorkspaceManager, check_comfy_repo
2726

2827
logging.setup_logging()
@@ -36,6 +35,22 @@ def main():
3635
app()
3736

3837

38+
class MutuallyExclusiveValidator:
39+
def __init__(self):
40+
self.group = []
41+
42+
def reset_for_testing(self):
43+
self.group.clear()
44+
45+
def validate(self, _ctx: typer.Context, param: typer.CallbackParam, value: str):
46+
# Add cli option to group if it was called with a value
47+
if value is not None and param.name not in self.group:
48+
self.group.append(param.name)
49+
if len(self.group) > 1:
50+
raise typer.BadParameter(f"option `{param.name}` is mutually exclusive with option `{self.group.pop()}`")
51+
return value
52+
53+
3954
g_exclusivity = MutuallyExclusiveValidator()
4055
g_gpu_exclusivity = MutuallyExclusiveValidator()
4156

comfy_cli/validators.py

Lines changed: 0 additions & 19 deletions
This file was deleted.

0 commit comments

Comments
 (0)