Expand description
The engine behind the aoc command line tool.
The binary is a thin shell around this library: it parses arguments, loads
configuration and hands a resolve::Plan to app::App. Everything that
touches the outside world - the clock, child processes, the Advent of Code
API and the terminal - sits behind a trait, so the interesting logic is
exercised in tests without a network, a toolchain or a wall clock.
use aoc_runtime::{
app::App, cli::Cli, config::Config, env::{Env, SystemClock},
aoc::{cache::FileCache, input::InputStore},
process::SystemRunner, report::TermReporter, resolve,
};
use clap::Parser as _;
let cli = Cli::parse();
let env = Env::capture(cli.config.as_deref())?;
let (config, _warnings) = Config::load(&env)?;
let plan = resolve::plan(&cli, &config, &env.cwd, &SystemClock)?;
let cache = FileCache::new(&env.state_dir);
let inputs = InputStore::new(&env.state_dir);
App {
config: &config,
runner: &SystemRunner,
client: None,
cache: &cache,
inputs: &inputs,
reporter: &mut TermReporter,
}
.execute(plan)?;Modulesยง
- answer
- The stdout protocol used to recognise puzzle answers.
- aoc
- The Advent of Code boundary.
- app
- Executing a resolved
Plan. - cli
- Command line surface.
- config
- Loading and validating
config.yaml. - env
- Ambient state: where files live, and what day it is.
- error
- The error type the binary reports.
- language
- Supported solution languages and the commands that drive them.
- process
- Child process execution.
- puzzle
- Validated puzzle coordinates.
- report
- User-facing output.
- resolve
- Turning command line arguments into a concrete plan of work.
- template
- Path templates.