webmetro/src/main.rs

53 lines
1.3 KiB
Rust
Raw Normal View History

extern crate bytes;
2018-04-11 05:39:28 +00:00
#[macro_use] extern crate clap;
extern crate futures;
2018-09-18 06:15:02 +00:00
extern crate http;
extern crate hyper;
extern crate tokio;
2018-09-21 00:58:51 +00:00
extern crate tokio_codec;
extern crate tokio_io;
#[macro_use] extern crate warp;
extern crate weak_table;
2018-04-11 05:39:28 +00:00
extern crate webmetro;
mod commands;
use clap::{App, AppSettings};
2018-12-22 20:03:19 +00:00
use crate::commands::{
relay,
2018-04-12 06:03:46 +00:00
filter,
2018-04-15 05:43:23 +00:00
send,
dump
};
2018-04-11 05:50:18 +00:00
fn options() -> App<'static, 'static> {
App::new("webmetro")
.version(crate_version!())
.about("Utilities for broadcasting & relaying live WebM video/audio streams")
2018-04-15 05:43:23 +00:00
.setting(AppSettings::DisableHelpSubcommand)
.setting(AppSettings::VersionlessSubcommands)
2018-04-11 05:50:18 +00:00
.subcommand(relay::options())
2018-04-12 06:03:46 +00:00
.subcommand(filter::options())
2018-04-15 05:43:23 +00:00
.subcommand(send::options())
.subcommand(dump::options())
2018-04-11 05:50:18 +00:00
}
fn main() {
let args = options().get_matches();
match args.subcommand() {
("filter", Some(sub_args)) => filter::run(sub_args),
("relay", Some(sub_args)) => relay::run(sub_args),
("send", Some(sub_args)) => send::run(sub_args),
("dump", Some(sub_args)) => dump::run(sub_args),
_ => {
2018-04-11 05:50:18 +00:00
options().print_help().unwrap();
2018-04-11 23:45:02 +00:00
println!("");
Ok(())
}
}.unwrap_or_else(|err| {
eprintln!("Error: {}", err);
});
}