Add very basic inspect
This commit is contained in:
parent
35111a0d80
commit
cdfb24c487
2 changed files with 22 additions and 0 deletions
21
src/commands/inspect.rs
Normal file
21
src/commands/inspect.rs
Normal 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(())
|
||||
}
|
|
@ -1,2 +1,3 @@
|
|||
pub mod inspect;
|
||||
pub mod list;
|
||||
pub mod toggle;
|
||||
|
|
Loading…
Reference in a new issue