diff --git a/src/main.rs b/src/main.rs index 1693d3d..a7b0798 100644 --- a/src/main.rs +++ b/src/main.rs @@ -4,13 +4,16 @@ use std::time::Duration; #[derive(Parser, Debug)] #[command(author, version, about, long_about = None)] struct Args { - #[arg(short, long)] mode: String, + #[arg(short, long)] + port: Option, } fn main() { let args = Args::parse(); - let mut port = serialport::new("/dev/heliox", 115_200) + let default_address = "/dev/heliox".to_string(); + let address = args.port.unwrap_or(default_address); + let mut port = serialport::new(address, 115_200) .timeout(Duration::from_millis(10)) .open() .expect("Failed to open port");