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
|
parsed
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn get_gpu() {
|
pub fn get_gpu() -> Vec<String> {
|
||||||
let binding = std::process::Command::new("lspci").output().expect("lspci failed");
|
let binding = std::process::Command::new("lspci").output().expect("lspci failed");
|
||||||
let lspci = String::from_utf8_lossy(&binding.stdout).to_string();
|
let lspci = String::from_utf8_lossy(&binding.stdout).to_string();
|
||||||
let mut vga = vec![];
|
let mut vga = vec![];
|
||||||
for line in lspci.lines() {
|
for line in lspci.lines() {
|
||||||
if line.contains("VGA") {
|
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>>()
|
.collect::<Vec<String>>()
|
||||||
.join(", ");
|
.join(", ");
|
||||||
println!(
|
println!(
|
||||||
"CPU Name{}: {}",
|
"CPU{}: {}",
|
||||||
if cpus.len() == 1 { "" } else { "s" },
|
if cpus.len() == 1 { "" } else { "s" },
|
||||||
cpu_name
|
cpu_name
|
||||||
);
|
);
|
||||||
|
|
||||||
|
let gpu_name = gpus.join(", ");
|
||||||
|
println!("GPU{}: {}", if gpus.len() == 1 {""} else {"s"}, gpu_name);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue