From 19af7422b22ce2af802bcab8c17b47dcdef83336 Mon Sep 17 00:00:00 2001 From: Ty Date: Fri, 1 Dec 2023 22:44:48 -0700 Subject: [PATCH] Input cmd --- src/main.rs | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/main.rs b/src/main.rs index 98c636e..c64067c 100644 --- a/src/main.rs +++ b/src/main.rs @@ -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}"); + }, } }