diff --git a/Cargo.lock b/Cargo.lock index 0ad1eee..518c511 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -238,7 +238,7 @@ dependencies = [ "quoted-string", "sys-info", "time 0.3.17", - "users", + "whoami", ] [[package]] @@ -346,16 +346,6 @@ version = "0.1.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c0edd1e5b14653f783770bce4a4dabb4a5108a5370a5f5d8cfe8710c361f6c8b" -[[package]] -name = "users" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "24cc0f6d6f267b73e5a2cadf007ba8f9bc39c6a6f9666f8cf25ea809a153b032" -dependencies = [ - "libc", - "log", -] - [[package]] name = "wasi" version = "0.10.0+wasi-snapshot-preview1" @@ -416,6 +406,26 @@ version = "0.2.83" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1c38c045535d93ec4f0b4defec448e4291638ee608530863b1e2ba115d4fff7f" +[[package]] +name = "web-sys" +version = "0.3.60" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bcda906d8be16e728fd5adc5b729afad4e444e106ab28cd1c7256e54fa61510f" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "whoami" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "45dbc71f0cdca27dc261a9bd37ddec174e4a0af2b900b890f378460f745426e3" +dependencies = [ + "wasm-bindgen", + "web-sys", +] + [[package]] name = "winapi" version = "0.3.9" diff --git a/Cargo.toml b/Cargo.toml index 2930242..26300d9 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -11,4 +11,5 @@ colored = "2.0.0" quoted-string = "0.6.1" sys-info = "0.9.1" time = "0.3.17" -users = "0.11.0" +#users = "0.11.0" +whoami = "1.3.0" \ No newline at end of file diff --git a/src/main.rs b/src/main.rs index bef313e..b17c127 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,6 +1,6 @@ use colored::*; use sys_info::*; -use users::*; +use whoami::*; use chrono::*; fn get_os() -> OsInfo { @@ -82,10 +82,7 @@ fn main() { let current_info = get_os(); let info_string = format!("{} {}", current_info.icon, current_info.name).color(current_info.term_color).bold(); - if hostname().is_ok() & get_current_username().is_some() { - let username = format!("{:#?}", get_current_username().unwrap()); - println!("{} {}", String::from("Host:").bright_white(), format!(" {}@{}", &username[1..(username.len() - 1)], hostname().unwrap()).bold()) - } + println!("{} {}", String::from("Host:").bright_white(), format!(" {}@{}", username(), whoami::hostname()).bold()); println!("{} {}", String::from("OS:").bright_white(), info_string); if proc_total().is_ok() {