mirror of
https://github.com/Atsukoro1/ponyfetch.git
synced 2025-02-18 18:34:24 +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> {
|
pub fn get_pony(name: String) -> Option<Pony> {
|
||||||
let ponies: HashMap<&str, Vec<u8>> = HashMap::from([
|
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_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()),
|
("celestia_large", include_bytes!("../../ponies/celestia_large.txt").to_vec()),
|
||||||
("fluttershy_large", include_bytes!("../../ponies/fluttershy_large.txt").to_vec()),
|
("fluttershy_large", include_bytes!("../../ponies/fluttershy_large.txt").to_vec()),
|
||||||
("fluttershy", include_bytes!("../../ponies/fluttershy.txt").to_vec()),
|
("fluttershy", include_bytes!("../../ponies/fluttershy.txt").to_vec()),
|
||||||
|
|
|
@ -46,7 +46,7 @@ const ACTIONS: [Action; 13] = [
|
||||||
Action {
|
Action {
|
||||||
action_type: ActionType::Details,
|
action_type: ActionType::Details,
|
||||||
name: Some("Kernel"),
|
name: Some("Kernel"),
|
||||||
func: Some(system::host::get_distro),
|
func: Some(system::host::get_kernel),
|
||||||
},
|
},
|
||||||
Action {
|
Action {
|
||||||
action_type: ActionType::Details,
|
action_type: ActionType::Details,
|
||||||
|
|
|
@ -131,6 +131,29 @@ pub fn get_hostname() -> String {
|
||||||
.to_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")]
|
#[cfg(target_os = "linux")]
|
||||||
pub fn get_user() -> String {
|
pub fn get_user() -> String {
|
||||||
Command::new("whoami")
|
Command::new("whoami")
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
#[cfg(target_os = "linux")]
|
#[cfg(target_os = "linux")]
|
||||||
use {
|
use {
|
||||||
crate::helpers::file::file_open,
|
crate::helpers::file::file_open,
|
||||||
|
std::process::Command,
|
||||||
std::fs::File,
|
std::fs::File,
|
||||||
std::io::Read,
|
std::io::Read,
|
||||||
std::rc::Rc,
|
std::rc::Rc,
|
||||||
|
@ -121,23 +122,15 @@ pub fn get_disk_usage() -> String {
|
||||||
|
|
||||||
#[cfg(target_os = "linux")]
|
#[cfg(target_os = "linux")]
|
||||||
pub fn get_arch() -> String {
|
pub fn get_arch() -> String {
|
||||||
use std::process::Command;
|
Command::new("uname")
|
||||||
|
.arg("-m")
|
||||||
let mut arch = String::new();
|
|
||||||
|
|
||||||
let command = Command::new("lscpu")
|
|
||||||
.output()
|
.output()
|
||||||
.expect("Failed to execute process");
|
.expect("Failed to execute process")
|
||||||
|
.stdout
|
||||||
let command = String::from_utf8_lossy(&command.stdout);
|
.iter()
|
||||||
|
.map(|&c| c as char)
|
||||||
for line in command.lines() {
|
.collect::<String>()
|
||||||
if line.contains("Architecture") {
|
.trim().to_string()
|
||||||
arch = line.split_whitespace().last().unwrap().to_string();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
arch
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(target_os = "windows")]
|
#[cfg(target_os = "windows")]
|
||||||
|
|
Loading…
Reference in a new issue