Retrieve the current user and environment.
Using the whoami crate is super easy! All of the exported items are simple
functions with no parameters that return either a String
or enum. The
following example shows how to use all of the functions:
rust
fn main() {
println!(
"User→Name whoami::realname(): {}",
whoami::realname()
);
println!(
"User→Username whoami::username(): {}",
whoami::username()
);
println!(
"Host→Name whoami::devicename(): {}",
whoami::devicename()
);
println!(
"Host→Hostname whoami::hostname(): {}",
whoami::hostname()
);
println!(
"Platform whoami::platform(): {}",
whoami::platform()
);
println!(
"OS Distro whoami::distro(): {}",
whoami::distro()
);
println!(
"Desktop Env. whoami::desktop_env(): {}",
whoami::desktop_env()
);
}
whome: replacement of the whoami
command that depends on this crate.
Contributors are always welcome! Whether it is a bug report, bug fix, feature request, feature implementation or whatever. Don't be shy about getting involved. I always make time to fix bugs, so usually a patched version of the library will be out soon after a report. Features take me longer, though. I'll also always listen to any design critiques you have. If you have any questions you can email me at jeronlau@plopgrizzly.com. Otherwise, here's a link to the issues on GitHub.
And, as always, make sure to always follow the code of conduct. Happy coding!
This repository is licensed under either of the following:
at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you shall be dual licensed as above without any additional terms or conditions.