#advent-of-code #cli-client #interact #aoc #challenge

bin+lib advent-of-code-client

CLI and crate library to interact with Advent of Code

2 releases

0.1.1 Dec 8, 2023
0.1.0 Dec 8, 2023

#26 in #advent-of-code

MIT license

26KB
523 lines

🎅🎄 Client for Advent of Code 🎄🎅

Crates.io crates.io Documentation

Crate to interact with the yearly challenges at Advent of Code. It functions as both a Rust library and an standalone CLI client.

Installation

Install with:

cargo install advent-of-code-client

It should now be accessable as aoc.

Authentication

To authorize against the Advent of Code site, the CLI expects AOC_TOKEN to be set in your environment with a valid session token, or manually provided with the --token flag.

After authenticating on the website, your session token can be found through the following steps (might vary a bit based on your browser):

  • Go to adventofcode.com and login
  • Open the developer settings in your browser (F12)
  • Go to application -> Cookies.
  • You should see a session variable - this is the token we need.
  • Add this to your environment with export AOC_TOKEN=<your token>

CLI usage

To submit a solution for a given year and day:

aoc 2023 1 -a <your answer>

Use -a to submit an answer for part A, -b for part B.

Dependencies

~7–20MB
~309K SLoC