#env-var #env #variables #deal

dev environment

Helper to deal with environment variables

2 releases

Uses old Rust 2015

0.1.1 Oct 12, 2017
0.1.0 Oct 12, 2017

#858 in Configuration

Download history 428/week @ 2024-03-14 471/week @ 2024-03-21 526/week @ 2024-03-28 440/week @ 2024-04-04 425/week @ 2024-04-11 422/week @ 2024-04-18 752/week @ 2024-04-25 365/week @ 2024-05-02 429/week @ 2024-05-09 401/week @ 2024-05-16 399/week @ 2024-05-23 506/week @ 2024-05-30 344/week @ 2024-06-06 376/week @ 2024-06-13 500/week @ 2024-06-20 378/week @ 2024-06-27

1,658 downloads per month
Used in 42 crates (via assert_cli)

MIT/Apache

9KB
149 lines

Environment

Handle environment variable context - This crate helps you to deal with environment variables.

Build Status Documentation

Install

Just add it to your Cargo.toml:

[dependencies]
environment = "0.1"

Example

Here's a trivial example:

extern crate environment;

use std::process::Command;

fn main() {
    let env = Environment::inherit().insert("foo", "bar");


    let mut c = Command::new("printenv");

    let output = c.env_clear()
        .envs(env.compile())
        .output()
        .expect("failed to execute command");

    let output = String::from_utf8_lossy(&output.stdout);

    assert!(output.contains("foo=bar"));

}

License

Licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

No runtime deps