Skip to content

Instantly share code, notes, and snippets.

@nanonyme
Created August 22, 2020 14:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nanonyme/9f9a64de5d38bff440924b1324f0e06b to your computer and use it in GitHub Desktop.
Save nanonyme/9f9a64de5d38bff440924b1324f0e06b to your computer and use it in GitHub Desktop.
#!/usr/bin/python3
import yaml
import sys
import os
import os.path
def main(filename):
with open(filename) as file:
data = yaml.load(file, Loader=yaml.CLoader)
for project, elements in data["projects"].items():
for element, refs in data["projects"][project].items():
with open(f"elements/{element}", "a") as file:
file.write(f" ref: {refs[0]['ref']}\n")
if __name__ == "__main__":
main(sys.argv[1])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment