finish up gpu stuff
This commit is contained in:
parent
284cf2608b
commit
3c993ee756
|
@ -112,15 +112,15 @@ pub fn get_cpu() -> HashMap<String, u16> {
|
|||
parsed
|
||||
}
|
||||
|
||||
pub fn get_gpu() {
|
||||
pub fn get_gpu() -> Vec<String> {
|
||||
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::<Vec<&str>>()[2].trim())
|
||||
vga.push(line.split(":").collect::<Vec<&str>>()[2].trim().to_string())
|
||||
}
|
||||
}
|
||||
|
||||
println!("{:?}", vga);
|
||||
vga
|
||||
}
|
||||
|
|
|
@ -23,8 +23,11 @@ fn main() {
|
|||
.collect::<Vec<String>>()
|
||||
.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);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue