feat: use .gitignore

This commit is contained in:
2026-08-06 01:20:58 +03:00
parent d062447e6d
commit 9d15380443
13 changed files with 183 additions and 130 deletions
+50
View File
@@ -0,0 +1,50 @@
import logging
from pathlib import Path
from typing import NamedTuple
from ..common.command import CommandExecutor
logger = logging.getLogger("entry")
class TaskKey(NamedTuple):
name: str
tag: str
def __repr__(self) -> str:
return f"{self.name}:{self.tag}"
class Entry:
_logger = logger
def __init__(
self,
tasks: dict[TaskKey, list[str]],
basepath: Path,
):
self._tasks = tasks
self._basepath = basepath
def show(self):
self._logger.info("🔵 %s", self)
for task_name, commands in self._tasks.items():
self._logger.info(" %s", task_name)
for command in commands:
self._logger.debug(" %s", command)
def run_task(self, task_name: str, tag: str | None = None) -> bool:
if task_name == "show":
self.show()
return True
runned = False
for task_key, commands in self._tasks.items():
if task_key.name == task_name and (tag is None or tag == task_key.tag):
self._logger.info("🔵 %s %s", task_key, self)
runned = True
for command in commands:
CommandExecutor(command).run(self._basepath)
return runned
def __repr__(self):
return f"{str(self._basepath)}"