feat: add --download
flag to scaffold (#46)
This commit is contained in:
parent
47e4f227bd
commit
3260b731be
2 changed files with 11 additions and 2 deletions
|
@ -60,7 +60,9 @@ Every [solution](https://github.com/fspoettel/advent-of-code-rust/blob/main/src/
|
||||||
### Download input & description for a day
|
### Download input & description for a day
|
||||||
|
|
||||||
> [!IMPORTANT]
|
> [!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
|
```sh
|
||||||
# example: `cargo download 1`
|
# example: `cargo download 1`
|
||||||
|
|
|
@ -15,6 +15,7 @@ mod args {
|
||||||
},
|
},
|
||||||
Scaffold {
|
Scaffold {
|
||||||
day: Day,
|
day: Day,
|
||||||
|
download: bool,
|
||||||
},
|
},
|
||||||
Solve {
|
Solve {
|
||||||
day: Day,
|
day: Day,
|
||||||
|
@ -44,6 +45,7 @@ mod args {
|
||||||
},
|
},
|
||||||
Some("scaffold") => AppArguments::Scaffold {
|
Some("scaffold") => AppArguments::Scaffold {
|
||||||
day: args.free_from_str()?,
|
day: args.free_from_str()?,
|
||||||
|
download: args.contains("--download"),
|
||||||
},
|
},
|
||||||
Some("solve") => AppArguments::Solve {
|
Some("solve") => AppArguments::Solve {
|
||||||
day: args.free_from_str()?,
|
day: args.free_from_str()?,
|
||||||
|
@ -80,7 +82,12 @@ fn main() {
|
||||||
AppArguments::All { release, time } => all::handle(release, time),
|
AppArguments::All { release, time } => all::handle(release, time),
|
||||||
AppArguments::Download { day } => download::handle(day),
|
AppArguments::Download { day } => download::handle(day),
|
||||||
AppArguments::Read { day } => read::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 {
|
AppArguments::Solve {
|
||||||
day,
|
day,
|
||||||
release,
|
release,
|
||||||
|
|
Loading…
Add table
Reference in a new issue