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") SubCommand::with_name("relay")
.about("Hosts an HTTP-based relay server") .about("Hosts an HTTP-based relay server")
.arg(Arg::with_name("listen") .arg(Arg::with_name("listen")

View file

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