diff --git a/Cargo.lock b/Cargo.lock index 1c57864..a72e161 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -56,7 +56,7 @@ dependencies = [ "js-sys", "num-integer", "num-traits", - "time 0.1.45", + "time", "wasm-bindgen", "winapi", ] @@ -223,12 +223,6 @@ dependencies = [ "cxx-build", ] -[[package]] -name = "itoa" -version = "1.0.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fad582f4b9e86b6caa621cabeb0963332d92eea04729ab12892c2533951e6440" - [[package]] name = "js-sys" version = "0.3.60" @@ -328,10 +322,7 @@ dependencies = [ "chrono", "colored", "quoted-string", - "serde", - "serde_json", "sysinfo", - "time 0.3.17", "whoami", ] @@ -381,12 +372,6 @@ dependencies = [ "num_cpus", ] -[[package]] -name = "ryu" -version = "1.0.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b4b9743ed687d4b4bcedf9ff5eaa7398495ae14e61cba0a295704edbc7decde" - [[package]] name = "scopeguard" version = "1.1.0" @@ -399,37 +384,6 @@ version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ddccb15bcce173023b3fedd9436f882a0739b8dfb45e4f6b6002bee5929f61b2" -[[package]] -name = "serde" -version = "1.0.152" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb7d1f0d3021d347a83e556fc4683dea2ea09d87bccdf88ff5c12545d89d5efb" -dependencies = [ - "serde_derive", -] - -[[package]] -name = "serde_derive" -version = "1.0.152" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af487d118eecd09402d70a5d72551860e788df87b464af30e5ea6a38c75c541e" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "serde_json" -version = "1.0.91" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "877c235533714907a8c2464236f5c4b2a17262ef1bd71f38f35ea592c8da6883" -dependencies = [ - "itoa", - "ryu", - "serde", -] - [[package]] name = "syn" version = "1.0.107" @@ -476,22 +430,6 @@ dependencies = [ "winapi", ] -[[package]] -name = "time" -version = "0.3.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a561bf4617eebd33bca6434b988f39ed798e527f51a1e797d0ee4f61c0a38376" -dependencies = [ - "serde", - "time-core", -] - -[[package]] -name = "time-core" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2e153e1f1acaef8acc537e68b44906d2db6436e2b35ac2c6b42640fff91f00fd" - [[package]] name = "unicode-ident" version = "1.0.6" diff --git a/Cargo.toml b/Cargo.toml index 74fc15c..3ed6e96 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -10,10 +10,4 @@ chrono = "0.4.23" colored = "2.0.0" quoted-string = "0.6.1" sysinfo = "0.27.2" -time = "0.3.17" -whoami = "1.3.0" -serde_json = "1.0.91" - -[dependencies.serde] -version = "1.0.152" -features = ["std", "derive", "serde_derive"] +whoami = "1.3.0" \ No newline at end of file diff --git a/src/main.rs b/src/main.rs index b871154..36df43a 100644 --- a/src/main.rs +++ b/src/main.rs @@ -2,7 +2,9 @@ use chrono::*; use colored::*; use sysinfo::*; +use std::process::Command; use std::env; +use whoami; fn main() { let sys_info = InformationStruct::new(); @@ -86,10 +88,19 @@ impl InformationStruct { cpu: String::from(sys.cpus()[0].brand()), _gpu: { - if sys.name().unwrap_or(String::from("Unknown System")) == "Windows" { - println!("{:#?}", std::process::Command::new("wmic").arg("path").arg("win32_VideoController").arg("get").arg("name").output().expect("Unknown GPU")); + match sys.name().unwrap_or(String::from("Unknown System")).as_ref() { + "Windows" => { + let command_output = std::process::Command::new("wmic").args(["path", "win32_VideoController", "get", "name"]).output(); + match command_output { + Ok(gpu_info) => { + let gpu_info_as_string = String::from_utf8(gpu_info.stdout); + String::from(gpu_info_as_string.unwrap().split("\n").collect::>()[1]) + }, + Err(_) => String::from("Unknown GPU"), + } + } + _ => String::from("Unknown GPU"), } - String::from("Unknown GPU") }, // TODO: Add GPU detection. _memory: String::from("Unknown memory"), // TODO: Add memory detection.