mirror of
https://github.com/yavook/kiwi-scp.git
synced 2024-11-21 20:33:00 +00:00
Instance.save_config
This commit is contained in:
parent
e896e8a06c
commit
cd11167fda
2 changed files with 6 additions and 3 deletions
|
@ -68,6 +68,4 @@ class InitCommand(KiwiCommand):
|
||||||
os.mkdir(instance.directory)
|
os.mkdir(instance.directory)
|
||||||
|
|
||||||
# write out the new kiwi.yml
|
# write out the new kiwi.yml
|
||||||
cfg = KiwiConfig.parse_obj(kiwi_dict)
|
instance.save_config(KiwiConfig.parse_obj(kiwi_dict))
|
||||||
with open(instance.directory.joinpath(KIWI_CONF_NAME), "w") as file:
|
|
||||||
cfg.dump_kiwi_yml(file)
|
|
||||||
|
|
|
@ -3,6 +3,7 @@ from typing import Generator, Dict, Sequence
|
||||||
|
|
||||||
import attr
|
import attr
|
||||||
|
|
||||||
|
from ._constants import KIWI_CONF_NAME
|
||||||
from .config import KiwiConfig
|
from .config import KiwiConfig
|
||||||
from .project import Project
|
from .project import Project
|
||||||
|
|
||||||
|
@ -17,6 +18,10 @@ class Instance:
|
||||||
|
|
||||||
return KiwiConfig.from_directory(self.directory)
|
return KiwiConfig.from_directory(self.directory)
|
||||||
|
|
||||||
|
def save_config(self, config: KiwiConfig) -> None:
|
||||||
|
with open(self.directory.joinpath(KIWI_CONF_NAME), "w") as file:
|
||||||
|
config.dump_kiwi_yml(file)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def projects(self) -> Generator[Project, None, None]:
|
def projects(self) -> Generator[Project, None, None]:
|
||||||
for project in self.config.projects:
|
for project in self.config.projects:
|
||||||
|
|
Loading…
Reference in a new issue