GithubHelp home page GithubHelp logo

tranzystorek-io / aocf Goto Github PK

View Code? Open in Web Editor NEW

This project forked from nuxeh/aocf

0.0 1.0 0.0 2.33 MB

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

License: ISC License

Rust 94.29% Nix 4.10% Shell 1.62%

aocf's Introduction

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.

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

use aocf::Aoc;

fn main() {
    let mut aoc = Aoc::new()
        .year(Some(2020))
        .day(Some(1))
        .init()
        .unwrap();

    // 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.

Installation

Install Rust

Install aocf:

  • 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 for openssl, sqlite dependencies are bundled.

aocf's People

Contributors

dependabot-preview[bot] avatar nuxeh avatar tranzystorek-io avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.