This commit is contained in:
2025-11-17 00:18:45 -03:00
commit 503f4c0fa6
18 changed files with 633 additions and 0 deletions

50
main.py Normal file
View File

@@ -0,0 +1,50 @@
#!/usr/bin/env python
import pathlib
from aoc import cli, input_file, run, exceptions
import sys
import os
import dotenv
SOLUTION_BASE = pathlib.Path("./src/solution")
INPUT_BASE = pathlib.Path("./data/input")
EXAMPLE_BASE = pathlib.Path("./data/example")
def main() -> None:
args = cli.argument_parser().parse_args()
session_token = os.getenv("AOC_SESSION_TOKEN")
try:
match args.command:
case "solve":
input_data = input_file.get(
args.year,
args.day,
session_token,
EXAMPLE_BASE if args.example else INPUT_BASE,
)
run.run_day(args.year, args.day, input_data, SOLUTION_BASE)
case "create":
input_file.create(
args.year,
args.day,
SOLUTION_BASE,
INPUT_BASE,
EXAMPLE_BASE,
)
case "download":
input_file.create_input_file(
args.year, args.day, session_token, INPUT_BASE, args.force
)
except exceptions.AocError as e:
print(f"error: {e}", file=sys.stderr)
exit(1)
if __name__ == "__main__":
dotenv.load_dotenv()
main()