29 lines
817 B
Rust
29 lines
817 B
Rust
|
|
//! CLI: build reference.db from Scryfall bulk data.
|
||
|
|
//!
|
||
|
|
//! Usage: `mtgc-ingest [path/to/reference.db]` (defaults to ./reference.db)
|
||
|
|
|
||
|
|
use std::path::PathBuf;
|
||
|
|
use std::process::ExitCode;
|
||
|
|
|
||
|
|
fn main() -> ExitCode {
|
||
|
|
let dest = std::env::args()
|
||
|
|
.nth(1)
|
||
|
|
.map(PathBuf::from)
|
||
|
|
.unwrap_or_else(|| PathBuf::from("reference.db"));
|
||
|
|
|
||
|
|
eprintln!("Building reference db at {}", dest.display());
|
||
|
|
match mtgc_core::ingest::build_reference_db(&dest, |msg| eprintln!(" {msg}")) {
|
||
|
|
Ok(stats) => {
|
||
|
|
eprintln!(
|
||
|
|
"Done: {} oracle cards, {} printings.",
|
||
|
|
stats.oracle_cards, stats.printings
|
||
|
|
);
|
||
|
|
ExitCode::SUCCESS
|
||
|
|
}
|
||
|
|
Err(e) => {
|
||
|
|
eprintln!("Ingest failed: {e}");
|
||
|
|
ExitCode::FAILURE
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|