use crate::random_tables::RandomTables; mod cli; mod dice; mod random_tables; fn main() { let matches = cli::cli().get_matches(); match matches.subcommand() { Some(("random", sub_matches)) => { // TODO: Do something better than unwrap here. let random_command = sub_matches.subcommand().unwrap(); match random_command { ("henchman", _) => { println!("Generating a random henchman..."); } _ => unreachable!() } } Some(("roll", sub_matches)) => { let formula = sub_matches.get_one::("FORMULA").expect("required"); match dice::roll_formula(formula) { Some(roll_result) => println!("Rolled: {}", roll_result), None => eprintln!("Error: Invalid roll formula or calculation failed.") } } Some(("table", sub_matches)) => { let random_tables = RandomTables::new().unwrap(); let table_name = sub_matches.get_one::("TABLE").expect("required"); let output_text = random_tables.roll_table(table_name); println!("{}", output_text) } _ => unreachable!() } }