Crate get_env[][src]

Get argv and envp by hook or by crook.

Crates.ioRepo

This library goes further than the stdlib to get arguments and environment variables, including reading from /proc/self/cmdline and similar.

This is helpful for library crates that don't want to require them to be passed down to the library by the user; particularly if called from a non-Rust application where the Rust stdlib hasn't had a chance to capture them from the int main (int argc, char *argv[]) invocation thus breaking std::env::args().

Example

extern crate get_env;

pub fn my_library_func() {
    let args = get_env::args();
    let vars = get_env::vars();
}

Note

This currently requires Rust nightly for the used feature.

Functions

args

Returns the arguments which this program was started with (normally passed via the command line).

args_os

Returns the arguments which this program was started with (normally passed via the command line).

vars

Returns a vector of (variable, value) pairs of strings, for all the environment variables of the current process.

vars_os

Returns a vector of (variable, value) pairs of OS strings, for all the environment variables of the current process.