-
Notifications
You must be signed in to change notification settings - Fork 695
The --source argument is not preserved when running aspire add -s #9509
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
Conversation
Co-authored-by: davidfowl <[email protected]>
@copilot add a test to tests/Aspire.Cli.Tests/Commands/AddCommandTests.cs that verifies a call to add with the source flows to both search and add. |
Co-authored-by: davidfowl <[email protected]>
I've added a test that verifies the source parameter flows correctly to both the search and add commands. The test checks that when providing a custom source URL with the --source parameter, the same source is used in both operations. You can see the implementation in commit b738103. |
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.
Pull Request Overview
This PR ensures that the --source
argument is preserved when running both the search and add steps of aspire add -s
.
- Extended
AddPackageAsync
inIDotNetCliRunner
and its implementation to accept a nullablenugetSource
. - Updated the
DotNetCliRunner
to include--source
when adding packages. - Added a new integration test to verify that the source is propagated in both commands.
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
File | Description |
---|---|
src/Aspire.Cli/DotNetCliRunner.cs | Extended CLI runner to pass through --source to dotnet add package . |
src/Aspire.Cli/Commands/AddCommand.cs | Forwarded the source parameter to the updated AddPackageAsync call. |
tests/Aspire.Cli.Tests/TestServices/TestDotNetCliRunner.cs | Updated test runner callback signature to include nugetSource . |
tests/Aspire.Cli.Tests/Commands/AddCommandTests.cs | Added a test case to verify that the source argument is used in both search and add commands. |
Comments suppressed due to low confidence (1)
tests/Aspire.Cli.Tests/Commands/AddCommandTests.cs:481
- Consider adding a complementary test to verify behavior when no --source is provided, ensuring the nugetSource parameter remains null and no --source flag is passed to the runner.
public async Task AddCommandPreservesSourceArgumentInBothCommands()
cliArgsList.Add(nugetSource); | ||
} | ||
|
||
string[] cliArgs = [.. cliArgsList]; |
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.
[nitpick] Consider using cliArgsList.ToArray() instead of the C#12 collection spread syntax for clarity and consistency with existing code patterns.
string[] cliArgs = [.. cliArgsList]; | |
string[] cliArgs = cliArgsList.ToArray(); |
Copilot uses AI. Check for mistakes.
Thanks for assigning this issue to me. I'm starting to work on it and will keep this PR's description up to date as I form a plan and make progress.
Original issue description:
Fixes #9508.
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.