#![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 = 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); } } }