Skip to content

An Advent of Code command-line tool developed using Node.js.

License

Notifications You must be signed in to change notification settings

bryan-hoang/aoc-cli-node

Repository files navigation

aoc-cli-node

license CI Release standard-readme compliant

An Advent of Code command-line tool developed using Node.js.

Table of Contents

Install

For the command-line tool:

# ✨ Auto-detect
npx nypm install -g @bryan-hoang/aoc-cli

# npm
npm install -g @bryan-hoang/aoc-cli

# yarn
yarn add -g @bryan-hoang/aoc-cli

# pnpm
pnpm install -g @bryan-hoang/aoc-cli

# bun
bun install -g @bryan-hoang/aoc-cli

# deno
deno install -g @bryan-hoang/aoc-cli

# Running the tool
aoc <args>
# or
aoc-cli <args>

or

# npm
npx @bryan-hoang/aoc-cli@latest <args>

# pnpm
pnpm dlx @bryan-hoang/aoc-cli@latest <args>

# bun
bunx @bryan-hoang/aoc-cli@latest <args>

# deno
deno run -A npm:@bryan-hoang/aoc-cli@latest <args>

For the client library:

# ✨ Auto-detect
npx nypm install @bryan-hoang/aoc-client

# npm
npm install @bryan-hoang/aoc-client

# yarn
yarn add @bryan-hoang/aoc-client

# pnpm
pnpm install @bryan-hoang/aoc-client

# bun
bun install @bryan-hoang/aoc-client

# deno
deno install @bryan-hoang/aoc-client

Usage

For the command-line tool:

$ aoc help
An Advent of Code command-line tool

USAGE aoc [OPTIONS] submit|download|help

COMMANDS

  submit    Submit puzzle answer
  download  Save puzzle description and input to files
  help      Print this message or the help of the given subcommand(s)

OPTIONS

  -d, --day <DAY>            Puzzle day [default: last unlocked day (during Advent of Code month)]
  -y, --year <YEAR>          Puzzle year [default: year of current or last Advent of Code event]
  -s, --session-file <PATH>  Path to session cookie file [default: /home/bryan/.config/advent-of-code/session-cookie.txt]
  -h, --help                 Print help information
  --version                  Print version information

For the client library:

ESM (Node.js, Bun, Deno)

import { AocClientBuilder, AocClient } from "@bryan-hoang/aoc-client";

CommonJS (Legacy Node.js)

const { AocClientBuilder, AocClient } = require("@bryan-hoang/aoc-client");

CDN (Deno, Bun and Browsers)

import {
  AocClientBuilder,
  AocClient,
} from "https://esm.sh/@bryan-hoang/aoc-client";

🏭 AocClientBuilder

πŸ”— Source

Methods

βš™οΈ buildClient

Method Type
buildClient () => AocClient

πŸ”— Source

βš™οΈ #validateBuild

Method Type
#validateBuild () => asserts this is this and { _sessionCookie: string; _year: number; _day: number; }

πŸ”— Source

βš™οΈ getSessionCookieFromDefaultLocations

Method Type
getSessionCookieFromDefaultLocations () => AocClientBuilder

πŸ”— Source

βš™οΈ getSessionCookieFromFile

Method Type
getSessionCookieFromFile (file: string) => AocClientBuilder

πŸ”— Source

βš™οΈ getDefaultSessionCookieFile

Method Type
getDefaultSessionCookieFile () => string

πŸ”— Source

βš™οΈ sessionCookie

Method Type
sessionCookie (sessionCookie: string) => AocClientBuilder

πŸ”— Source

βš™οΈ year

Method Type
year (year: number) => AocClientBuilder

πŸ”— Source

βš™οΈ day

Method Type
day (day: number) => AocClientBuilder

πŸ”— Source

βš™οΈ latestPuzzleDay

Method Type
latestPuzzleDay () => AocClientBuilder

πŸ”— Source

βš™οΈ latestEventYear

Method Type
latestEventYear () => AocClientBuilder

πŸ”— Source

βš™οΈ overwriteFiles

Method Type
overwriteFiles (overwriteFiles: boolean) => AocClientBuilder

πŸ”— Source

🏭 AocClient

πŸ”— Source

Methods

βš™οΈ getBuilder

Method Type
getBuilder () => AocClientBuilder

πŸ”— Source

βš™οΈ ensureDayUnlocked

Method Type
ensureDayUnlocked () => void

πŸ”— Source

βš™οΈ isDayUnlocked

Method Type
isDayUnlocked () => boolean

πŸ”— Source

Maintainers

@bryan-hoang

Contributing

PRs accepted.

Small note: if editing the README, please conform to the standard-readme specification.

License

MIT Β© 2024 Bryan Hoang

Functionality is inspired by scarvalhojr/aoc-cli. Project structure is inspired by nuxt/cli.


πŸ€– auto updated with automd

About

An Advent of Code command-line tool developed using Node.js.

Topics

Resources

License

Code of conduct

Stars

Watchers

Forks