#advent #code #cli #tool #helper


A crate and CLI helper tool for Advent of Code

19 releases

0.1.21 Dec 19, 2022
0.1.20 Dec 19, 2022
0.1.18 Dec 11, 2021
0.1.15 Nov 21, 2021
0.1.1 Jan 12, 2020

#1439 in Command line utilities

Download history 35/week @ 2022-11-24 36/week @ 2022-12-01 41/week @ 2022-12-08 98/week @ 2022-12-15 40/week @ 2022-12-22 24/week @ 2022-12-29 20/week @ 2023-01-05 46/week @ 2023-01-12 36/week @ 2023-01-19 46/week @ 2023-01-26 58/week @ 2023-02-02 39/week @ 2023-02-09 135/week @ 2023-02-16 5/week @ 2023-02-23 12/week @ 2023-03-02 26/week @ 2023-03-09

187 downloads per month
Used in aocf_cli

ISC and maybe GPL-3.0+

448 lines

aocf - Advent of Code fetch

build test clippy macOS windows coveralls crates.io crates.io

A CLI tool (and also crate) for Advent of Code.


Written in Rust, but the CLI should be useful for development in any language.

To use directly within Rust, the crate may be used as follows, for getting input data for a task as a string:

use aocf::Aoc;

fn main() {
    let mut aoc = Aoc::new()

    // Get input data (don't force)
    let input = aoc.get_input(false);

    if let Ok(i) = input {
        println!("{}", i);

Documentation for the Aoc structure can be found here.

Downloaded data is cached as JSON and queried each time the Aoc is initialised, to avoid unecessary requests.

The CLI has a workflow similar to Git, e.g.

$ aocf init
$ aocf get-cookie # get cookie from firefox cookie store
$ aocf set-cookie <your-cookie-text>
$ aocf checkout 1 2019
$ aocf checkout --now
$ aocf fetch
$ aocf brief --pretty
$ aocf input
$ aocf status
$ aocf submit <answer>

More details can be found in in the CLI's readme.

The CLI can be used even if you don't plan to solve problems in Rust, and the CLI and the crate can also be freely used together, so if there is a root configuration created by the CLI, the crate will find and use this, or else store cached data in the current directory.

How to get your session cookie. This can be as easy as logging in to AoC with Firefox, and having the CLI extract the authentication token automatically.


Install Rust

Install aocf:

  • cargo install aocf_cli.
  • cargo install --path . from inside a cloned repository.
  • cargo deb --install from inside a cloned repository.


Depends on development packages for openssl, sqlite dependencies are bundled.


~353K SLoC