Skip to main content

Mountain/IPC/StatusReporter/
mountain_get_service_info.rs

1#![allow(non_snake_case)]
2
3//! `mountain_get_service_info` Tauri command - look up one
4//! service by name in the registry.
5
6use tauri::Manager;
7
8use crate::{
9	IPC::StatusReporter::{Reporter::Struct as Reporter, ServiceInfo::Struct as ServiceInfo},
10	dev_log,
11};
12
13#[tauri::command]
14pub async fn mountain_get_service_info(
15	app_handle:tauri::AppHandle,
16
17	service_name:String,
18) -> Result<Option<ServiceInfo>, String> {
19	dev_log!("lifecycle", "Tauri command: get_service_info");
20
21	if let Some(reporter) = app_handle.try_state::<Reporter>() {
22		reporter.get_service_info(&service_name).await
23	} else {
24		Err("StatusReporter not found in application state".to_string())
25	}
26}