blob: 90180269ae4f40f5ecd375a7c3af8cd7843298c4 (
plain) (
blame)
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
32
33
34
35
36
37
38
39
40
41
42
43
|
#[macro_use]
mod macros;
mod connection;
mod repl;
mod tls;
use repl::ClientState;
fn main() {
let args: Vec<String> = 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();
}
|