feat: 🎸 Applejack name fix

This commit is contained in:
Atsukoro1 2022-12-05 14:39:44 +01:00
parent 6e9bad8e59
commit f93ea3d3c0
4 changed files with 34 additions and 18 deletions

View file

@ -7,7 +7,7 @@ pub struct Pony {
pub fn get_pony(name: String) -> Option<Pony> {
let ponies: HashMap<&str, Vec<u8>> = 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()),

View file

@ -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,

View file

@ -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")

View file

@ -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::<String>()
.trim().to_string()
}
#[cfg(target_os = "windows")]