Input cmd
This commit is contained in:
parent
d00d157fb5
commit
19af7422b2
1 changed files with 20 additions and 0 deletions
20
src/main.rs
20
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}");
|
||||
},
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue