use serde::Serialize;
use serde_json::Value;
use tauri::{
plugin::{Builder, TauriPlugin},
Runtime,
};
#[cfg(target_os = "macos")]
mod mouse_nav;
#[derive(Debug, Clone, Serialize)]
pub struct CliResult {
pub success: bool,
#[serde(skip_serializing_if = "Option::is_none")]
pub data: Option<Value>,
#[serde(skip_serializing_if = "Option::is_none")]
pub error: Option<String>,
}
impl CliResult {
pub fn ok(data: Value) -> Self {
Self { success: true, data: Some(data), error: None }
}
pub fn err(message: impl Into<String>) -> Self {
Self { success: false, data: None, error: Some(message.into()) }
}
}
pub fn init<R: Runtime>() -> TauriPlugin<R> {
Builder::new("picoframe")
.setup(|_app, _api| {
#[cfg(target_os = "macos")]
mouse_nav::install(_app.clone());
Ok(())
})
.build()
}