Skip to content

Commit 8f126cb

Browse files
committed
docs: update setup docs
1 parent 49123f7 commit 8f126cb

File tree

1 file changed

+19
-12
lines changed

1 file changed

+19
-12
lines changed

README.md

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@
22

33
# 🎄 [Advent of Code](https://adventofcode.com/)
44

5-
![Language](https://badgen.net/badge/Language/Rust/orange)
6-
[![CI](https://github.com/fspoettel/advent-of-code-rust/actions/workflows/ci.yml/badge.svg)](https://github.com/fspoettel/advent-of-code-rust/actions/workflows/ci.yml)
5+
Cross-platform template for solving Advent of Code in Rust.
76

87
<!--- advent_readme_stars table --->
98

@@ -43,12 +42,14 @@ cargo scaffold <day>
4342

4443
Individual solutions live in the `./src/bin/` directory as separate binaries.
4544

46-
Every [solution](https://github.com/fspoettel/advent-of-code-rust/blob/master/bin/scaffold#L21-L52) has _unit tests_ referencing its _example_ file. Use these unit tests to develop and debug your solution against example inputs. When editing a solution, `rust-analyzer` will display buttons for these actions above the unit tests.
45+
Every [solution](https://github.com/fspoettel/advent-of-code-rust/blob/master/src/bin/scaffold.rs#L7-L35) has _unit tests_ referencing its _example_ file. Use these unit tests to develop and debug your solution against example inputs. For some puzzles, it might be easier to forgo the example file and hardcode inputs into the tests.
46+
47+
When editing a solution, `rust-analyzer` will display buttons for these actions above the unit tests.
4748

4849
### Download inputs for a day
4950

5051
> **Note**
51-
> This command requires configuring the optional [automatic input downloads](#automatic-input-downloads) feature.
52+
> This command requires [installing the aoc-cli crate](#download-inputs-via-aoc-cli).
5253
5354
```sh
5455
# example: `cargo download 1`
@@ -66,7 +67,7 @@ cargo download <day>
6667

6768
To download inputs for previous years, append the `--year` flag. _(example: `cargo download 1 --year 2020`)_
6869

69-
Puzzle inputs are not checked into git. [See here](https://old.reddit.com/r/adventofcode/comments/k99rod/sharing_input_data_were_we_requested_not_to/gf2ukkf/?context=3) why.
70+
Puzzle inputs are not checked into git. [Reasoning](https://old.reddit.com/r/adventofcode/comments/k99rod/sharing_input_data_were_we_requested_not_to/gf2ukkf/?context=3).
7071

7172
### Run solutions for a day
7273

@@ -87,7 +88,7 @@ cargo run --bin <day>
8788

8889
To run an optimized version for benchmarking, use the `--release` flag or the alias `cargo rr --bin <day>`.
8990

90-
Displayed _timings_ show the raw execution time of your solution w/o overhead (e.g. file reads).
91+
Displayed _timings_ show the raw execution time of your solution without overhead (e.g. file reads).
9192

9293
### Run solutions for all days
9394

@@ -134,9 +135,19 @@ cargo clippy
134135

135136
## Optional template features
136137

137-
### Automatic input downloads
138+
### Download inputs via aoc-cli
139+
140+
1. Install [`aoc-cli`](https://github.com/scarvalhojr/aoc-cli/) via cargo: `cargo install aoc-cli`.
141+
2. Create an `.adventofcode.session` file in your home directory and paste your session cookie into it. To get this, press F12 anywhere on the Advent of Code website to open your browser developer tools. Look in your Cookies under the Application or Storage tab, and copy out the `session` cookie value.
142+
143+
Once installed, you can use the [download command](#download-inputs-for-a-day).
144+
145+
> **Note**
146+
> The session cookie might expire after a while (~1 month) which causes the downloads to fail. To fix this issue, refresh the `.adventofcode.session` file.
147+
148+
### CI: enable clippy lints
138149

139-
Install [`aoc-cli`](https://github.com/scarvalhojr/aoc-cli/) and follow their setup instructions. Once installed, you can use the [download command](#download-inputs-for-a-day).
150+
Uncomment the `clippy` job in the `ci.yml` workflow to enable clippy checks in CI.
140151

141152
### Readme progress tracker
142153

@@ -160,10 +171,6 @@ Go to the _Secrets_ tab in your repository settings and create the following sec
160171
> **Note**
161172
> The session cookie might expire after a while (~1 month) which causes the automated workflow to fail. To fix this issue, refresh the `AOC_SESSION` secret.
162173
163-
### CI: enable clippy lints
164-
165-
Uncomment the `clippy` job in the `ci.yml` workflow to enable clippy checks in CI.
166-
167174
## Useful crates
168175

169176
- [itertools](https://crates.io/crates/itertools): Extends iterators with extra methods and adaptors. Frequently useful for aoc puzzles.

0 commit comments

Comments
 (0)