//! `helm` - build and inspect the unit database. //! //! helm build --megamek --out helm.sqlite [--bridge-dir ] //! helm stats //! helm bv-report --megamek --bridge-dir //! helm art --megamek [--out ] //! helm index --megamek --bridge-dir --out units.json //! helm catalogue --bridge-dir --out //! helm force --megamek --bridge-dir //! helm check --megamek --bridge-dir //! helm repairs --megamek --bridge-dir //! helm wear --to --megamek --bridge-dir //! helm wire-check --megamek --bridge-dir --out //! //! Argument parsing is by hand. A derive-macro dependency would cost more to //! compile than it saves to read at this size. use std::process::ExitCode; mod build; mod force; mod inputs; mod options; mod report; mod wire; use build::{art, build, catalogue, index, stats}; use force::{check, force, repairs, wear}; use options::usage; use report::bv_report; use wire::wire_check; fn main() -> ExitCode { let args: Vec = std::env::args().skip(1).collect(); let result = match args.first().map(String::as_str) { Some("build") => build(&args[1..]), Some("stats") => stats(&args[1..]), Some("bv-report") => bv_report(&args[1..]), Some("art") => art(&args[1..]), Some("index") => index(&args[1..]), Some("catalogue") => catalogue(&args[1..]), Some("wire-check") => wire_check(&args[1..]), Some("force") => force(&args[1..]), Some("check") => check(&args[1..]), Some("repairs") => repairs(&args[1..]), Some("wear") => wear(&args[1..]), Some("-h") | Some("--help") | Some("help") | None => { usage(); return ExitCode::SUCCESS; } Some(other) => Err(format!("unknown command: {other}")), }; match result { Ok(()) => ExitCode::SUCCESS, Err(e) => { eprintln!("helm: {e}"); ExitCode::FAILURE } } }