use anyhow;
use serialport::available_ports;

pub fn serial_enum() -> anyhow::Result<Vec<String>> {
    let ports = available_ports()
        .map_err(|e| anyhow::anyhow!("available_ports failed: {}", e))?
        .into_iter()
        .map(|info| info.port_name)
        .collect();
    Ok(ports)
}
