add architecture (fuck this) and kernel version detection
This commit is contained in:
parent
16f3dcce8e
commit
0da9c61362
16
src/lib.rs
16
src/lib.rs
|
@ -4,7 +4,7 @@ use dotenv_parser::parse_dotenv;
|
|||
pub fn get_os() -> String {
|
||||
let os_release = read_to_string("/etc/os-release").unwrap();
|
||||
let parsed = parse_dotenv(&os_release).unwrap();
|
||||
parsed.get("PRETTY_NAME").unwrap().clone()
|
||||
parsed.get("PRETTY_NAME").unwrap().clone().trim().to_string()
|
||||
}
|
||||
|
||||
pub fn get_cpu() {
|
||||
|
@ -13,3 +13,17 @@ pub fn get_cpu() {
|
|||
|
||||
println!("{}", &lscpu)
|
||||
}
|
||||
|
||||
pub fn get_arch() -> String {
|
||||
let binding = std::process::Command::new("uname").arg("-m").output().expect("uname failed");
|
||||
let arch = String::from_utf8_lossy(&binding.stdout);
|
||||
|
||||
arch.to_string().trim().to_string()
|
||||
}
|
||||
|
||||
pub fn get_kernel_ver() -> String {
|
||||
let binding = std::process::Command::new("uname").arg("-s").output().expect("uname failed");
|
||||
let ver = String::from_utf8_lossy(&binding.stdout);
|
||||
|
||||
ver.to_string().trim().to_string()
|
||||
}
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
use gayfetch::{get_os, get_cpu};
|
||||
use gayfetch::*;
|
||||
fn main() {
|
||||
let os = get_os();
|
||||
let cpu = get_cpu();
|
||||
let arch = get_arch();
|
||||
let kernel = get_kernel_ver();
|
||||
|
||||
println!("OS Name: {os}\nArchitecture: {arch}\nKernel Version: {kernel}");
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue