Skip to content

Commit

Permalink
docs: clarify docs
Browse files Browse the repository at this point in the history
  • Loading branch information
fspoettel committed Dec 11, 2023
1 parent 3aef583 commit c82e1e2
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 18 deletions.
6 changes: 5 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,11 @@ today = ["chrono"]
test_lib = []

[dependencies]

# Template dependencies
chrono = { version = "0.4.31", optional = true }
dhat = { version = "0.3.2", optional = true }
pico-args = "0.5.0"
tinyjson = "2"
tinyjson = "2.5.1"

# Solution dependencies
34 changes: 17 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ Individual solutions live in the `./src/bin/` directory as separate binaries. _I
Every [solution](https://github.com/fspoettel/advent-of-code-rust/blob/main/src/template.txt) has _tests_ referencing its _example_ file in `./data/examples`. Use these tests to develop and debug your solutions against the example input. In VS Code, `rust-analyzer` will display buttons for running / debugging these unit tests above the unit test blocks.

> [!TIP]
> If a day has different example inputs for both parts, you can use the `read_file_part()` helper in your tests instead of `read_file()`. For example, if this applies to day 1, you can create a second example file `01-2.txt` and invoke the helper like `let result = part_two(&advent_of_code::template::read_file_part("examples", DAY, 2));` to read it in `test_part_two`.
> If a day has multiple example inputs, you can use the `read_file_part()` helper in your tests instead of `read_file()`. If this e.g. applies to day 1, you can create a second example file `01-2.txt` and invoke the helper like `let result = part_two(&advent_of_code::template::read_file_part("examples", DAY, 2));`. This supports an arbitrary number of example files.
### ➡️ Download input for a day

Expand Down Expand Up @@ -98,7 +98,7 @@ For example, running a benchmarked, optimized execution of day 1 would look like
> [!IMPORTANT]
> This requires [installing the aoc-cli crate](#configure-aoc-cli-integration).
In order to submit part of a solution for checking, append the `--submit <part>` option to the `solve` command.
Append the `--submit <part>` option to the `solve` command to submit your solution for checking.

### ➡️ Run all solutions

Expand All @@ -120,7 +120,7 @@ This runs all solutions sequentially and prints output to the command-line. Same

### ➡️ Update readme benchmarks

The template can write benchmark times to the README via the `cargo time` command.
The template can write benchmark times to the readme via the `cargo time` command.

By default, this command checks for missing benchmarks, runs those solutions, and then updates the table. If you want to (re-)time all solutions, run `cargo time --all`. If you want to (re-)time one specific solution, run `cargo time <day>`.

Expand All @@ -134,18 +134,6 @@ cargo test

To run tests for a specific day, append `--bin <day>`, e.g. `cargo test --bin 01`. You can further scope it down to a specific part, e.g. `cargo test --bin 01 part_one`.

### ➡️ Format code

```sh
cargo fmt
```

### ➡️ Lint code

```sh
cargo clippy
```

### ➡️ Read puzzle description

> [!IMPORTANT]
Expand Down Expand Up @@ -196,12 +184,24 @@ cargo today
# ...the input...
```

### ➡️ Format code

```sh
cargo fmt
```

### ➡️ Lint code

```sh
cargo clippy
```

## Optional template features

### Configure aoc-cli integration

1. Install [`aoc-cli`](https://github.com/scarvalhojr/aoc-cli/) via cargo: `cargo install aoc-cli --version 0.12.0`
2. Create an `.adventofcode.session` file in your home directory and paste your session cookie. To retrieve the session cookie, press F12 anywhere on the Advent of Code website to open your browser developer tools. Look in _Cookies_ under the _Application_ or _Storage_ tab, and copy out the `session` cookie value. [^1]
2. Create the file `<home_directory>/.adventofcode.session` and paste your session cookie into it. To retrieve the session cookie, press F12 anywhere on the Advent of Code website to open your browser developer tools. Look in _Cookies_ under the _Application_ or _Storage_ tab, and copy out the `session` cookie value. [^1]

Once installed, you can use the [download command](#download-input--description-for-a-day), the read command, and automatically submit solutions via the [`--submit` flag](#submitting-solutions).

Expand Down Expand Up @@ -229,7 +229,7 @@ Go to the _Variables_ tab in your repository settings and create the following v

✨ You can now run this action manually via the _Run workflow_ button on the workflow page. If you want the workflow to run automatically, uncomment the `schedule` section in the `readme-stars.yml` workflow file or add a `push` trigger.

### Check code formatting / clippy lints in CI
### Enable code formatting / clippy checks in the CI

Uncomment the respective sections in the `ci.yml` workflow.

Expand Down
3 changes: 3 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
pub mod template;

// Use this file to add helper functions and additional modules.

0 comments on commit c82e1e2

Please sign in to comment.