feat(env): add powershell format to env --format#526
Open
jongio wants to merge 1 commit into
Open
Conversation
Add a powershell output format to azd app env so Windows users can pipe the resolved environment straight into their session with Invoke-Expression. Emits $env:KEY = 'value' lines with single-quote escaping, works with --all service grouping, and mirrors the existing shell format. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Contributor
|
🚀 Website Preview Your PR preview is ready! 📎 Preview URL: https://jongio.github.io/azd-app/pr/526/ This preview will be automatically cleaned up when the PR is closed. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #526 +/- ##
==========================================
+ Coverage 60.77% 60.78% +0.01%
==========================================
Files 223 223
Lines 28527 28536 +9
==========================================
+ Hits 17337 17346 +9
Misses 10010 10010
Partials 1180 1180
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
Contributor
🚀 Test This PRA preview build ( 🌐 Website PreviewLive Preview: https://jongio.github.io/azd-app/pr/526/ One-Line Install (Recommended)PowerShell (Windows): iex "& { $(irm https://raw.githubusercontent.com/jongio/azd-app/main/cli/scripts/install-pr.ps1) } -PrNumber 526 -Version 0.19.5-pr526"Bash (macOS/Linux): curl -fsSL https://raw.githubusercontent.com/jongio/azd-app/main/cli/scripts/install-pr.sh | bash -s 526 0.19.5-pr526UninstallWhen you're done testing: PowerShell (Windows): iex "& { $(irm https://raw.githubusercontent.com/jongio/azd-app/main/cli/scripts/uninstall-pr.ps1) } -PrNumber 526"Bash (macOS/Linux): curl -fsSL https://raw.githubusercontent.com/jongio/azd-app/main/cli/scripts/uninstall-pr.sh | bash -s 526Build Info:
What to Test: |
This file contains hidden or 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
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.
What
Adds a
powershelloutput format toazd app env --format.Emits one
$env:KEY = 'value'line per variable, sorted by key. Values are wrapped in single quotes and embedded single quotes are doubled, so a PowerShell string literal stays literal and there is nothing to interpolate or eval unexpectedly. Works with--all(each service still grouped under its# <service>header) and with--jsonuntouched.Why
The existing
shellformat producesexport KEY="value"lines that only work in bash-like shells. Windows developers running the CLI in PowerShell had no one-liner to load a service's resolved environment into their session. This fills that gap and matches how the other formats already work.Changes
powershellvalue for--format, wired throughresolveEnvFormatand theformatEnvrenderer.powerShellQuoteSinglehelper for single-quote escaping.powershellcases inTestResolveEnvFormatandTestFormatEnv, plus a newTestPowerShellQuoteSinglecovering plain, empty, spaced, quote-bearing, and$-bearing values.Closes #524