MCPcopy Create free account
hub / github.com/bigdra50/unity-cli / load

Method load

unity_cli/config.py:70–90  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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:

Callers

nothing calls this directly

Calls 1

_find_config_fileMethod · 0.80

Tested by

no test coverage detected