mirror of
https://github.com/Atsukoro1/ponyfetch.git
synced 2024-11-27 06:17:59 +01:00
feat: 🎸 Applejack name fix
This commit is contained in:
parent
6e9bad8e59
commit
f93ea3d3c0
4 changed files with 34 additions and 18 deletions
|
@ -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()),
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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")
|
||||
|
|
|
@ -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")]
|
||||
|
|
Loading…
Reference in a new issue