Something went wrong. Try again.
Data management tools for playing BattleTech
Something went wrong. Try again.
Rust
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162//! `helm` - build and inspect the unit database.//!//! helm build --megamek <dir> --out helm.sqlite [--bridge-dir <dir>]//! helm stats <db>//! helm bv-report --megamek <dir> --bridge-dir <dir>//! helm art --megamek <dir> [--out <file>]//! helm index --megamek <dir> --bridge-dir <dir> --out units.json//! helm catalogue --bridge-dir <dir> --out <file>//! helm force <force.mul> --megamek <dir> --bridge-dir <dir>//! helm check <force.mul> --megamek <dir> --bridge-dir <dir>//! helm repairs <force.mul> --megamek <dir> --bridge-dir <dir>//! helm wear <design> --to <bv> --megamek <dir> --bridge-dir <dir>//! helm wire-check --megamek <dir> --bridge-dir <dir> --out <bundle>//!//! 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<String> = 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 } }}