Coder Social home page Coder Social logo

aoc-cli's Introduction

AOC: CLI Utility For Advent of Code

Requirements

  • Node.js
  • Python 3
  • ZSH

Set-up:

Create file .env in aoc-scripts directory with the following properties:

export AOC_SESSION=<your-aoc-session-token>
export AOC_URL=<aoc-url>

export AOC_YEAR=<year>
export AOC_DAY=<day>
export AOC_LEVEL=<level>

export AOC_PROJECT_DIR=<location-of-aoc-project>
export AOC_SRC_DIR=<src-directory-within-module>
export AOC_RES_DIR=<resources-directory-within-module>
export AOC_SRC_SUBDIR=<subdirectory-within-src-dir>
export AOC_RES_SUBDIR=<subdirectory-within-resources-dir>

export AOC_MODULE_PREFIX=<prefix-of-module>
export AOC_SRC_YEAR_PREFIX=<prefix-for-year-package-in-source-dir>
export AOC_RES_YEAR_PREFIX=<prefix-for-year-dir-in-resources-dir>
export AOC_DAY_PREFIX=<prefix-for-day-subdirectory>

export IDE=<ide-or-editor-to-open-project>

Note:

  • Session token cookie can be found in the browser dev tools when logged in on the AoC website
  • IDE value must be an executable in order to work
  • INSTALL_DIR value must be in PATH for cli to work
  • resulting directory structure:
    • Source: project-dir/module-dir/source-dir/year-subdirectory/day-subdirectory/
    • Resources: project-dir/module-dir/resources-dir/day-subdirectory/
    • year-subdirectory == year-prefix{year}
    • day-subdirectory == day-prefix{day}
    • resources-subdirectory: leave blank to omit resources subdirectory
    • YEAR_PREFIX: leave blank to omit year subdirectory
    • DAY_PREFIX: default value: d

Usage:

Run executable with aoc command

Flags

-i

Install:

  • Creates necessary symlinks to make aoc executable findable on PATH

-u

Uninstall:

  • Removes symlinks to aoc executable from PATH

-a <answer>

Answer:

  • Submits parameter as answer for selected year, day and level

-D <new-day>

New Day:

  • Overrides DAY environment variable

-Y <new-year>

New Year:

  • Overrides YEAR environment variable

-L <new-level>

New Level:

  • Overrides LEVEL environment variable

-c

Create:

  • Creates empty src and resources directories for selected year and day
  • Creates input and example files
  • Gets input from AoC website to create input file
  • Gets problem description from AoC website to create README.md and formats into Markdown

-s

Set:

  • Sets the YEAR, DAY and LEVEL environment variables to the values passed to -Y, -D and -L respectively
  • Missing parameters are left unchanged

-n

Next:

  • Advances to the next day
  • -y, -d and -l can be combined to advance all or some of the fields, e.g. aoc -nydl

-O <ide>

Open:

  • Opens AoC project with chosen IDE

-o

Open:

  • Opens AoC project with default IDE

-e

Echo:

  • Echoes current values for YEAR, DAY and LEVEL to the shell

-I

Init:

  • Initialises a new project
  • Set custom structure up via cli input

-h

Help:

  • Shows help

aoc-cli's People

Contributors

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