8 releases

✓ Uses Rust 2018 edition

0.3.0 Jan 4, 2019
0.2.4 Dec 4, 2018
0.2.3 Nov 27, 2018
0.2.2 Jun 2, 2018
0.1.1 Aug 4, 2017

#26 in Operating systems

Download history 5/week @ 2018-10-11 5/week @ 2018-10-18 6/week @ 2018-10-25 12/week @ 2018-11-01 33/week @ 2018-11-08 49/week @ 2018-11-15 16/week @ 2018-11-22 55/week @ 2018-11-29 30/week @ 2018-12-06 24/week @ 2018-12-13 15/week @ 2018-12-20 117/week @ 2018-12-27 166/week @ 2019-01-03

217 downloads per month
Used in 3 crates (2 directly)

MIT / BSL-1.0

15KB
302 lines

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 Strings (with the exception of env, which returns an enum). The following example shows how to use all of the functions:

use whoami;

fn main() {
    print!(
        "--------------------------------------\n\
         user's full name (user):              {}\n\
         username (username):                  {}\n\
         --------------------------------------\n\
         host's fancy name (host):             {}\n\
         hostname (hostname):                  {}\n\
         --------------------------------------\n\
         operating system (os):                {}\n\
         desktop environment (env):            {}\n\
         --------------------------------------\n\
         ",
        whoami::user(),
        whoami::username(),
        whoami::host(),
        whoami::hostname(),
        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
  • 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 / Wasm (Web Assembly) / other OS's.

Links


Plop Grizzly

Dependencies

~169KB