also show product info for single port confirm

This commit is contained in:
Robin Appelman
2021-11-18 23:38:03 +01:00
parent 55324400ff
commit ddb8fd3953

View File

@@ -98,7 +98,13 @@ fn select_serial_port(ports: Vec<SerialPortInfo>, devices: &[UsbDevice]) -> Resu
if device_matches(port_info)
|| Confirm::with_theme(&ColorfulTheme::default())
.with_prompt(format!("Use serial port '{}'?", port_name))
.with_prompt({
if let Some(product) = &port_info.product {
format!("Use serial port '{}' - {}?", port_name, product)
} else {
format!("Use serial port '{}'?", port_name)
}
})
.interact_opt()?
.ok_or(Error::Canceled)?
{