From a44a057caeb8b24e5e19a336505253c6519d46b4 Mon Sep 17 00:00:00 2001 From: 7000pctAUTO Date: Sun, 1 Feb 2026 06:52:49 +0000 Subject: [PATCH] Initial upload: DevDash CLI with TUI dashboard --- src/config/config_manager.py | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 src/config/config_manager.py diff --git a/src/config/config_manager.py b/src/config/config_manager.py new file mode 100644 index 0000000..fc98d41 --- /dev/null +++ b/src/config/config_manager.py @@ -0,0 +1,26 @@ +import json +import os +from pathlib import Path +from src.config.settings import Settings + + +class ConfigManager: + def __init__(self, config_path: str = None): + if config_path is None: + config_path = os.environ.get( + "DEVDASH_CONFIG", + str(Path.home() / ".devdash" / "config.json") + ) + self.config_path = Path(config_path) + + def load_config(self) -> Settings: + if self.config_path.exists(): + with open(self.config_path) as f: + data = json.load(f) + return Settings(**data) + return Settings() + + def save_config(self, settings: Settings) -> None: + self.config_path.parent.mkdir(parents=True, exist_ok=True) + with open(self.config_path, "w") as f: + json.dump(settings.model_dump(), f, indent=2)