Input cmd

This commit is contained in:
Tyler Beckman 2023-12-01 22:44:48 -07:00
parent d00d157fb5
commit 19af7422b2
Signed by: Ty
GPG key ID: 2813440C772555A4

View file

@ -23,6 +23,11 @@ enum Subcommands {
day: u8,
/// The part to solve for
part: u8
},
/// Fetches and prints the given input for a specified day
Input {
/// The day to fetch
day: u8
}
}
@ -53,5 +58,20 @@ async fn main() {
_ => panic!("Invalid day or part #")
}
},
Subcommands::Input { day } => {
let response = client
.get(format!("https://adventofcode.com/2023/day/{day}/input"))
.header("Cookie", format!("session={auth}", auth = cli.auth))
.send()
.await
.unwrap()
.text()
.await
.unwrap()
.trim_end()
.to_owned();
println!("{response}");
},
}
}