summaryrefslogtreecommitdiff
path: root/src/main.rs
blob: c1c7cb2f7a2470345968110bdf8d7fda208827a4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
mod cli;
mod dice;
mod random_tables;

fn main() {
    let matches = cli::cli().get_matches();

    match matches.subcommand() {
        Some(("roll", sub_matches)) => {
            match dice::roll_formula(sub_matches.get_one::<String>("FORMULA").expect("required")) {
                Some(result) => println!("Rolled: {}", result),
                None => eprintln!("Error: Invalid roll formula or calculation failed.")
            }
        }
        _ => unreachable!()
    }
}