From 92fada758300429c22373523c4a0148b75016081 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sp=C3=B6ttel?= <1682504+fspoettel@users.noreply.github.com> Date: Tue, 5 Dec 2023 22:33:37 +0100 Subject: [PATCH] feat: add `--download` flag to scaffold --- README.md | 4 +++- src/main.rs | 9 ++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 85aba56..b6d34d2 100644 --- a/README.md +++ b/README.md @@ -60,7 +60,9 @@ Every [solution](https://github.com/fspoettel/advent-of-code-rust/blob/main/src/ ### Download input & description for a day > [!IMPORTANT] -> This command requires [installing the aoc-cli crate](#configure-aoc-cli-integration). +> This requires [installing the aoc-cli crate](#configure-aoc-cli-integration). + +You can automatically download puzzle inputs and description by either appending the `--download` flag to `scaffold` (e.g. `cargo scaffold 4 --download`) or with the separate `download` command: ```sh # example: `cargo download 1` diff --git a/src/main.rs b/src/main.rs index 23ba03c..55e9955 100644 --- a/src/main.rs +++ b/src/main.rs @@ -15,6 +15,7 @@ mod args { }, Scaffold { day: Day, + download: bool, }, Solve { day: Day, @@ -44,6 +45,7 @@ mod args { }, Some("scaffold") => AppArguments::Scaffold { day: args.free_from_str()?, + download: args.contains("--download"), }, Some("solve") => AppArguments::Solve { day: args.free_from_str()?, @@ -80,7 +82,12 @@ fn main() { AppArguments::All { release, time } => all::handle(release, time), AppArguments::Download { day } => download::handle(day), AppArguments::Read { day } => read::handle(day), - AppArguments::Scaffold { day } => scaffold::handle(day), + AppArguments::Scaffold { day, download } => { + scaffold::handle(day); + if download { + download::handle(day); + } + } AppArguments::Solve { day, release,