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

27 lines
620 B
Python
Raw Normal View History

2021-10-22 15:50:26 +00:00
from pathlib import Path
2021-12-02 16:08:14 +00:00
from typing import Generator
2021-10-22 15:50:26 +00:00
import attr
2021-12-02 16:08:14 +00:00
from .config import KiwiConfig
from .project import Project
2021-11-03 15:32:01 +00:00
@attr.s
2021-11-03 15:32:01 +00:00
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]:
2021-12-02 01:38:29 +00:00
for project in self.config.projects:
yield Project(
directory=self.directory.joinpath(project.name),
parent=self,
)