Change position format for blueprint

This commit is contained in:
hal8174 2025-01-22 23:04:13 +01:00
parent e969ba848b
commit fec7dd70db
6 changed files with 115 additions and 79 deletions

View file

@ -5,6 +5,8 @@ use factorio_core::beltoptions::{Beltspeed, Belttype};
#[derive(Parser)]
struct Args {
#[arg(short, long)]
json: bool,
#[command(subcommand)]
command: Command,
}
@ -13,12 +15,13 @@ struct Args {
enum Command {
Book,
Single {
#[arg(long)]
load: bool,
locomotives: usize,
length: usize,
outputs: usize,
beltspeed: Beltspeed,
#[arg(default_value = "full")]
#[arg(short, long, default_value = "full")]
belttype: Belttype,
},
}
@ -109,6 +112,9 @@ fn main() {
.build(),
);
if args.json {
println!("{}", serde_json::to_string_pretty(&b).unwrap());
}
println!("{}", encode(&serde_json::to_string(&b).unwrap()));
}
Command::Single {
@ -124,7 +130,9 @@ fn main() {
.to_blueprint(),
);
// println!("{}", serde_json::to_string_pretty(&b).unwrap());
if args.json {
println!("{}", serde_json::to_string_pretty(&b).unwrap());
}
println!("{}", encode(&serde_json::to_string(&b).unwrap()));
}