Nested Env Parser is a crate for getting the final value of a string with nested environment variables.
Install using cargo:
no_run,ignore
cargo install nested-env-parser
```rust use clap::Parser; use nestedenvparser::Env;
struct Opts { #[clap(env)] valuewithenv: Env, }
fn main() { std::env::setvar("VALUE1", "Hello,"); std::env::setvar("VALUE2", "world"); std::env::setvar("VALUEWITH_ENV", "$VALUE1 ${VALUE2}!");
let opts = Opts::parse();
assert_eq!("Hello, world!", &opts.value_with_env);
} ```
```rust use clap::Parser; use nestedenvparser::Env;
struct Opts { #[clap(env)] valuewithenv: Env, }
fn main() { std::env::setvar("VALUE1", "Hello"); std::env::setvar("VALUE2", "world"); std::env::setvar("VALUEWITH_ENV", "%VALUE1%, %VALUE2%!");
let opts = Opts::parse();
assert_eq!("Hello, world!", &opts.value_with_env);
} ```
Current version: 1.1.0
License: MIT