Skip to content

Commit 75aa23d

Browse files
committed
docs: improve readme
1 parent 9fb2c43 commit 75aa23d

File tree

1 file changed

+37
-27
lines changed

1 file changed

+37
-27
lines changed

README.md

Lines changed: 37 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -7,25 +7,25 @@
77

88
<!--- advent_readme_stars table --->
99

10-
---
10+
## Setup
11+
12+
### Create your _advent of code_ repository
1113

12-
Generated from [fspoettel/advent-of-code-rust](https://github.com/fspoettel/advent-of-code-rust).
14+
1. Open [the template repository](https://github.com/fspoettel/advent-of-code-rust) on Github.
15+
2. Click `Use this template` and create your repository.
16+
3. Clone your repository to your computer.
1317

14-
## Create your own
18+
### Setup rust
1519

16-
1. Open ☝️ template on Github.
17-
2. Click `Use this template` and create your repository.
18-
3. Clone the repository to your machine.
20+
1. Install the [Rust toolchain](https://www.rust-lang.org/tools/install).
21+
2. (recommended) Install the [rust-analyzer](https://rust-analyzer.github.io/manual.html) extension for your code editor.
22+
3. (optional) Install a native debugger. If you are using VS Code, [CodeLLDB](https://marketplace.visualstudio.com/items?itemName=vadimcn.vscode-lldb) is a good option.
1923

20-
## Install
24+
---
2125

22-
* Install the [Rust toolchain](https://www.rust-lang.org/tools/install).
23-
* (optional) Install [rust-analyzer](https://rust-analyzer.github.io/manual.html) for your editor.
24-
* (optional) Install a native debugger, e.g. [CodeLLDB](https://marketplace.visualstudio.com/items?itemName=vadimcn.vscode-lldb) for VS Code.
25-
* (optional) Install [`aoc-cli`](https://github.com/scarvalhojr/aoc-cli/) and follow their setup guide to use the `download` script for puzzle inputs. (see below)
26-
* (optional) Setup the README stars github action. (see below)
26+
✨ You can start solving puzzles now! Head to the [Usage section](#usage) to see how to use this template. If you like, you can configure [some optional features](#optional-template-features).
2727

28-
## Commands
28+
## Usage
2929

3030
### Setup new day
3131

@@ -41,12 +41,15 @@ Generated from [fspoettel/advent-of-code-rust](https://github.com/fspoettel/adve
4141
# 🎄 Type `cargo run --bin 01` to run your solution.
4242
```
4343

44-
Individual solutions live in the `./src/bin` directory as separate binaries.
44+
Individual solutions live in the `./src/bin/` directory as separate binaries.
4545

46-
Every [solution](https://github.com/fspoettel/advent-of-code-rust/blob/master/bin/scaffold#L21-L52) has _unit tests_ referencing the _example_ file. Use these tests to develop and debug your solution. When editing a solution, `rust-analyzer` will display buttons for these actions above the unit tests.
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.
4747

4848
### Download inputs for a day
4949

50+
> **Note**
51+
> This command requires configuring the optional [automatic input downloads](#automatic-input-downloads) feature.
52+
5053
```sh
5154
# example: `./bin/download 1`
5255
./bin/download <day>
@@ -108,7 +111,7 @@ cargo run
108111

109112
To run an optimized version for benchmarking, use the `--release` flag or the alias `cargo rr`.
110113

111-
_Total timing_ is computed from individual solution _timings_ and excludes overhead.
114+
_Total timing_ is computed from individual solution _timings_ and excludes as much overhead as possible.
112115

113116
### Run all solutions against example input
114117

@@ -128,23 +131,30 @@ cargo fmt
128131
cargo clippy
129132
```
130133

131-
## Setup readme stars
134+
## Optional template features
135+
136+
### Automatic input downloads
137+
138+
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).
139+
140+
### Readme progress tracker
132141

133142
This template includes [a Github action](https://github.com/k2bd/advent-readme-stars) that automatically updates the readme with your advent of code progress.
134143

135-
To enable it, you need to do two things:
144+
To enable it, complete the following steps:
136145

137-
1. set repository secrets.
138-
2. create a private leaderboard.
146+
#### 1. Create private leaderboard
139147

140-
### Repository secrets
148+
Go to the leaderboard page of the year you want to track and click _Private Leaderboard_. If you have not created a leaderboard yet, create one by clicking _Create It_. Your leaderboard should be accessible under `https://adventofcode.com/{year}/leaderboard/private/view/{aoc_user_id}`.
141149

142-
Go to the _Secrets_ tab in your repository settings and create the following secrets:
150+
#### 2. Set repository secrets
143151

144-
* `AOC_USER_ID`: Go to [this page](https://adventofcode.com/settings) and copy your user id. It's the number behind the `#` symbol in the first name option. Example: `3031`
145-
* `AOC_YEAR`: the year you want to track. Example: `2021`
146-
* `AOC_SESSION`: an active session for the advent of code website. 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.
152+
Go to the _Secrets_ tab in your repository settings and create the following secrets:
147153

148-
### Private Leaderboard
154+
- `AOC_ENABLED`: This variable controls whether the workflow is enabled. Set it to `true` to enable the progress tracker.
155+
- `AOC_USER_ID`: Go to [this page](https://adventofcode.com/settings) and copy your user id. It's the number behind the `#` symbol in the first name option. Example: `3031`
156+
- `AOC_YEAR`: the year you want to track. Example: `2021`
157+
- `AOC_SESSION`: an active session for the advent of code website. 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.
149158

150-
Go to the leaderboard page of the year you want to track and click _Private Leaderboard_. If you have not created a leaderboard yet, create one by clicking _Create It_. Your leaderboard should be accessible under `https://adventofcode.com/{year}/leaderboard/private/view/{aoc_user_id}`.
159+
> **Note**
160+
> 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.

0 commit comments

Comments
 (0)