use camino::Utf8Path;
use serde::Serialize;
#[derive(Debug, Clone, Serialize)]
pub struct YuiVars {
pub os: String,
pub arch: String,
pub host: String,
pub user: String,
pub source: String,
}
impl YuiVars {
pub fn detect(source: &Utf8Path) -> Self {
Self {
os: std::env::consts::OS.to_string(),
arch: std::env::consts::ARCH.to_string(),
host: whoami::hostname().unwrap_or_else(|_| "unknown".to_string()),
user: whoami::username().unwrap_or_else(|_| "unknown".to_string()),
source: source.to_string(),
}
}
}