Add very basic inspect

This commit is contained in:
Daan Boerlage 2022-04-09 23:14:05 +02:00
parent 35111a0d80
commit cdfb24c487
Signed by: daan
GPG key ID: FCE070E1E4956606
2 changed files with 22 additions and 0 deletions

21
src/commands/inspect.rs Normal file
View file

@ -0,0 +1,21 @@
use crate::api;
use crate::config::Config;
use eyre::Result;
pub async fn exec(config: Config, id: &String) -> Result<()> {
let lights = api::lights::all(config).await?;
if let Some(light) = lights.into_iter().find(|x| x.id == *id) {
println!(
r#"
=== {} ===
Mode: {}
"#,
light.metadata.name, light.mode
)
} else {
println!("Light not found")
}
Ok(())
}

View file

@ -1,2 +1,3 @@
pub mod inspect;
pub mod list; pub mod list;
pub mod toggle; pub mod toggle;