diff --git a/Cargo.toml b/Cargo.toml index d6a136c..5de8537 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -12,3 +12,4 @@ serde = { version = "1.0.197", features = ["derive"] } serde_json = "1.0.114" thiserror = "1.0.58" toml = "0.8.11" +uuid = { version = "1.8.0", features = ["v8"] } diff --git a/src/main.rs b/src/main.rs index 0fab3d2..2d63719 100644 --- a/src/main.rs +++ b/src/main.rs @@ -3,6 +3,7 @@ use std::fs; use thiserror::Error; use serde::Deserialize; use reqwest::blocking::Client; +use uuid::Uuid; #[derive(Deserialize, Debug)] @@ -53,6 +54,16 @@ impl Prusa { Ok(info) } + fn try_load_file(&self, _filepath: &str) -> Result { + todo!("implement try_load_file") + } + + fn try_print_file(&self, _id: &Uuid) -> Result<(), Error> { + todo!("implement try_print_file") + } + + + // TODO: poorly named, should be something else so as not to confuse with print operations fn print_info(&self) -> Result<(), Error> { let info = self.get_info()?; println!("\n--------------------"); @@ -76,6 +87,13 @@ struct Cli { #[derive(Subcommand)] enum Command { Info, + Load { + #[arg(short, long)] + filepath: String, + }, + Print { + file_id: Uuid, + }, } #[derive(Deserialize, Debug)] @@ -113,6 +131,12 @@ fn main() -> Result<(), Error> { let prusa = Prusa::new(&config.printer.api_key, &config.printer.ip_addr); match cli.command { Command::Info => prusa.print_info()?, + // Should generate UUID for the filename: + Command::Load {filepath} => { + let uuid = prusa.try_load_file(&filepath)?; + println!("Loaded as UUID:\n{uuid}"); + }, + Command::Print {file_id} => prusa.try_print_file(&file_id)?, } } _ => println!("Unrecognized printer type")