Добавлеие вывода информации о включеных патчах

This commit is contained in:
2025-09-18 10:54:30 +03:00
parent 41399eca2c
commit 85aef3d997
2 changed files with 40 additions and 2 deletions
+23 -1
View File
@@ -112,6 +112,28 @@ def init():
raise typer.Exit(1)
# ======================= INFO =========================
@app.command()
def info(patch_name: str = ""):
"""Вывод информации о патче"""
conf = load_config().model_dump()
if patch_name:
patch = Patch(patch_name, __import__(f"patcher.patches.{patch_name}"))
console.print(f"[green]Информация о патче {patch.name}:")
console.print(f" [yellow]Приоритет: {patch.priority}")
console.print(f" [yellow]Описание: {patch.module.__doc__}")
else:
console.print("[cyan]Список патчей:")
for f in PATCHES.glob("*.py"):
if f.name.startswith("todo_") or f.name == "__init__.py":
continue
name = f.stem
if conf['patches'].get(name,{}).get('enabled',True):
console.print(f" [yellow]{name}: [green]✔ enabled")
else:
console.print(f" [yellow]{name}: [red]✘ disabled")
# ======================= PATCHING =========================
class Patch:
def __init__(self, name: str, module):
@@ -232,7 +254,7 @@ def build(
continue
name = f.stem
settings = patch_settings.get(name, {})
if not settings.get("enable", True):
if not settings.get("enabled", True):
console.print(f"[yellow]≫ Пропускаем {name}")
continue
module = importlib.import_module(f"patches.{name}")