You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* add support for downloading puzzle descriptions in `cargo download`
* add `cargo read` command to read puzzles in terminal
* extract `aoc_cli` module
* use `aoc-cli`'s new overwrite option to eliminate temp files
Copy file name to clipboardExpand all lines: README.md
+27-8Lines changed: 27 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -50,7 +50,7 @@ Every [solution](https://github.com/fspoettel/advent-of-code-rust/blob/main/src/
50
50
51
51
When editing a solution, `rust-analyzer` will display buttons for running / debugging unit tests above the unit test blocks.
52
52
53
-
### Download input for a day
53
+
### Download input & description for a day
54
54
55
55
> **Note**
56
56
> This command requires [installing the aoc-cli crate](#download-puzzle-inputs-via-aoc-cli).
@@ -60,18 +60,20 @@ When editing a solution, `rust-analyzer` will display buttons for running / debu
60
60
cargo download <day>
61
61
62
62
# output:
63
-
# Downloading input with aoc-cli...
64
-
# Loaded session cookie from "/home/felix/.adventofcode.session".
65
-
# Downloading input for day 1, 2021...
66
-
# Saving puzzle input to "/tmp/tmp.MBdcAdL9Iw/input"...
63
+
# Loaded session cookie from "/Users/<snip>/.adventofcode.session".
64
+
# Fetching puzzle for day 1, 2022...
65
+
# Saving puzzle description to "src/puzzles/01.md"...
66
+
# Downloading input for day 1, 2022...
67
+
# Saving puzzle input to "src/inputs/01.txt"...
67
68
# Done!
68
69
# ---
69
-
# 🎄 Successfully wrote input to "src/inputs/01.txt"!
70
+
# 🎄 Successfully wrote input to "src/inputs/01.txt".
71
+
# 🎄 Successfully wrote puzzle to "src/puzzles/01.md".
70
72
```
71
73
72
74
To download inputs for previous years, append the `--year/-y` flag. _(example: `cargo download 1 --year 2020`)_
73
75
74
-
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).
76
+
Puzzle descriptions are stored in `src/puzzles` as markdown files. 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).
75
77
76
78
### Run solutions for a day
77
79
@@ -139,11 +141,28 @@ cargo fmt
139
141
cargo clippy
140
142
```
141
143
144
+
### Read puzzle description in terminal
145
+
146
+
> **Note**
147
+
> This command requires [installing the aoc-cli crate](#download-puzzle-inputs-via-aoc-cli).
148
+
149
+
```sh
150
+
# example: `cargo read 1`
151
+
cargo read<day>
152
+
153
+
# output:
154
+
# Loaded session cookie from "/Users/<snip>/.adventofcode.session".
155
+
# Fetching puzzle for day 1, 2022...
156
+
# ...the input...
157
+
```
158
+
159
+
To read inputs for previous years, append the `--year/-y` flag. _(example: `cargo read 1 --year 2020`)_
160
+
142
161
## Optional template features
143
162
144
163
### Download puzzle inputs via aoc-cli
145
164
146
-
1. Install [`aoc-cli`](https://github.com/scarvalhojr/aoc-cli/) via cargo: `cargo install aoc-cli --version 0.5.0`.
165
+
1. Install [`aoc-cli`](https://github.com/scarvalhojr/aoc-cli/) via cargo: `cargo install aoc-cli --version 0.7.0`
147
166
2. Create an `.adventofcode.session` file in your home directory and paste your session cookie[^1] 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.
148
167
149
168
Once installed, you can use the [download command](#download-input-for-a-day).
0 commit comments