#[macro_use] mod macros; mod connection; mod repl; mod tls; use repl::ClientState; fn main() { let args: Vec = std::env::args().collect(); let unsafe_mode = args.iter().any(|arg| arg == "--unsafe"); // Every game board is drawn in place, so refuse a terminal that cannot fit // them before touching the network or the terminal mode. let size = crossterm::terminal::size(); let (columns, rows) = match &size { Ok((columns, rows)) => (*columns, *rows), Err(_) => (0, 0), }; if let Some(message) = zagan_bet::client::ui::terminal_too_small(columns, rows) { eprintln!("{message}"); if size.is_err() { eprintln!("Could not read the terminal size (is this a real terminal?)."); } std::process::exit(1); } if unsafe_mode { println!("WARNING: Running in UNSAFE mode - certificate verification disabled!"); } connection::set_unsafe_mode(unsafe_mode); let mut state = ClientState::new(); if let Some(host) = state.addr.clone() { state.connect_to(&host); } println!("Welcome to Zagan-Bet Client!"); println!("Type 'help' for available commands."); state.run(); }