https://github.com/freyskeyd/environment
https://github.com/freyskeyd/environment
Last synced: about 1 year ago
JSON representation
- Host: GitHub
- URL: https://github.com/freyskeyd/environment
- Owner: Freyskeyd
- Created: 2017-10-12T11:24:30.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2017-11-20T12:29:06.000Z (over 8 years ago)
- Last Synced: 2025-06-06T23:36:46.702Z (about 1 year ago)
- Language: Rust
- Size: 16.6 KB
- Stars: 6
- Watchers: 0
- Forks: 2
- Open Issues: 7
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Environment
> **Handle environment variable context** - This crate helps you to deal with environment variables.
[](https://travis-ci.org/Freyskeyd/environment) [][Documentation]
## Install
Just add it to your `Cargo.toml`:
```toml
[dependencies]
environment = "0.1"
```
## Example
Here's a trivial example:
```rust
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
* Apache License, Version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or http://www.apache.org/licenses/LICENSE-2.0)
* MIT license ([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT)
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.
[Documentation]: https://docs.rs/environment