1
0
Fork 0
mirror of https://github.com/yavook/kiwi-scp.git synced 2024-11-24 21:52:59 +00:00
kiwi-scp/kiwi_scp/instance.py
2021-12-02 17:08:14 +01:00

26 lines
620 B
Python

from pathlib import Path
from typing import Generator
import attr
from .config import KiwiConfig
from .project import Project
@attr.s
class Instance:
directory: Path = attr.ib(default=Path('.'))
@property
def config(self) -> KiwiConfig:
"""shorthand: get the current configuration"""
return KiwiConfig.from_directory(self.directory)
@property
def projects(self) -> Generator[Project, None, None]:
for project in self.config.projects:
yield Project(
directory=self.directory.joinpath(project.name),
parent=self,
)