#env-var #env #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

#796 in Configuration

Download history 236/week @ 2023-12-04 348/week @ 2023-12-11 337/week @ 2023-12-18 245/week @ 2023-12-25 262/week @ 2024-01-01 377/week @ 2024-01-08 378/week @ 2024-01-15 261/week @ 2024-01-22 326/week @ 2024-01-29 323/week @ 2024-02-05 400/week @ 2024-02-12 468/week @ 2024-02-19 564/week @ 2024-02-26 401/week @ 2024-03-04 351/week @ 2024-03-11 557/week @ 2024-03-18

1,926 downloads per month
Used in 43 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