-
Notifications
You must be signed in to change notification settings - Fork 286
feat: add --export flag to azd env get-values for shell sourcing #7364
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
Open
spboyer
wants to merge
10
commits into
main
Choose a base branch
from
feat/env-export
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
fd6936f
feat: add --export flag to azd env get-values for shell sourcing
spboyer 75be893
fix: shell-safe export with newline roundtrip and key validation
spboyer 34939fb
fix: cspell roundtripping -> round-tripping
spboyer 9b3872f
fix: lift shellEscaper and validShellKey to package-level vars
spboyer 13e31bc
Address review feedback on --export flag
spboyer dfea26d
Add PowerShell export support via --shell pwsh flag
spboyer 4910725
Fix shell escaping, PowerShell newlines, stderr abstraction, and --sh…
spboyer 5436315
Fix staticcheck SA5011 false positives in tests
spboyer 318b415
Add regression tests for ANSI-C escaping and warning output
spboyer 0ce924f
Fix staticcheck SA5011: use require.NotNil for fluent builder test
spboyer File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
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
Oops, something went wrong.
Oops, something went wrong.
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.
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.
@spboyer This seems like a complicated feature we'd have to support longer term. My current concerns are:
sh, e.g.nu,fish, that wouldn't work out-of-the-boxI would strongly recommend going down the path of
azd env exec(andazd env exec --for args support), which allowsazdto passthrough environment variables to all shells, and we would eliminate all the complication.I would imagine this being much more agent-friendly as well.
Happy to discuss further. I don't believe this fully resolves the concerns in the linked issue -- I think there are separately requirements around "filtered exports" and "automatic exports" that I can also design for if we're prioritizing fixing this issue today.
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.
@weikanglim Really appreciate the thoughtful feedback. You raise valid concerns — maintaining shell-specific syntax rules long-term is fragile, and it doesn't cover nu/fish/etc.
azd env execis a much cleaner approach: azd sets the environment natively and passes through to any shell without needing to know syntax rules. That eliminates the escaping complexity entirely.I'm on board with pivoting this direction. A few questions to align on scope:
azd env exec -- <command>be the basic form?For now, I'll fix the existing code bugs reviewers flagged (escaping, PowerShell newlines) since they're real correctness issues, and we can decide whether to rework this PR toward
azd env execor open a new one.Uh oh!
There was an error while loading. Please reload this page.
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.
@spboyer Thanks for entertaining the feedback. I spent some time drafting the alternate issue for
azd env execin 7423, and I do prefer it much better as a cleaner option.Answering the questions briefly:
Basic form would be
azd env exec. Extended form for flag parsing would beazd env exec --.For example:
I think agents / automation would also have an easier time with this direction, since they can pass argv directly instead of composing
eval/ shell-specific export syntax.I agree with the scoping decision here.
My concern is mostly around overlapping concepts: if
--exportmeans a certain thing onenv get-values, that could get confusing with futureenv exportdirections for filtered exports / automatic exports.I opened 7423 for the
env execdirection, and I'll capture remaining requirements from 4383 so we don't lose track of them.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.
@weikanglim Ping — I'm on board with the
azd env execdirection. Would love to sync on scope (basic form, filtered exports, etc.) so I can start on it. Happy to chat async or hop on a call.