mahjong_cli/
main.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#![deny(clippy::use_self)]
use base::{App, AppCommand};
use cli::parse_args;
use print_game::print_game;
use simulate::run_simulation;

mod base;
mod cli;
mod log;
mod print_game;
mod simulate;

#[tokio::main]
async fn main() {
    let mut app = App::new();

    parse_args(&mut app).await;

    let command = app.command.clone().unwrap();

    match command {
        AppCommand::Simulate(opts) => {
            run_simulation(opts).await;
        }
        AppCommand::PrintGame(opts) => {
            print_game(opts).await.unwrap_or_else(|e| {
                println!("Error: {:?}", e);
            });
        }
    }
}