Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
/aocfPublic

A CLI tool (and also crate) for Advent of Code (https://adventofcode.com/)

License

NotificationsYou must be signed in to change notification settings

nuxeh/aocf

Repository files navigation

buildtestclippymacOSwindowscoverallscrates.iocrates.io

A CLI tool (and also crate) forAdvent of Code.

demo

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 inputdata for a task as a string:

use aocf::Aoc;fnmain(){letmut aoc =Aoc::new().year(Some(2020)).day(Some(1)).init().unwrap();// Get input data (don't force)let input = aoc.get_input(false);ifletOk(i) = input{println!("{}", i);}}

Documentation for theAoc structure can be foundhere.

Downloaded data is cached as JSON and queried each time theAoc isinitialised, 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'sreadme.

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

How to get your session cookie. This can be as easy as loggingin to AoC with Firefox, and having the CLI extract the authentication tokenautomatically.

Installation

Install Rust

Installaocf:

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

Dependencies

Depends on development packages foropenssl,sqlite dependencies are bundled.


[8]ページ先頭

©2009-2025 Movatter.jp