Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add save method #4

Closed
wants to merge 1 commit into from
Closed

Add save method #4

wants to merge 1 commit into from

Conversation

Freyskeyd
Copy link
Owner

@Freyskeyd Freyskeyd commented Oct 13, 2017

Add a save method which accept a regex to save some variables when using the empty method.

Signed-off-by: Freyskeyd [email protected]

@Freyskeyd Freyskeyd force-pushed the add_save_method branch 2 times, most recently from f33b192 to 1f29abf Compare October 13, 2017 08:12
Signed-off-by: Freyskeyd <[email protected]>
@Freyskeyd
Copy link
Owner Author

ping @killercup and @epage for issue assert-rs/assert_cli#51

@killercup
Copy link

If this is only for assert-rs/assert_cli#51, I'd rather do it like assert-rs/assert_cli#54. But this feature has its own merits.

I'd not call it save, though. Maybe recover?

@Freyskeyd
Copy link
Owner Author

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?

@killercup
Copy link

killercup commented Oct 13, 2017 via email

@Freyskeyd
Copy link
Owner Author

Freyskeyd commented Oct 13, 2017

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");

@epage
Copy link

epage commented Oct 13, 2017

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?

@Freyskeyd Freyskeyd closed this Sep 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants