chore: simplify README.md

This commit is contained in:
Matej Janezic 2022-12-02 14:43:17 +01:00
parent 00000100ae
commit 00000110ef
Signed by: janezicmatej
GPG Key ID: 4298E230ED37B2C0
1 changed files with 22 additions and 74 deletions

View File

@ -4,84 +4,32 @@
# Advent-of-Code {YEAR} # Advent-of-Code {YEAR}
*This is a dumbed down version of [fspoettel/advent-of-code-rust](https://github.com/fspoettel/advent-of-code-rust) with some extra features* *This is a dumbed down version of [fspoettel/advent-of-code-rust](https://github.com/fspoettel/advent-of-code-rust) with some extra features*
## CLI ## Project overview
### Prepare
```sh ### Project structure
# example: `cargo prepare 1` - `src/` :
cargo prepare <day> - `bin/`:
- `<day>.rs`: solution files
- `*.rs`: convenience scripts
- `inputs/`: this directory is gitignored, input files go here
- `test_inputs/`: example files go here; you can push this as test are run in ci
- `helpers.rs`: helper functions you can reuse in solution files go here
- `lib.rs`: contains framework code
- `main.rs`: contains framework code
- `.env.example`: example dotenv file
# output: ### Cli
# Created module "src/bin/01.rs" - `cargo prepare <day>`: prepare solution files for `day`
# Created empty input file "src/inputs/01.txt" - `cargo download <day>`: download input file for `day`
# Created empty example file "src/examples/01.txt" - `cargo solve <day>`: run solution against input for `day`
# --- - `cargo all`: alias for run; runs solutions for all days
# 🎄 Type `cargo solve 01` to run your solution.
```
### Download input
prepare `.env` file
```
cp .env.example .env
```
set `YEAR` to whichever year you are solving for and `TOKEN` to AoC session Cookie.
```sh
# example: `cargo download 1`
cargo download <day>
# output:
# Downloaded input file "src/inputs/01.txt"
```
### Solve
```sh
# example: `cargo solve 01`
cargo solve <day>
# output:
# Running `target/debug/01`
# 🎄 Part 1 🎄
#
# 6 (elapsed: 37.03µs)
#
# 🎄 Part 2 🎄
#
# 9 (elapsed: 33.18µs)
```
Displayed timings show the raw execution time of your solution without overhead (e.g. file reads). To run an optimized version for benchmarking, append the `--release` flag.
### Solve all ### dotenv
```sh set `YEAR` to whichever year you are solving for and `TOKEN` to AoC session Cookie
cargo all
# output: ### FAQ
# Running `target/release/aoc`
# ----------
# | Day 01 |
# ----------
# 🎄 Part 1 🎄
#
# 0 (elapsed: 170.00µs)
#
# 🎄 Part 2 🎄
#
# 0 (elapsed: 30.00µs)
# <...other days...>
# Total: 0.20ms
```
`all` is an alias for `cargo run`. To run an optimized version for benchmarking, append the `--release` flag.
### Run against test inputs
run all solutions
```sh
cargo test
```
run for a given day
```sh
cargo test --bin <day>
```
#### How are your commits numbered in ascending order?
[https://westling.dev/b/extremely-linear-git](https://westling.dev/b/extremely-linear-git)