39 lines
828 B
Rust
39 lines
828 B
Rust
|
|
//! Tauri commands for profile switching.
|
||
|
|
|
||
|
|
use serde::Serialize;
|
||
|
|
|
||
|
|
#[derive(Serialize)]
|
||
|
|
pub struct ProfileInfo {
|
||
|
|
pub name: String,
|
||
|
|
pub description: String,
|
||
|
|
pub icon: String,
|
||
|
|
pub greeting: String,
|
||
|
|
}
|
||
|
|
|
||
|
|
#[tauri::command]
|
||
|
|
pub fn profile_list() -> Vec<String> {
|
||
|
|
jarvis_core::profiles::list()
|
||
|
|
}
|
||
|
|
|
||
|
|
#[tauri::command]
|
||
|
|
pub fn profile_active() -> ProfileInfo {
|
||
|
|
let p = jarvis_core::profiles::active();
|
||
|
|
ProfileInfo {
|
||
|
|
name: p.name,
|
||
|
|
description: p.description,
|
||
|
|
icon: p.icon,
|
||
|
|
greeting: p.greeting,
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
#[tauri::command]
|
||
|
|
pub fn profile_set(name: String) -> Result<ProfileInfo, String> {
|
||
|
|
let p = jarvis_core::profiles::set_active(&name)?;
|
||
|
|
Ok(ProfileInfo {
|
||
|
|
name: p.name,
|
||
|
|
description: p.description,
|
||
|
|
icon: p.icon,
|
||
|
|
greeting: p.greeting,
|
||
|
|
})
|
||
|
|
}
|