added directory to yaml
This commit is contained in:
14
tasks.py
14
tasks.py
@@ -1,4 +1,5 @@
|
|||||||
from invoke import task
|
from invoke import task
|
||||||
|
import yaml
|
||||||
|
|
||||||
@task
|
@task
|
||||||
def aur(c, name):
|
def aur(c, name):
|
||||||
@@ -15,3 +16,16 @@ def add(c, url, name=None):
|
|||||||
@task
|
@task
|
||||||
def update(c):
|
def update(c):
|
||||||
c.run("git pull && git submodule update --init")
|
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)
|
||||||
|
|||||||
Reference in New Issue
Block a user