Skip to content

feat(env): add powershell format to env --format#526

Open
jongio wants to merge 1 commit into
mainfrom
idea/env-powershell
Open

feat(env): add powershell format to env --format#526
jongio wants to merge 1 commit into
mainfrom
idea/env-powershell

Conversation

@jongio

@jongio jongio commented Jul 19, 2026

Copy link
Copy Markdown
Owner

What

Adds a powershell output format to azd app env --format.

azd app env --format powershell | Invoke-Expression

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 --json untouched.

Why

The existing shell format produces export 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

  • New powershell value for --format, wired through resolveEnvFormat and the formatEnv renderer.
  • powerShellQuoteSingle helper for single-quote escaping.
  • Flag help, command examples, and doc comments updated to list the new format.
  • Tests: powershell cases in TestResolveEnvFormat and TestFormatEnv, plus a new TestPowerShellQuoteSingle covering plain, empty, spaced, quote-bearing, and $-bearing values.

Closes #524

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>
@jongio jongio added enhancement New feature or request idea Feature idea from the idea pipeline labels Jul 19, 2026
@jongio jongio self-assigned this Jul 19, 2026
@github-actions

Copy link
Copy Markdown
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.

github-actions Bot added a commit that referenced this pull request Jul 19, 2026
@codecov

codecov Bot commented Jul 19, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 60.78%. Comparing base (37e07e7) to head (f6a5411).
⚠️ Report is 1 commits behind head on main.

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              
Flag Coverage Δ
unittests 60.78% <100.00%> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
cli/src/cmd/app/commands/env.go 83.07% <100.00%> (+0.48%) ⬆️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@github-actions

Copy link
Copy Markdown
Contributor

🚀 Test This PR

A preview build (0.19.5-pr526) is ready for testing!

🌐 Website Preview

Live 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-pr526

Uninstall

When 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 526

Build Info:

What to Test:
Please review the PR description and test the changes described there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request idea Feature idea from the idea pipeline

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add a powershell format to azd app env --format

1 participant