fix: warn on duplicate components in manifest

This commit is contained in:
2 * r + 2 * t
2026-06-17 23:17:24 +10:00
parent 0410fed68c
commit c09cd1a609
+4
View File
@@ -7,6 +7,8 @@ from pathlib import Path
from string import Template from string import Template
from typing import Any from typing import Any
from caelestia.utils.io import warn
_XDG_DEFAULTS = { _XDG_DEFAULTS = {
"XDG_CONFIG_HOME": str(Path.home() / ".config"), "XDG_CONFIG_HOME": str(Path.home() / ".config"),
"XDG_DATA_HOME": str(Path.home() / ".local/share"), "XDG_DATA_HOME": str(Path.home() / ".local/share"),
@@ -105,6 +107,8 @@ class Manifest:
components = {} components = {}
for comp in raw.get("components", []): for comp in raw.get("components", []):
parsed = _parse_component(comp) parsed = _parse_component(comp)
if parsed.name in components:
warn(f"duplicate component '{parsed.name}'; using the last definition")
components[parsed.name] = parsed components[parsed.name] = parsed
return Manifest( return Manifest(