webmetro/src/main.rs

42 lines
1.1 KiB
Rust
Raw Normal View History

2018-04-11 05:39:28 +00:00
mod commands;
2018-12-22 20:07:38 +00:00
use clap::{App, AppSettings, crate_version};
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);
});
}