diff --git a/.gitignore b/.gitignore old mode 100644 new mode 100755 diff --git a/Cargo.toml b/Cargo.toml old mode 100644 new mode 100755 diff --git a/LICENSE b/LICENSE old mode 100644 new mode 100755 diff --git a/README.md b/README.md old mode 100644 new mode 100755 diff --git a/src/lib.rs b/src/lib.rs old mode 100644 new mode 100755 index 137c5db..29c64c7 --- a/src/lib.rs +++ b/src/lib.rs @@ -112,15 +112,15 @@ pub fn get_cpu() -> HashMap { parsed } -pub fn get_gpu() { +pub fn get_gpu() -> Vec { let binding = std::process::Command::new("lspci").output().expect("lspci failed"); let lspci = String::from_utf8_lossy(&binding.stdout).to_string(); let mut vga = vec![]; for line in lspci.lines() { if line.contains("VGA") { - vga.push(line.split(":").collect::>()[2].trim()) + vga.push(line.split(":").collect::>()[2].trim().to_string()) } } - println!("{:?}", vga); + vga } diff --git a/src/main.rs b/src/main.rs old mode 100644 new mode 100755 index b008d55..a422b74 --- a/src/main.rs +++ b/src/main.rs @@ -23,8 +23,11 @@ fn main() { .collect::>() .join(", "); println!( - "CPU Name{}: {}", + "CPU{}: {}", if cpus.len() == 1 { "" } else { "s" }, cpu_name ); + + let gpu_name = gpus.join(", "); + println!("GPU{}: {}", if gpus.len() == 1 {""} else {"s"}, gpu_name); }