diff --git a/src/helpers/ponies.rs b/src/helpers/ponies.rs index 7192957..256ae9d 100644 --- a/src/helpers/ponies.rs +++ b/src/helpers/ponies.rs @@ -7,7 +7,7 @@ pub struct Pony { pub fn get_pony(name: String) -> Option { let ponies: HashMap<&str, Vec> = HashMap::from([ ("applejack_hat_large", include_bytes!("../../ponies/applejack_hat_large.txt").to_vec()), - ("applejack_hat_large", include_bytes!("../../ponies/applejack_large.txt").to_vec()), + ("applejack_large", include_bytes!("../../ponies/applejack_large.txt").to_vec()), ("celestia_large", include_bytes!("../../ponies/celestia_large.txt").to_vec()), ("fluttershy_large", include_bytes!("../../ponies/fluttershy_large.txt").to_vec()), ("fluttershy", include_bytes!("../../ponies/fluttershy.txt").to_vec()), diff --git a/src/main.rs b/src/main.rs index a13babc..c44ee10 100644 --- a/src/main.rs +++ b/src/main.rs @@ -46,7 +46,7 @@ const ACTIONS: [Action; 13] = [ Action { action_type: ActionType::Details, name: Some("Kernel"), - func: Some(system::host::get_distro), + func: Some(system::host::get_kernel), }, Action { action_type: ActionType::Details, diff --git a/src/system/host.rs b/src/system/host.rs index c3be343..e039e1b 100644 --- a/src/system/host.rs +++ b/src/system/host.rs @@ -131,6 +131,29 @@ pub fn get_hostname() -> String { .to_string() } +pub fn get_kernel() -> String { + let mut kernel = String::new(); + + #[cfg(target_os = "windows")] + let output = Command::new("ver") + .output() + .expect("Failed to execute process"); + + #[cfg(target_os = "linux")] + let output = Command::new("uname") + .args(&["-r"]) + .output() + .expect("Failed to execute process"); + + let output = String::from_utf8_lossy(&output.stdout); + + for line in output.lines() { + kernel = line.to_string(); + } + + kernel +} + #[cfg(target_os = "linux")] pub fn get_user() -> String { Command::new("whoami") diff --git a/src/system/specs.rs b/src/system/specs.rs index a24320e..224b105 100644 --- a/src/system/specs.rs +++ b/src/system/specs.rs @@ -1,6 +1,7 @@ #[cfg(target_os = "linux")] use { crate::helpers::file::file_open, + std::process::Command, std::fs::File, std::io::Read, std::rc::Rc, @@ -121,23 +122,15 @@ pub fn get_disk_usage() -> String { #[cfg(target_os = "linux")] pub fn get_arch() -> String { - use std::process::Command; - - let mut arch = String::new(); - - let command = Command::new("lscpu") + Command::new("uname") + .arg("-m") .output() - .expect("Failed to execute process"); - - let command = String::from_utf8_lossy(&command.stdout); - - for line in command.lines() { - if line.contains("Architecture") { - arch = line.split_whitespace().last().unwrap().to_string(); - } - } - - arch + .expect("Failed to execute process") + .stdout + .iter() + .map(|&c| c as char) + .collect::() + .trim().to_string() } #[cfg(target_os = "windows")]