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 new functions for manipulating the environment #114

Merged
merged 10 commits into from
Nov 7, 2023

Conversation

mjcarroll
Copy link
Contributor

This adds functions for using collections with the environment. It allows for conveniently retreiving and setting the environment variables via a map, rather than individually.

This also adds a clearenv and printenv for completeness.

This adds functions for using collections with the environment.  It
allows for conveniently retreiving and setting the environment variables
via a map, rather than individually.

This also adds a clearenv and printenv for completeness.

Signed-off-by: Michael Carroll <[email protected]>
@mjcarroll mjcarroll requested a review from azeey as a code owner November 1, 2023 14:29
Copy link

codecov bot commented Nov 1, 2023

Codecov Report

Merging #114 (b9fc005) into gz-utils2 (c918355) will decrease coverage by 12.31%.
Report is 13 commits behind head on gz-utils2.
The diff coverage is 72.24%.

@@              Coverage Diff               @@
##           gz-utils2     #114       +/-   ##
==============================================
- Coverage      91.97%   79.67%   -12.31%     
==============================================
  Files              6        8        +2     
  Lines            137      364      +227     
==============================================
+ Hits             126      290      +164     
- Misses            11       74       +63     
Files Coverage Δ
cli/include/gz/utils/cli/GzFormatter.hpp 88.13% <ø> (ø)
include/gz/utils/Subprocess.hh 96.61% <96.61%> (ø)
src/Environment.cc 87.03% <81.81%> (-8.21%) ⬇️
include/gz/utils/detail/subprocess.h 59.25% <59.25%> (ø)

@mjcarroll mjcarroll force-pushed the mjcarroll/environment_features branch from faabbe0 to 65f81d7 Compare November 1, 2023 15:28
Signed-off-by: Michael Carroll <[email protected]>
@mjcarroll mjcarroll force-pushed the mjcarroll/environment_features branch from f270fd2 to 55451cc Compare November 1, 2023 16:12
Signed-off-by: Michael Carroll <[email protected]>
Signed-off-by: Michael Carroll <[email protected]>
@mjcarroll mjcarroll force-pushed the mjcarroll/environment_features branch from 8b2a7d4 to c0f0542 Compare November 1, 2023 16:45
Signed-off-by: Michael Carroll <[email protected]>
@mjcarroll mjcarroll force-pushed the mjcarroll/environment_features branch from 239ecb6 to 1756d83 Compare November 1, 2023 16:59
Signed-off-by: Michael Carroll <[email protected]>
Signed-off-by: Michael Carroll <[email protected]>
@iche033
Copy link
Contributor

iche033 commented Nov 1, 2023

Is the idea to eventually deprecate the env functions in gz-common and use these instead?

Signed-off-by: Michael Carroll <[email protected]>
@mjcarroll
Copy link
Contributor Author

Is the idea to eventually deprecate the env functions in gz-common and use these instead?

The gz-common ones are now just forwarding to the other env functions here. I added them because we have packages that we want env functionality in that don't depend on gz-common (eg sdformat).

@azeey
Copy link
Contributor

azeey commented Nov 1, 2023

A couple of tests are failing on windows.

@mjcarroll
Copy link
Contributor Author

A couple of tests are failing on windows.

Neat. So what this was is that cmd.exe injects an extra environment variable =C: which powershell does not. This interfered with my splitting logic.

@mjcarroll mjcarroll self-assigned this Nov 3, 2023
Copy link
Contributor

@azeey azeey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@mjcarroll mjcarroll merged commit 8529918 into gz-utils2 Nov 7, 2023
13 of 15 checks passed
@mjcarroll mjcarroll deleted the mjcarroll/environment_features branch November 7, 2023 14:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

3 participants