blob: f39c5fc24485d9d33aa615b5e73e6158dfe77205 (
plain)
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
|
#![feature(addr_parse_ascii)]
use std::env;
use std::process::ExitCode;
mod common;
mod help;
mod query;
mod repl;
mod server;
fn main() -> ExitCode {
env_logger::init();
let args: Vec<String> = env::args().collect();
if args.len() <= 1 {
println!("{}", help::USAGE);
eprintln!("Expected command argument.");
return ExitCode::from(1);
}
let cmd = &args[1];
let cmd_args = &args[2..];
match cmd.as_str() {
"server" => return server::cmd(cmd_args),
"repl" => return repl::cmd(cmd_args),
"query" => return query::cmd(cmd_args),
"help" | "-h" | "--help" => return help::cmd(cmd_args),
_ => {
println!("{}", help::USAGE);
eprintln!("Unknown command {}.", cmd);
return ExitCode::from(1);
}
}
}
|