//! `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 //! //! Argument parsing is by hand. A derive-macro dependency would cost more to //! compile than it saves to read at this size. use std::collections::BTreeSet; use std::path::{Path, PathBuf}; use std::process::ExitCode; use helm_core::{Catalogue, ComputedStats, Provenance}; use helm_db::Inputs; use helm_unitfile::mekset::Via; 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 } } } fn usage() { eprintln!( "helm - a queryable database of MegaMek's unit library USAGE helm build --megamek --out [--bridge-dir ] helm stats helm bv-report --megamek --bridge-dir helm art --megamek [--out ] helm index --megamek --bridge-dir --out [--helm-version ] helm force --megamek --bridge-dir helm check --megamek --bridge-dir helm repairs --megamek --bridge-dir helm wear --to --megamek --bridge-dir BUILD --megamek A MegaMek install. Reads data/mekfiles/unit_files.zip, or the loose .mtf and .blk files if the zip is absent. --out Where to write the SQLite database. --bridge-dir Directory holding units.jsonl and equipment.jsonl from the Java bridge. Without it the database is built from the unit files alone and the computed columns - battle value, cost, Alpha Strike - are null. --megamek-version Recorded in the meta table. Read from the install's docs/history.txt when not given. BV-REPORT How helm-bv's battle values compare with MegaMek's own, design by design. Needs both: the library to compute from, and the bridge dump to check against. Exits non-zero while anything still disagrees. --unit Print one design's working beside MegaMek's instead of the whole report. Matches on any part of the name. --clusters Group the designs that still disagree by what they have in common, worst first. What to fix next, rather than which single design is furthest out. --label