11 unstable releases (4 breaking)

✓ Uses Rust 2018 edition

new 0.5.0 Mar 17, 2019
0.4.1 Jan 12, 2019
0.3.0 Jan 4, 2019
0.2.4 Dec 4, 2018
0.1.1 Aug 4, 2017

#14 in Operating systems

Download history 55/week @ 2018-12-02 27/week @ 2018-12-09 23/week @ 2018-12-16 133/week @ 2018-12-23 270/week @ 2018-12-30 87/week @ 2019-01-06 86/week @ 2019-01-13 272/week @ 2019-01-20 185/week @ 2019-01-27 229/week @ 2019-02-03 640/week @ 2019-02-10 647/week @ 2019-02-17 541/week @ 2019-02-24 416/week @ 2019-03-03 893/week @ 2019-03-10

1,470 downloads per month
Used in 5 crates (4 directly)

MIT / BSL-1.0

17KB
378 lines

whoami

Build Status

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() {
    print!(
        "--------------------------------------------------------------------------------\n\
         user's full name (user):              {}\n\
         username (username):                  {}\n\
         --------------------------------------------------------------------------------\n\
         host's fancy name (host):             {}\n\
         hostname (hostname):                  {}\n\
         --------------------------------------------------------------------------------\n\
         platform (platform):                  {}\n\
         operating system (os):                {}\n\
         desktop environment (env):            {}\n\
         --------------------------------------------------------------------------------\n\
         ",
        whoami::user(),
        whoami::username(),
        whoami::host(),
        whoami::hostname(),
        whoami::platform(),
        whoami::os(),
        whoami::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 and Mac OS

Binary

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

TODO

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

Links

Dependencies

~189KB