pokemon/tools/generate/__main__.py
Zack Buhman 853457a79d generate: add pokemon
This also includes a handful of functions for creating instances of a
pokemon species, though certainly not complete.
2023-08-02 23:49:42 +00:00

21 lines
545 B
Python

from pathlib import Path
from pprint import pprint
import sys
from generate.files import files
def generate(base_path, target_path):
for func, filename in files:
path = base_path / filename
if path != target_path:
continue
buf = func().getvalue()
path.parents[0].mkdir(parents=False, exist_ok=True)
with open(path, 'w') as f:
f.write(buf)
# sys.argv[1] is secretly used in parse
base_path = Path(sys.argv[2])
target_path = Path(sys.argv[4])
generate(base_path, target_path)