mirror of
https://github.com/Atsukoro1/ponyfetch.git
synced 2025-02-18 18:34:24 +01:00
feat: 🎸 Linux cpu arch
This commit is contained in:
parent
4668c94bdf
commit
9e0f431026
2 changed files with 21 additions and 11 deletions
|
@ -112,8 +112,6 @@ const ACTIONS: [Action; 13] = [
|
||||||
fn main() {
|
fn main() {
|
||||||
let args: Args = Args::parse();
|
let args: Args = Args::parse();
|
||||||
|
|
||||||
println!("{}", system::specs::get_disk_usage());
|
|
||||||
|
|
||||||
let line_count = helpers::file::get_file_linecount(
|
let line_count = helpers::file::get_file_linecount(
|
||||||
&format!("{}{}.txt", helpers::paths::get_pony_path(), &args.pony)
|
&format!("{}{}.txt", helpers::paths::get_pony_path(), &args.pony)
|
||||||
);
|
);
|
||||||
|
|
|
@ -119,6 +119,27 @@ pub fn get_disk_usage() -> String {
|
||||||
disk
|
disk
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(target_os = "linux")]
|
||||||
|
pub fn get_arch() -> String {
|
||||||
|
use std::process::Command;
|
||||||
|
|
||||||
|
let mut arch = String::new();
|
||||||
|
|
||||||
|
let command = Command::new("lscpu")
|
||||||
|
.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
|
||||||
|
}
|
||||||
|
|
||||||
#[cfg(target_os = "windows")]
|
#[cfg(target_os = "windows")]
|
||||||
pub fn get_arch() -> String {
|
pub fn get_arch() -> String {
|
||||||
use std::process::Command;
|
use std::process::Command;
|
||||||
|
@ -202,15 +223,6 @@ fn eval_ram(line: String) -> u128 {
|
||||||
kbs / 1000
|
kbs / 1000
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(target_os = "linux")]
|
|
||||||
pub fn get_kernel() -> String {
|
|
||||||
let temp_buf: String = file_open("/proc/version");
|
|
||||||
|
|
||||||
temp_buf.split(" ")
|
|
||||||
.collect::<Vec<&str>>()[2]
|
|
||||||
.to_string()
|
|
||||||
}
|
|
||||||
|
|
||||||
#[cfg(target_os = "windows")]
|
#[cfg(target_os = "windows")]
|
||||||
pub fn get_gpu() -> String {
|
pub fn get_gpu() -> String {
|
||||||
use std::process::Command;
|
use std::process::Command;
|
||||||
|
|
Loading…
Reference in a new issue