Closed Freyskeyd closed 1 year ago
ping @killercup and @epage for issue killercup/assert_cli#51
If this is only for killercup/assert_cli#51, I'd rather do it like killercup/assert_cli#54. But this feature has its own merits.
I'd not call it save
, though. Maybe recover
?
Yeah, I think this is a feature needed outside of assert_cli.
I was divide about the name.
What do you think?
So, the starting point is an empty env, and we are copying the parent scope's env var.
Maybe inherit_var
?
Am 13.10.2017 um 10:55 schrieb Simon Paitrault notifications@github.com:
Yeah, I think this is a feature needed outside of assert_cli.
I was divide about the name.
• save • recover • keep What do you think?
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.
why not:
let env = Environment::empty()
.inherit_vars("^CARGO_.*")
.insert("CARGO_SOMETHING", "ok");
We can also:
let env = Environment::inherit_matches("^CARGO_*")
.insert("CARGO_SOMETHING", "ok");
I agree about inherit
for the base name.
For consistency, a inherit_vars
should probably take an iterator. We could do some From
stuff so it assumes a string is a regex, though I tend to prefer things more explicit. I like inherit_matches
for that reason
So overall, I'd like to see
inherit_var
inherit_vars
inherit_matches
Question: If clients do not need inherit_matches
, should we force a regex dependency on them? Should it be a feature (default or not) so users can better control their compile times?
Add a save method which accept a regex to save some variables when using the empty method.
Signed-off-by: Freyskeyd simon.paitrault@gmail.com