diff --git a/Cargo.lock b/Cargo.lock
index d565394..df53ee0 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -23,6 +23,7 @@ version = "0.1.0"
dependencies = [
"aoc_proc",
"color-eyre",
+ "time",
"ureq",
]
@@ -314,6 +315,12 @@ dependencies = [
"untrusted",
]
+[[package]]
+name = "serde"
+version = "1.0.148"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e53f64bb4ba0191d6d0676e1b141ca55047d83b74f5607e6d8eb88126c52c2dc"
+
[[package]]
name = "sharded-slab"
version = "0.1.4"
@@ -349,6 +356,22 @@ dependencies = [
"once_cell",
]
+[[package]]
+name = "time"
+version = "0.3.17"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a561bf4617eebd33bca6434b988f39ed798e527f51a1e797d0ee4f61c0a38376"
+dependencies = [
+ "serde",
+ "time-core",
+]
+
+[[package]]
+name = "time-core"
+version = "0.1.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "2e153e1f1acaef8acc537e68b44906d2db6436e2b35ac2c6b42640fff91f00fd"
+
[[package]]
name = "tinyvec"
version = "1.6.0"
diff --git a/Cargo.toml b/Cargo.toml
index ff2c32e..687b16f 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -12,3 +12,4 @@ members = ["aoc_proc"]
color-eyre = "0.6.2"
aoc_proc = { path = "aoc_proc" }
ureq = "2.5.0"
+time = "0.3.17"
diff --git a/src/bin/create_day.rs b/src/bin/create_day.rs
new file mode 100644
index 0000000..b1cd2a3
--- /dev/null
+++ b/src/bin/create_day.rs
@@ -0,0 +1,57 @@
+use std::path::Path;
+
+use color_eyre::{Result, eyre::bail};
+
+const TEMPLATE: &str = r#"
+use aoc_2022::prelude::*;
+
+type Input = ();
+
+fn parse(s: &str) -> Result {
+ Ok(())
+}
+
+#[aoc(day = {{ day }}, parse = parse)]
+fn day_{{ day }}(mut input: Input) -> Result<()> {
+ // Part 1
+ println!("Part one: ");
+
+ // Part 2
+ println!("Part two: ");
+
+ Ok(())
+}
+"#;
+
+fn main() -> Result<()> {
+ let day = std::env::args().nth(1);
+
+ let day = match day {
+ Some(day) => day.parse::()?,
+ None => {
+ let today = time::OffsetDateTime::now_utc().date();
+
+ if today.month() != time::Month::December {
+ bail!("Its not December yet!");
+ }
+
+ if today.day() > 25 {
+ bail!("Its after Christmas now :/");
+ }
+
+ today.day()
+ }
+ };
+
+ let output_path = Path::new("src").join("bin").join(format!("day_{day}.rs"));
+
+ if output_path.exists() {
+ bail!("today already exists!");
+ }
+
+ std::fs::write(output_path, TEMPLATE.replace("{{ day }}", &format!("{day}")))?;
+
+ println!("ready uwu :)");
+
+ Ok(())
+}