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

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!()
    }
}