feat: add gui config for cli command

This commit is contained in:
Benjamin Labrecque
2026-07-28 15:02:19 +02:00
parent e39663cd80
commit f76e14925d
4 changed files with 51 additions and 17 deletions
+30
View File
@@ -0,0 +1,30 @@
from typing import Optional
from pydantic import BaseModel, model_validator
from core.enums import GuiOption
class GuiConfig(BaseModel):
gui_option: GuiOption
raw_ui_filename: Optional[str] = None
def should_create_ui(self):
return self.gui_option == GuiOption.NEW
@property
def ui_filename(self) -> str:
if self.raw_ui_filename is None:
raise ValueError("ui_filename is None")
return self.raw_ui_filename
@model_validator(mode="after")
def validate_dependent_options(self):
if self.gui_option == GuiOption.EXISTING and self.raw_ui_filename is None:
raise ValueError("--ui-filename is required when --gui-option is 'existing'.")
if self.gui_option == GuiOption.NONE and self.raw_ui_filename:
raise ValueError("Cannot specify --ui-filename when --gui-option is 'none'.")
return self