Fixed GPUs displaying all on one line
This commit is contained in:
parent
a418ba1bac
commit
02fd780267
2
Cargo.lock
generated
2
Cargo.lock
generated
@ -333,7 +333,7 @@ checksum = "6f61fba1741ea2b3d6a1e3178721804bb716a68a6aeba1149b5d52e3d464ea66"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "oxidefetch"
|
name = "oxidefetch"
|
||||||
version = "1.4.3"
|
version = "1.4.4"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"byte-unit",
|
"byte-unit",
|
||||||
"chrono",
|
"chrono",
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "oxidefetch"
|
name = "oxidefetch"
|
||||||
description = "A fast, cross platform Fetch program for your terminal"
|
description = "A fast, cross platform Fetch program for your terminal"
|
||||||
version = "1.4.3"
|
version = "1.4.4"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
authors = [ "NamedNeon", "shibedrill" ]
|
authors = [ "NamedNeon", "shibedrill" ]
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
# oxidefetch 1.4.3
|
# oxidefetch 1.4.4
|
||||||
Fully cross platform Neofetch clone written in Rust. Up to 25 times faster than Neofetch!
|
Fully cross platform Neofetch clone written in Rust. Up to 25 times faster than Neofetch!
|
||||||
|
|
||||||

|

|
||||||
@ -97,6 +97,7 @@ No weird quirks to report at this time.
|
|||||||
**1.4.1:** Changed terminal color to match shell color.
|
**1.4.1:** Changed terminal color to match shell color.
|
||||||
**1.4.2:** Updated colors and logos of a few distros. They will now display correctly.
|
**1.4.2:** Updated colors and logos of a few distros. They will now display correctly.
|
||||||
**1.4.3:** Removed newline print before information. This should be up to the user to print, using their shell profile.
|
**1.4.3:** Removed newline print before information. This should be up to the user to print, using their shell profile.
|
||||||
|
**1.4.4:** Fixed an issue where GPUs would all print on one line.
|
||||||
|
|
||||||
### License
|
### License
|
||||||
This software is covered by the MIT license. See license.txt for details.
|
This software is covered by the MIT license. See license.txt for details.
|
||||||
|
14
src/main.rs
14
src/main.rs
@ -166,7 +166,7 @@ impl Information {
|
|||||||
gpu_info_as_string
|
gpu_info_as_string
|
||||||
.unwrap() // TODO: Please figure out a way to get rid of this unwrap() call.
|
.unwrap() // TODO: Please figure out a way to get rid of this unwrap() call.
|
||||||
// I feel like I did so well avoiding unwrap calls everywhere except for here.
|
// I feel like I did so well avoiding unwrap calls everywhere except for here.
|
||||||
.split("\n")
|
.lines()
|
||||||
.collect::<Vec<&str>>()[1],
|
.collect::<Vec<&str>>()[1],
|
||||||
)])
|
)])
|
||||||
}
|
}
|
||||||
@ -177,7 +177,7 @@ impl Information {
|
|||||||
// On *nix, hopefully, "lspci | grep VGA | awk -F 'VGA compatible controller: ' '{print $2}'" gives us our GPU name.
|
// On *nix, hopefully, "lspci | grep VGA | awk -F 'VGA compatible controller: ' '{print $2}'" gives us our GPU name.
|
||||||
// Since pipes can't be processed as arguments, we need to do all this in a subshell under SH.
|
// Since pipes can't be processed as arguments, we need to do all this in a subshell under SH.
|
||||||
let command_output = std::process::Command::new("sh")
|
let command_output = std::process::Command::new("sh")
|
||||||
.args(["-c", "lspci | grep VGA | awk -F 'VGA compatible controller: ' '{print $2}'"])
|
.args(["-c", "lspci | grep VGA | awk -F'VGA compatible controller: ' '{print $2}'"])
|
||||||
.output();
|
.output();
|
||||||
|
|
||||||
// Check if running the command resulted in an error. If not, convert to a vector.
|
// Check if running the command resulted in an error. If not, convert to a vector.
|
||||||
@ -191,11 +191,11 @@ impl Information {
|
|||||||
match output_string.as_ref() {
|
match output_string.as_ref() {
|
||||||
"" => None,
|
"" => None,
|
||||||
_ => {
|
_ => {
|
||||||
Some(vec![
|
let mut gpu_vec = vec!();
|
||||||
output_string
|
for s in output_string.trim().split('\n') {
|
||||||
.split("\n")
|
gpu_vec.push(s.to_string());
|
||||||
.collect()
|
}
|
||||||
])
|
Some(gpu_vec)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user