Skip to content

Commit

Permalink
Output a clear "No Logitech Litra devices found" message from `litra …
Browse files Browse the repository at this point in the history
…devices` when no devices are connected
  • Loading branch information
timrogers committed Oct 3, 2024
1 parent 29fc6a6 commit 42d3c2e
Showing 1 changed file with 32 additions and 27 deletions.
59 changes: 32 additions & 27 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -292,34 +292,39 @@ fn handle_devices_command(json: bool) -> CliResult {
);
Ok(())
} else {
for device_info in &litra_devices {
println!(
"- {} ({}): {} {}",
device_info.device_type,
device_info.serial_number,
get_is_on_text(device_info.is_on),
get_is_on_emoji(device_info.is_on)
);

println!(" - Brightness: {} lm", device_info.brightness_in_lumen);
println!(
" - Minimum: {} lm",
device_info.minimum_brightness_in_lumen
);
println!(
" - Maximum: {} lm",
device_info.maximum_brightness_in_lumen
);
println!(" - Temperature: {} K", device_info.temperature_in_kelvin);
println!(
" - Minimum: {} K",
device_info.minimum_temperature_in_kelvin
);
println!(
" - Maximum: {} K",
device_info.maximum_temperature_in_kelvin
);
if litra_devices.is_empty() {
println!("No Logitech Litra devices found");
} else {
for device_info in &litra_devices {
println!(
"- {} ({}): {} {}",
device_info.device_type,
device_info.serial_number,
get_is_on_text(device_info.is_on),
get_is_on_emoji(device_info.is_on)
);

println!(" - Brightness: {} lm", device_info.brightness_in_lumen);
println!(
" - Minimum: {} lm",
device_info.minimum_brightness_in_lumen
);
println!(
" - Maximum: {} lm",
device_info.maximum_brightness_in_lumen
);
println!(" - Temperature: {} K", device_info.temperature_in_kelvin);
println!(
" - Minimum: {} K",
device_info.minimum_temperature_in_kelvin
);
println!(
" - Maximum: {} K",
device_info.maximum_temperature_in_kelvin
);
}
}

Ok(())
}
}
Expand Down

0 comments on commit 42d3c2e

Please sign in to comment.