20 releases (8 breaking)

0.9.0 Jun 25, 2020
0.8.1 Feb 22, 2020
0.7.0 Dec 21, 2019
0.6.0 Oct 26, 2019
0.1.1 Aug 4, 2017

#5 in Operating systems

Download history 4707/week @ 2020-04-20 5242/week @ 2020-04-27 4881/week @ 2020-05-04 4662/week @ 2020-05-11 5209/week @ 2020-05-18 7642/week @ 2020-05-25 7684/week @ 2020-06-01 7278/week @ 2020-06-08 6009/week @ 2020-06-15 9826/week @ 2020-06-22 12174/week @ 2020-06-29 12641/week @ 2020-07-06 13914/week @ 2020-07-13 15667/week @ 2020-07-20 11664/week @ 2020-07-27 9920/week @ 2020-08-03

25,058 downloads per month
Used in 42 crates (28 directly)

MIT OR BSL-1.0

38KB
948 lines

WhoAmI Logo

docs.rs tests build status crates.io

About | Source | Changelog

WhoAmI

Retrieve the current user and environment.

Getting Started

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:

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()
    );
}

Features

  • Get the user's full name
  • Get the user's username
  • Get the computer's hostname
  • Get the computer's fancy name
  • Get the computer's desktop environment
  • Get the computer's OS name and version
  • Get the computer's platform name
  • Works on Linux, Windows, Mac OS, and Web Assembly

Binary

whome: replacement of the whoami command that depends on this crate.

TODO

  • Support iOS / Android / Nintendo Switch (and other consoles) / other OS's.

Contributing

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!

License

This repository is licensed under either of the following:

at your option.

Contribution Licensing

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.

Dependencies

~0–470KB