diehard 1.0.0

A dice roll simulator for tabletop RPGs (and other dice games)
Documentation
// SPDX-License-Identifier: GPL-3.0-or-later
// Copyright (C) 2026 Michael Dippery <michael@monkey-robot.com>

use clap::Parser;
use diehard::cli::{Config, Runner};
use std::io::Write;
use std::process;

fn die(error: &anyhow::Error) {
    eprintln!("error: {error}");
    process::exit(1);
}

fn main() {
    let config = Config::parse();
    env_logger::builder()
        .format(|buf, record| writeln!(buf, "{}", record.args()))
        .filter_level(config.verbosity.into())
        .init();

    let runner = Runner::new(config);
    match runner.run() {
        Ok(()) => {}
        Err(err) => die(&err),
    }
}