diff --git a/Cargo.lock b/Cargo.lock index bbfee59..4672d5f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -333,7 +333,7 @@ checksum = "6f61fba1741ea2b3d6a1e3178721804bb716a68a6aeba1149b5d52e3d464ea66" [[package]] name = "oxidefetch" -version = "1.2.1" +version = "1.2.2" dependencies = [ "byte-unit", "chrono", diff --git a/Cargo.toml b/Cargo.toml index dccf6a5..01d158d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "oxidefetch" -version = "1.2.1" +version = "1.2.2" edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/README.md b/README.md index a394ef3..b8b351e 100644 --- a/README.md +++ b/README.md @@ -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! ![alt text](image.png "Example output of OxideFetch on a WSL2 Arch Linux host") @@ -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.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.2:** All GPUs should print in their own lines. diff --git a/src/main.rs b/src/main.rs index 2478d2b..0ad7109 100644 --- a/src/main.rs +++ b/src/main.rs @@ -38,7 +38,12 @@ fn main() { color_print("Uptime:\t", '', &Some(sys_info.uptime), "bright black"); color_print("Shell:\t", '', &sys_info.shell, "bright magenta"); 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"); } @@ -69,7 +74,7 @@ struct InformationStruct { shell: Option, terminal: Option, cpu: String, - gpu: Option, + gpu: Option>, memory: String, icon: char, color: String, @@ -121,13 +126,13 @@ impl InformationStruct { match command_output { Ok(gpu_info) => { let gpu_info_as_string = String::from_utf8(gpu_info.stdout); - Some(String::from( + Some(vec![String::from( gpu_info_as_string .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. .split("\n") .collect::>()[1], - )) + )]) } Err(_) => None, } @@ -140,16 +145,24 @@ impl InformationStruct { .output(); let gpu = match command_output { Ok(gpu_info) => Some( - String::from_utf8(gpu_info.stdout) + vec![ + String::from_utf8(gpu_info.stdout) .unwrap() .trim() - .replace("\n", ", ") - .to_owned(), + .split("\n") + .to_owned() + .collect(), + ] ), Err(_) => None, }; - if gpu == Some(String::from("")) { - None + // If the GPU vec is empty we just return None + if let Some(gpu_check) = &gpu { + if gpu_check.len() == 0 { + None + } else { + gpu + } } else { gpu }