diff --git a/src/main.rs b/src/main.rs index 5afd038..6c0c6ca 100644 --- a/src/main.rs +++ b/src/main.rs @@ -46,7 +46,7 @@ impl Default for DeviceCommands { #[command(arg_required_else_help = true)] enum Commands { /// List available serial devices - ListDevices, + List, /// Device Device { /// Path to the serial device @@ -76,12 +76,13 @@ async fn main() -> Result<()>{ let command = &cli.command.context("No command provided")?.clone(); match &command { - Commands::ListDevices => { + Commands::List => { println!("{}", tokio_serial::available_ports() .context("Failed to list available ports")? .iter() .map(|serialport| serialport.port_name.clone()) - .fold(String::new(), |a, b| a + &b + &String::from("\n"))); + .collect::>() + .join("\n")); }, Commands::Device {path, baud_rate, device_command} => { match &device_command.clone().unwrap_or_default() {