Skip to content
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

GH2671: Add support for removing -NonInteractive in NuGet Install command #2672

Merged
merged 1 commit into from
Nov 29, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,20 @@ public void Should_Add_DisableParallelProcessing_To_Arguments_If_Set()
"-NonInteractive", result.Args);
}

[Fact]
public void Should_Remove_NonInteractive_From_Arguments_If_False()
{
// Given
var fixture = new NuGetInstallerFixture();
fixture.Settings.NonInteractive = false;

// When
var result = fixture.Run();

// Then
Assert.Equal("install \"Cake\"", result.Args);
}

[Theory]
[InlineData(NuGetVerbosity.Detailed, "install \"Cake\" -Verbosity detailed -NonInteractive")]
[InlineData(NuGetVerbosity.Normal, "install \"Cake\" -Verbosity normal -NonInteractive")]
Expand Down
6 changes: 5 additions & 1 deletion src/Cake.Common/Tools/NuGet/Install/NuGetInstaller.cs
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,11 @@ private ProcessArgumentBuilder GetArguments(string packageId, NuGetInstallSettin
builder.AppendQuoted(settings.ConfigFile.MakeAbsolute(_environment).FullPath);
}

builder.Append("-NonInteractive");
// NonInteractive?
if (settings.NonInteractive)
{
builder.Append("-NonInteractive");
}

return builder;
}
Expand Down
11 changes: 11 additions & 0 deletions src/Cake.Common/Tools/NuGet/Install/NugetInstallSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -101,5 +101,16 @@ public sealed class NuGetInstallSettings : ToolSettings
/// </summary>
/// <value>The list of packages sources to use as fallbacks for this command.</value>
public ICollection<string> FallbackSource { get; set; } = new List<string>();

/// <summary>
/// Gets or sets a value indicating whether or not NuGet suppresses prompts for user input or confirmations.
/// </summary>
/// <remarks>
/// This setting is passed by NuGet.exe to any extensions such as authorization providers
/// </remarks>
/// <value>
/// <c>false</c> to allow NuGet to show prompts for user input or confirmations; otherwise, <c>true</c>.
/// </value>
public bool NonInteractive { get; set; } = true;
}
}