From 207341cbd718d73df5eae75c5d9df3fe4a2bae16 Mon Sep 17 00:00:00 2001 From: River <53824200+shibedrill@users.noreply.github.com> Date: Wed, 1 Mar 2023 19:24:29 -0500 Subject: [PATCH] Added more code comments, and fixed a potential bug in linux system name detection --- Cargo.lock | 2 +- Cargo.toml | 2 +- README.md | 5 +++-- src/main.rs | 10 ++++++++++ 4 files changed, 15 insertions(+), 4 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 5de59de..0cdb4cd 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -333,7 +333,7 @@ checksum = "6f61fba1741ea2b3d6a1e3178721804bb716a68a6aeba1149b5d52e3d464ea66" [[package]] name = "oxidefetch" -version = "1.1.0" +version = "1.1.1" dependencies = [ "byte-unit", "chrono", diff --git a/Cargo.toml b/Cargo.toml index a9bb0ef..ed7d331 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "oxidefetch" -version = "1.1.0" +version = "1.1.1" 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 4067eca..3f3e6a0 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# oxidefetch 1.1.0 +# oxidefetch 1.1.1 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") @@ -60,4 +60,5 @@ regarding your real name, IP, location, etc. You can look at the file it generat ### Changelog 1.0.0: Official full stable release 1.0.1: Fixed distro name for Debian GNU/Linux. Logo & color works now. -1.1.0: Refactored some poorly written typing, and added support for memory. \ No newline at end of file +1.1.0: Refactored some poorly written typing, and added support for memory. +1.1.1: Made sure that linux system detection won't fail if Linux has a capital L. \ No newline at end of file diff --git a/src/main.rs b/src/main.rs index 283968f..3274121 100644 --- a/src/main.rs +++ b/src/main.rs @@ -46,6 +46,11 @@ fn color_print(field_title: &str, icon: char, field: &Option, color: &st // If the field is missing, it won't print. if field.is_some() { //print!("{} ", field_title.bright_white()); + // ^^^ UNCOMMENT THIS LINE TO ENABLE FIELD TITLES! + // Comment it out to disable them. + // TODO: Add configurability to enable or disable this without recompiling. + // AT LEAST make it a crate feature so people can change the setting without + // editing the source code. println!( "{}", format!("{} {}", icon, field.as_ref().unwrap()).color(color) @@ -55,6 +60,10 @@ fn color_print(field_title: &str, icon: char, field: &Option, color: &st #[derive(Debug)] struct InformationStruct { + // Only fields whose setters can fail, are given Option types. + // Unsure if I should coerce these fields into an Option *here*, or + // within the args of color_print, since that function only accepts args of + // type Option. username: String, hostname: String, os_name: Option, @@ -190,6 +199,7 @@ impl InformationStruct { if sys .name() .unwrap_or(String::from("Unknown System")) + .to_ascii_lowercase() .contains("linux") { // If we don't know what it is exactly, but we know it's Linux, // just toss in good ol' Tux.