Обновление структуры проекта, использование pydantic для конфигураций, улучшение отчёта о патчах
Build mod / build (push) Successful in 6m39s

This commit is contained in:
2025-10-01 23:07:37 +03:00
parent 5ba590cc31
commit fbc8b3e017
25 changed files with 406 additions and 315 deletions
+30
View File
@@ -0,0 +1,30 @@
from pydantic import BaseModel, Field, ValidationError
from rich.console import Console
from typing import Dict, Any
from pathlib import Path
import typer
class ToolsConfig(BaseModel):
apktool_jar_url: str
apktool_wrapper_url: str
class Config(BaseModel):
tools: ToolsConfig
base: Dict[str, Any]
class PatchConfig(BaseModel):
enabled: bool = Field(True, description="Включить или отключить патч")
def load_config(console: Console) -> Config:
try:
return Config.model_validate_json(Path("config.json").read_text())
except FileNotFoundError:
console.print("[red]Файл config.json не найден")
raise typer.Exit(1)
except ValidationError as e:
console.print("[red]Ошибка валидации config.json:", e)
raise typer.Exit(1)