all GPUs should print on their own lines now
This commit is contained in:
parent
875cf9942a
commit
cdd145ff41
2
Cargo.lock
generated
2
Cargo.lock
generated
@ -333,7 +333,7 @@ checksum = "6f61fba1741ea2b3d6a1e3178721804bb716a68a6aeba1149b5d52e3d464ea66"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "oxidefetch"
|
name = "oxidefetch"
|
||||||
version = "1.2.1"
|
version = "1.2.2"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"byte-unit",
|
"byte-unit",
|
||||||
"chrono",
|
"chrono",
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "oxidefetch"
|
name = "oxidefetch"
|
||||||
version = "1.2.1"
|
version = "1.2.2"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
|
||||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
# oxidefetch 1.2.1
|
# oxidefetch 1.2.2
|
||||||
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!
|
||||||
|
|
||||||

|

|
||||||
@ -75,3 +75,4 @@ No weird quirks to report at this time.
|
|||||||
**1.1.2:** Replaced *nix dependency on ```bash``` with dependency on ```sh```.
|
**1.1.2:** Replaced *nix dependency on ```bash``` with dependency on ```sh```.
|
||||||
**1.2.0:** Allowed users to enable field titles as a compile-time feature. Tentative fix for GPU display issues on Linux.
|
**1.2.0:** Allowed users to enable field titles as a compile-time feature. Tentative fix for GPU display issues on Linux.
|
||||||
**1.2.1:** Stable fix for GPU display quirks.
|
**1.2.1:** Stable fix for GPU display quirks.
|
||||||
|
**1.2.2:** All GPUs should print in their own lines.
|
||||||
|
31
src/main.rs
31
src/main.rs
@ -38,7 +38,12 @@ fn main() {
|
|||||||
color_print("Uptime:\t", '', &Some(sys_info.uptime), "bright black");
|
color_print("Uptime:\t", '', &Some(sys_info.uptime), "bright black");
|
||||||
color_print("Shell:\t", '', &sys_info.shell, "bright magenta");
|
color_print("Shell:\t", '', &sys_info.shell, "bright magenta");
|
||||||
color_print("CPU:\t", '', &Some(sys_info.cpu), "green");
|
color_print("CPU:\t", '', &Some(sys_info.cpu), "green");
|
||||||
color_print("GPU:\t", '', &sys_info.gpu, "bright green");
|
if let Some(gpus) = sys_info.gpu {
|
||||||
|
for gpu in gpus {
|
||||||
|
color_print("GPU:\t", '', &Some(gpu), "bright green")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//color_print("GPU:\t", '', &sys_info.gpu, "bright green");
|
||||||
color_print("Memory:\t", '', &Some(sys_info.memory), "bright blue");
|
color_print("Memory:\t", '', &Some(sys_info.memory), "bright blue");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -69,7 +74,7 @@ struct InformationStruct {
|
|||||||
shell: Option<String>,
|
shell: Option<String>,
|
||||||
terminal: Option<String>,
|
terminal: Option<String>,
|
||||||
cpu: String,
|
cpu: String,
|
||||||
gpu: Option<String>,
|
gpu: Option<Vec<String>>,
|
||||||
memory: String,
|
memory: String,
|
||||||
icon: char,
|
icon: char,
|
||||||
color: String,
|
color: String,
|
||||||
@ -121,13 +126,13 @@ impl InformationStruct {
|
|||||||
match command_output {
|
match command_output {
|
||||||
Ok(gpu_info) => {
|
Ok(gpu_info) => {
|
||||||
let gpu_info_as_string = String::from_utf8(gpu_info.stdout);
|
let gpu_info_as_string = String::from_utf8(gpu_info.stdout);
|
||||||
Some(String::from(
|
Some(vec![String::from(
|
||||||
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")
|
.split("\n")
|
||||||
.collect::<Vec<&str>>()[1],
|
.collect::<Vec<&str>>()[1],
|
||||||
))
|
)])
|
||||||
}
|
}
|
||||||
Err(_) => None,
|
Err(_) => None,
|
||||||
}
|
}
|
||||||
@ -140,16 +145,24 @@ impl InformationStruct {
|
|||||||
.output();
|
.output();
|
||||||
let gpu = match command_output {
|
let gpu = match command_output {
|
||||||
Ok(gpu_info) => Some(
|
Ok(gpu_info) => Some(
|
||||||
String::from_utf8(gpu_info.stdout)
|
vec![
|
||||||
|
String::from_utf8(gpu_info.stdout)
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.trim()
|
.trim()
|
||||||
.replace("\n", ", ")
|
.split("\n")
|
||||||
.to_owned(),
|
.to_owned()
|
||||||
|
.collect(),
|
||||||
|
]
|
||||||
),
|
),
|
||||||
Err(_) => None,
|
Err(_) => None,
|
||||||
};
|
};
|
||||||
if gpu == Some(String::from("")) {
|
// If the GPU vec is empty we just return None
|
||||||
None
|
if let Some(gpu_check) = &gpu {
|
||||||
|
if gpu_check.len() == 0 {
|
||||||
|
None
|
||||||
|
} else {
|
||||||
|
gpu
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
gpu
|
gpu
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user