From 70fe9d1142107acd871e5a82c45d239fab2be910 Mon Sep 17 00:00:00 2001 From: Sebastian Rust Date: Sun, 10 Jul 2022 13:13:04 +0200 Subject: [PATCH] added directory to yaml --- tasks.py | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/tasks.py b/tasks.py index 82de785..c0282e9 100644 --- a/tasks.py +++ b/tasks.py @@ -1,4 +1,5 @@ from invoke import task +import yaml @task def aur(c, name): @@ -14,4 +15,17 @@ def add(c, url, name=None): @task def update(c): - c.run("git pull && git submodule update --init") \ No newline at end of file + c.run("git pull && git submodule update --init") + +@task +def addyaml(c, directory): + f = "./build-pacman-repo.yaml" + with open(f, "r+") as stream: + data = yaml.safe_load(stream) + exists = [x["directory"] == directory for x in data["members"]] + exists = any(exists) + print(exists) + print(data) + if not exists: + data["members"].append({"directory":directory}) + yaml.safe_dump(data, stream)