feat: add task tag

This commit is contained in:
2026-08-02 16:42:15 +03:00
parent 48f8b2d5a9
commit 91a85f7141
4 changed files with 34 additions and 25 deletions
+4 -7
View File
@@ -4,7 +4,7 @@ from pathlib import Path
from typing import Iterable
from .common.command import CommandError
from .entry import Entry, EntryResolver, EntryTaskNotImplementedError
from .entry import Entry, EntryResolver
from .preset.entry import PresetEntryDetector
__all__ = ("ProjectManager",)
@@ -26,15 +26,12 @@ class ProjectManager:
def _iter_entries(self) -> Iterable[Entry]:
return self._resolver.resolve(self._basepaht)
def run_task(self, task_name: str) -> dict[str, int]:
def run_task(self, task_name: str, tag: str | None = None) -> dict[str, int]:
counter = Counter()
for entry in self._iter_entries():
try:
entry.run_task(task_name)
counter["success"] += 1
except EntryTaskNotImplementedError:
self._logger.warning("%s %s", task_name, entry)
counter["skipped"] += 1
if entry.run_task(task_name, tag):
counter["success"] += 1
except CommandError as error:
self._logger.error("%s\n%s", entry, error.output)
counter["failed"] += 1