mindustry logic execution, map- and schematic- parsing and rendering
Diffstat (limited to 'src/exe/print.rs')
| -rw-r--r-- | src/exe/print.rs | 64 |
1 files changed, 0 insertions, 64 deletions
diff --git a/src/exe/print.rs b/src/exe/print.rs deleted file mode 100644 index 25af8a4..0000000 --- a/src/exe/print.rs +++ /dev/null @@ -1,64 +0,0 @@ -use std::env::Args; - -use mindus::build_registry; -use mindus::{Schematic, SchematicSerializer}; - -use crate::print_err; - -pub fn main(args: Args) { - let reg = build_registry(); - let mut ss = SchematicSerializer(®); - let mut first = true; - let mut need_space = false; - // process schematics from command line - for curr in args { - match ss.deserialize_base64(&curr) { - Ok(s) => { - if !first || need_space { - println!(); - } - first = false; - need_space = true; - println!("Schematic: {curr}"); - print_schematic(&s); - } - // continue processing literals & maybe interactive mode - Err(e) => { - if need_space { - println!(); - } - first = false; - need_space = false; - print_err!(e, "Could not read schematic"); - } - } - } -} - -pub fn print_schematic(s: &Schematic) { - if let Some(name) = s.tags.get("name") { - if !name.is_empty() { - println!("Name: {name}"); - } - } - if let Some(desc) = s.tags.get("description") { - if !desc.is_empty() { - println!("Desc: {desc}"); - } - } - if let Some(labels) = s.tags.get("labels") { - if !labels.is_empty() && labels != "[]" { - println!("Tags: {:?}", labels); - } - } - let (cost, sandbox) = s.compute_total_cost(); - if !cost.is_empty() { - println!( - "Build cost: {cost}{}", - if sandbox { " (Sandbox only)" } else { "" } - ); - } else if sandbox { - println!("Can only be built in the Sandbox"); - } - println!("\n{s}"); -} |