Load configuration from TOML file. Args: config_path: Path to TOML config file. If None, searches for .unity-cli.toml in current directory or Unity project root. Returns: UnityCLIConfig instance with loaded or default values.
(cls, config_path: Path | None = None)
| 68 | |
| 69 | @classmethod |
| 70 | def load(cls, config_path: Path | None = None) -> Self: |
| 71 | """Load configuration from TOML file. |
| 72 | |
| 73 | Args: |
| 74 | config_path: Path to TOML config file. If None, searches for |
| 75 | .unity-cli.toml in current directory or Unity project root. |
| 76 | |
| 77 | Returns: |
| 78 | UnityCLIConfig instance with loaded or default values. |
| 79 | """ |
| 80 | toml_path = config_path if config_path and config_path.exists() else cls._find_config_file() |
| 81 | |
| 82 | if toml_path: |
| 83 | try: |
| 84 | with open(toml_path, "rb") as f: |
| 85 | data = tomllib.load(f) |
| 86 | return cls.model_validate(data) |
| 87 | except (tomllib.TOMLDecodeError, OSError): |
| 88 | pass |
| 89 | |
| 90 | return cls() |
| 91 | |
| 92 | @classmethod |
| 93 | def _find_config_file(cls) -> Path | None: |
nothing calls this directly
no test coverage detected