factorio_blueprint/examples/decode_blueprint.rs
2023-12-06 21:25:03 +01:00

24 lines
505 B
Rust

use clap::Parser;
use factorio_blueprint::blueprint;
use std::path::PathBuf;
#[derive(Debug, Parser)]
struct Args {
blueprint: PathBuf,
}
fn main() {
let args = Args::parse();
let s = std::fs::read_to_string(args.blueprint).unwrap();
let raw = blueprint::decode(s.trim_end());
// println!("{}", &raw);
let bp = serde_json::from_str::<blueprint::structs::BlueprintString>(&raw).unwrap();
dbg!(&bp);
// let reencode = encode(&raw);
// println!("{}", &reencode);
}