Print help by default

This commit is contained in:
Tangent 128 2018-04-11 01:50:18 -04:00
parent 7563c3ef46
commit 97359801c2
2 changed files with 12 additions and 7 deletions

View File

@ -109,7 +109,7 @@ impl Service for RelayServer {
}
}
pub fn args() -> App<'static, 'static> {
pub fn options() -> App<'static, 'static> {
SubCommand::with_name("relay")
.about("Hosts an HTTP-based relay server")
.arg(Arg::with_name("listen")

View File

@ -8,17 +8,22 @@ mod commands;
use clap::{App, AppSettings};
use commands::{relay};
fn main() {
let args = App::new("webmetro")
fn options() -> App<'static, 'static> {
App::new("webmetro")
.version(crate_version!())
.about("Utilities for broadcasting & relaying live WebM video/audio streams")
.setting(AppSettings::SubcommandRequired)
.setting(AppSettings::VersionlessSubcommands)
.subcommand(relay::args())
.get_matches();
.subcommand(relay::options())
}
fn main() {
let args = options().get_matches();
match args.subcommand() {
("relay", Some(sub_args)) => relay::run(sub_args),
_ => {}
_ => {
options().print_help().unwrap();
println!("")
}
}
}