-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Freyskeyd <[email protected]>
- Loading branch information
Showing
3 changed files
with
66 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,13 @@ | ||
[package] | ||
name = "environment" | ||
version = "0.1.0" | ||
version = "0.1.1" | ||
authors = ["Freyskeyd <[email protected]>"] | ||
description = "Helper to deal with environment variables." | ||
license = "MIT" | ||
|
||
license = "MIT OR Apache-2.0" | ||
repository = "https://github.com/Freyskeyd/environment.git" | ||
homepage = "https://github.com/Freyskeyd/environment" | ||
documentation = "http://docs.rs/environment/" | ||
readme = "README.md" | ||
keywords = ["environment", "env"] | ||
|
||
[dependencies] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
# Environment | ||
|
||
> **Handle environment variable context** - This crate helps you to deal with environment variables. | ||
[![Build Status](https://travis-ci.org/Freyskeyd/environment.svg)](https://travis-ci.org/Freyskeyd/environment) [![Documentation](https://img.shields.io/badge/docs-master-blue.svg)][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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters