1use camino::Utf8Path;
4use serde::Serialize;
5
6#[derive(Debug, Clone, Serialize)]
7pub struct YuiVars {
8 pub os: String,
10 pub arch: String,
12 pub host: String,
14 pub user: String,
16 pub source: String,
18}
19
20impl YuiVars {
21 pub fn detect(source: &Utf8Path) -> Self {
22 Self {
23 os: std::env::consts::OS.to_string(),
24 arch: std::env::consts::ARCH.to_string(),
25 host: whoami::hostname().unwrap_or_else(|_| "unknown".to_string()),
26 user: whoami::username().unwrap_or_else(|_| "unknown".to_string()),
27 source: source.to_string(),
28 }
29 }
30}