/aoc-cli-node

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

Primary LanguageTypeScriptMIT LicenseMIT

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