-
-
Notifications
You must be signed in to change notification settings - Fork 62
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
Support pwsh format for show-env export #411
Merged
taiki-e
merged 4 commits into
taiki-e:main
from
LittleBoxOfSunshine:chhenk/pwsh-env-export
Jan 10, 2025
Merged
Support pwsh format for show-env export #411
taiki-e
merged 4 commits into
taiki-e:main
from
LittleBoxOfSunshine:chhenk/pwsh-env-export
Jan 10, 2025
Conversation
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
asvrada
reviewed
Jan 3, 2025
Thanks for this! Confirmed reading as Unicode doesn't work with PowerShell Version 5.1. But works after v6.0.0.0 Other than that, it looks good. |
asvrada
approved these changes
Jan 5, 2025
taiki-e
requested changes
Jan 9, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
Fix stale comment Use noun instead of verb in arg name; rename related code accordingly Make test check key name and initial symbols
LittleBoxOfSunshine
force-pushed
the
chhenk/pwsh-env-export
branch
from
January 10, 2025 03:06
bdfba9f
to
72ce2fd
Compare
taiki-e
approved these changes
Jan 10, 2025
Published in 0.6.16. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR demonstrates a solution for #395, with a slightly different strategy that what was discussed.
The issues outlined there:
CARGO_ENCODED_RUSTFLAGS
take non-printable characters that unix shells will accept but pwsh won't.Additionally, the shell escape crate used is escaping for cmd, not pwsh and wouldn't be compatible.
Pwsh does accept embedded unicode codes in strings though. If we encode the values this way, we don't need to worry about printable vs non-printable characters nor any of the specifics for what kinds of characters need to be escaped for what kinds of strings. This is a one-time, very fast operation. Once the emitted string is executed all the escapes are gone.
This approach wouldn't be good for a general-purpose escape function, but it's perfectly suitable for this use case.
The change enables users to execute a pwsh version of the source demo:
Primary goal was to confirm this approach worked. If this is of interest, I can make any changes to the code organization, arg name, etc. The current organization is just what came to mind as I played around with the repo.
Manual test context with binary data in env:
Intermediate state example:
Final result:
Closes #395