Fixed dependency on Unix-only library for username/hostname.
This commit is contained in:
parent
9d93a8849d
commit
e77e611e2d
32
Cargo.lock
generated
32
Cargo.lock
generated
@ -238,7 +238,7 @@ dependencies = [
|
|||||||
"quoted-string",
|
"quoted-string",
|
||||||
"sys-info",
|
"sys-info",
|
||||||
"time 0.3.17",
|
"time 0.3.17",
|
||||||
"users",
|
"whoami",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@ -346,16 +346,6 @@ version = "0.1.10"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "c0edd1e5b14653f783770bce4a4dabb4a5108a5370a5f5d8cfe8710c361f6c8b"
|
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]]
|
[[package]]
|
||||||
name = "wasi"
|
name = "wasi"
|
||||||
version = "0.10.0+wasi-snapshot-preview1"
|
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"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "1c38c045535d93ec4f0b4defec448e4291638ee608530863b1e2ba115d4fff7f"
|
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]]
|
[[package]]
|
||||||
name = "winapi"
|
name = "winapi"
|
||||||
version = "0.3.9"
|
version = "0.3.9"
|
||||||
|
@ -11,4 +11,5 @@ colored = "2.0.0"
|
|||||||
quoted-string = "0.6.1"
|
quoted-string = "0.6.1"
|
||||||
sys-info = "0.9.1"
|
sys-info = "0.9.1"
|
||||||
time = "0.3.17"
|
time = "0.3.17"
|
||||||
users = "0.11.0"
|
#users = "0.11.0"
|
||||||
|
whoami = "1.3.0"
|
@ -1,6 +1,6 @@
|
|||||||
use colored::*;
|
use colored::*;
|
||||||
use sys_info::*;
|
use sys_info::*;
|
||||||
use users::*;
|
use whoami::*;
|
||||||
use chrono::*;
|
use chrono::*;
|
||||||
|
|
||||||
fn get_os() -> OsInfo {
|
fn get_os() -> OsInfo {
|
||||||
@ -82,10 +82,7 @@ fn main() {
|
|||||||
let current_info = get_os();
|
let current_info = get_os();
|
||||||
let info_string = format!("{} {}", current_info.icon, current_info.name).color(current_info.term_color).bold();
|
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() {
|
println!("{} {}", String::from("Host:").bright_white(), format!(" {}@{}", username(), whoami::hostname()).bold());
|
||||||
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("OS:").bright_white(), info_string);
|
println!("{} {}", String::from("OS:").bright_white(), info_string);
|
||||||
if proc_total().is_ok() {
|
if proc_total().is_ok() {
|
||||||
|
Loading…
Reference in New Issue
Block a user