MinedMap/examples/regiondump.rs
Matthias Schiffer 810a05ab36
Move nbtdump and regiondump commands to examples
Do not install the development utilities with minedmap
2023-08-21 13:21:18 +02:00

28 lines
597 B
Rust

//! Dumps data from a region data file in a human-readable format
#![warn(missing_docs)]
#![warn(clippy::missing_docs_in_private_items)]
use std::path::PathBuf;
use anyhow::Result;
use clap::Parser;
/// Dump a Minecraft NBT region file in a human-readable format
#[derive(Debug, Parser)]
#[command(version)]
struct Args {
/// Filename to dump
file: PathBuf,
}
fn main() -> Result<()> {
let args = Args::parse();
minedmap_nbt::region::from_file(args.file.as_path())?.foreach_chunk(
|coords, value: fastnbt::Value| {
println!("Chunk {:?}: {:#x?}", coords, value);
Ok(())
},
)
}