aoc-auto
Simplifies and speeds up the process of starting a new advent of code challenge.
This is a build script that automatically generates rust files that imports your solutions for each of the year/day/part according to a predetermined project structure.
You can see how I use this at https://github.com/AlexanderReaper7/advent-of-code-rs
Usage
Installation
Run the cargo add aoc-auto --build to add it to your project´s build dependencies.
Then add the following to your build.rs file:
// build.rs
use aoc_auto;
Project Structure
The project structure you need to use folders named y{year} containing files named d{day}.rs for each day of that year´s AOC challenge.
An example of this is as follows:
├── Cargo.toml
├── build.rs
└── src
├── y2023
│ ├── d1.rs
│ └── d2.rs
├── y2024
│ ├── d1.rs
│ └── d2.rs
└── main.rs
This will turn into the following:
├── Cargo.toml
├── build.rs
└── src
├── y2023
│ ├── d1.rs
│ ├── d2.rs
│ └── mod.rs
├── y2024
│ ├── d1.rs
│ ├── d2.rs
│ └── mod.rs
├── main.rs
└── auto_import.rs
The d1.rs (and any other day) must contain two functions: part1 and part2 that take a String and return a String.
// src/y2023/d1.rs
Running
In your main.rs file, you can now import the generated auto_import file and use the select_function function to select your chosen solution.
// src/main.rs
TODO
- CLI Tool to create template file into the selected year and day.
- Also automatically fetch the day´s title and URL from the AOC website and paste it into the files description.