#[macro_use]
extern crate clap;
extern crate zif_net;
use zif_net::address::Address;
use zif_net::http_listener::HttpListener;
use zif_net::net_listener::NetListener;
fn main() {
let matches = clap_app!(zif =>
(version: "0.0.1")
(author: "Will Huxtable <will.huxtable@gmail.com>")
(@subcommand serve =>
(about: "runs a Zif server")
(@arg verbose: -v --verbose "Log all requests verbosely")
(@arg address: -a --address +required +takes_value "The IP address and port to bind on")
)
).get_matches();
if let Some(ref matches) = matches.subcommand_matches("serve") {
let addr = matches.value_of("address").unwrap();
let server = HttpListener::new(Address::IpAddress(String::from(addr))).unwrap();
println!("Running server on {}", addr);
server.listen().unwrap();
}
}