-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Enable --interactive by default for sessions that are local. #47226
Enable --interactive by default for sessions that are local. #47226
Conversation
712f4d8
to
cc28c6e
Compare
cc28c6e
to
61a448b
Compare
939013b
to
6615f0f
Compare
This change unifies the `--interactive` infrastructure for all `dotnet` commands. With that common infra, it also enables interactivity for non-CI scenarios by default. We reuse CI detection from telemetry and from output redirection to determine whether to enable interactivity.
6615f0f
to
feb6c94
Compare
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.
PR Overview
This PR unifies the handling of the --interactive option across dotnet CLI commands to enable interactivity by default for local sessions while still allowing it to be explicitly disabled. Key changes include refactoring interactive option definitions to use a common implementation, updating forwarding functions to conditionally include interactive arguments, and adjusting tests to expect the interactive flag in the command arguments.
Reviewed Changes
File | Description |
---|---|
src/Cli/dotnet/CommonOptions.cs | Introduces helper IsCIEnvironmentOrRedirected() and redefines InteractiveOption to use the new common infra. |
test/dotnet-run.Tests/GivenDotnetRunBuildsCsProj.cs | Updates tests to reflect that interactivity is enabled by default and adds tests for when it is explicitly disabled. |
src/BuiltInTools/dotnet-watch/CommandLineOptions.cs | Adjusts forwarding logic to skip the interactive token when --non-interactive is specified. |
src/Cli/dotnet/* | Updates various command parsers to use the common InteractiveOption implementation. |
src/Cli/dotnet/OptionForwardingExtensions.cs | Refactors forwarding extension methods to work with nullable values and use a concise array literal syntax. |
test/dotnet-watch.Tests/CommandLineOptionsTests.cs | Updates test expectations so that interactive defaults are correctly injected into command and build arguments. |
Copilot reviewed 34 out of 34 changed files in this pull request and generated 1 comment.
Comments suppressed due to low confidence (1)
src/Cli/dotnet/OptionForwardingExtensions.cs:14
- [nitpick] The use of array literal syntax like [option.Name] may reduce clarity for readers; consider using an explicit array initializer (e.g. new string[] { option.Name }) for improved readability.
public static ForwardedOption<T> Forward<T>(this ForwardedOption<T> option) => option.SetForwardingFunction((T? o) => [option.Name]);
@@ -704,6 +704,24 @@ public void ItDoesNotShowImportantLevelMessageByDefault() | |||
.WithWorkingDirectory(testInstance.Path) | |||
.Execute(); | |||
|
|||
// this message should show because interactivity (and therefore nuget auth) is the default |
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.
The comment in the ItDoesNotShowImportantLevelMessageByDefaultWhenInteractivityDisabled test is misleading because the test name and assertion expect that important level messages are not shown when interactivity is disabled. Please update the comment so it accurately reflects the expected behavior.
Copilot is powered by AI, so mistakes are possible. Review output carefully before use.
Co-authored-by: Michael Yanni <MiYanni@microsoft.com>
This change unifies the
--interactive
infrastructure for alldotnet
commands. With that common infra, it also enables interactivity for non-CI scenarios by default. We reuse CI detection from telemetry and from output redirection to determine whether to enable interactivity.Fixes #35165