diff --git a/py/.gitignore b/py/.gitignore new file mode 100644 index 0000000..586a0a0 --- /dev/null +++ b/py/.gitignore @@ -0,0 +1,3 @@ +__pycache__ +/.venv +*.egg-info diff --git a/py/aoc/__init__.py b/py/aoc/__init__.py new file mode 100644 index 0000000..9f19f4b --- /dev/null +++ b/py/aoc/__init__.py @@ -0,0 +1,27 @@ +import sys +import argparse +from pathlib import Path + +DAYS = {} + + +def main(): + parser = argparse.ArgumentParser() + parser.add_argument("files", type=Path, nargs="+") + args = parser.parse_args() + + first_day = True + for file in args.files: + if not first_day: + print() + first_day = False + + day = DAYS.get(file.stem) + if day is None: + print(f"### Could not determine day: {file}", file=sys.stderr) + continue + + print(f"### Solving day {file.stem}") + with open(file) as f: + inputstr = f.read() + day(inputstr) diff --git a/py/pyproject.toml b/py/pyproject.toml new file mode 100644 index 0000000..2302577 --- /dev/null +++ b/py/pyproject.toml @@ -0,0 +1,10 @@ +[build-system] +requires = ["setuptools"] +build-backend = "setuptools.build_meta" + +[project] +name = "aoc-py" +version = "0.0.0" + +[project.scripts] +aoc-py = "aoc:main"