diff --git a/src/commands/inspect.rs b/src/commands/inspect.rs new file mode 100644 index 0000000..a13a0da --- /dev/null +++ b/src/commands/inspect.rs @@ -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(()) +} diff --git a/src/commands/mod.rs b/src/commands/mod.rs index ca81e06..e66e863 100644 --- a/src/commands/mod.rs +++ b/src/commands/mod.rs @@ -1,2 +1,3 @@ +pub mod inspect; pub mod list; pub mod toggle;