#[macro_use]
extern crate clap;
extern crate serial_unit_testing;
use clap::{App, ArgMatches, AppSettings};
mod commands;
mod windows;
mod list;
mod send;
mod monitor;
mod check;
mod run;
mod verify;
mod version;
fn run(matches: ArgMatches) -> Result<(), String> {
match matches.subcommand() {
("send", Some(m)) => send::run(m),
("list", Some(m)) => list::run(m),
("monitor", Some(m)) => monitor::run(m),
("check", Some(m)) => check::run(m),
("run", Some(m)) => run::run(m),
("verify", Some(m)) => verify::run(m),
("version", Some(m)) => version::run(m),
_ => Ok(())
}
}
fn main() {
let matches = App::new("serial-unit-testing")
.setting(AppSettings::VersionlessSubcommands)
.setting(AppSettings::SubcommandRequiredElseHelp)
.version(crate_version!())
.version_short("v")
.about("Serial unit testing framework")
.subcommand(send::command())
.subcommand(list::command())
.subcommand(monitor::command())
.subcommand(check::command())
.subcommand(run::command())
.subcommand(verify::command())
.subcommand(version::command())
.get_matches();
if let Err(e) = run(matches) {
println!("{}", e);
return;
}
}