add print-immediately flag to load command

This commit is contained in:
sigil-03 2024-04-30 09:00:53 -06:00
parent f70e145b8a
commit 604f2a641b
2 changed files with 7 additions and 2 deletions

View file

@ -12,4 +12,4 @@ serde = { version = "1.0.197", features = ["derive"] }
serde_json = "1.0.114" serde_json = "1.0.114"
thiserror = "1.0.58" thiserror = "1.0.58"
toml = "0.8.11" toml = "0.8.11"
uuid = { version = "1.8.0", features = ["v8"] } uuid = { version = "1.8.0", features = ["v4"] }

View file

@ -230,6 +230,8 @@ enum Command {
Info, Info,
Load { Load {
filepath: String, filepath: String,
#[arg(long)]
print_immediately: bool,
}, },
Print { Print {
file_id: Uuid, file_id: Uuid,
@ -275,8 +277,11 @@ fn main() -> Result<(), Error> {
prusa.print_storage_info()?; prusa.print_storage_info()?;
}, },
// Should generate UUID for the filename: // Should generate UUID for the filename:
Command::Load {filepath} => { Command::Load {filepath, print_immediately} => {
let uuid = prusa.try_load_file(&filepath)?; let uuid = prusa.try_load_file(&filepath)?;
if print_immediately {
prusa.try_print_file(&uuid)?;
}
println!("Loaded as UUID:\n{uuid}"); println!("Loaded as UUID:\n{uuid}");
}, },
Command::Print {file_id} => prusa.try_print_file(&file_id)?, Command::Print {file_id} => prusa.try_print_file(&file_id)?,