Select forward arguments to restore (#9830)
This commit is contained in:
parent
8ca823bfd6
commit
d7b9504c9f
12 changed files with 140 additions and 19 deletions
|
@ -1,6 +1,7 @@
|
||||||
// Copyright (c) .NET Foundation and contributors. All rights reserved.
|
// Copyright (c) .NET Foundation and contributors. All rights reserved.
|
||||||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||||
|
|
||||||
|
using System.Collections.Generic;
|
||||||
using Microsoft.DotNet.Cli.Utils;
|
using Microsoft.DotNet.Cli.Utils;
|
||||||
using Microsoft.DotNet.Configurer;
|
using Microsoft.DotNet.Configurer;
|
||||||
using Microsoft.DotNet.Tools.Tool.Install;
|
using Microsoft.DotNet.Tools.Tool.Install;
|
||||||
|
@ -11,12 +12,13 @@ namespace Microsoft.DotNet.ToolPackage
|
||||||
internal static class ToolPackageFactory
|
internal static class ToolPackageFactory
|
||||||
{
|
{
|
||||||
public static (IToolPackageStore, IToolPackageInstaller) CreateToolPackageStoreAndInstaller(
|
public static (IToolPackageStore, IToolPackageInstaller) CreateToolPackageStoreAndInstaller(
|
||||||
DirectoryPath? nonGlobalLocation = null)
|
DirectoryPath? nonGlobalLocation = null,
|
||||||
|
IEnumerable<string> additionalRestoreArguments = null)
|
||||||
{
|
{
|
||||||
IToolPackageStore toolPackageStore = CreateToolPackageStore(nonGlobalLocation);
|
IToolPackageStore toolPackageStore = CreateToolPackageStore(nonGlobalLocation);
|
||||||
var toolPackageInstaller = new ToolPackageInstaller(
|
var toolPackageInstaller = new ToolPackageInstaller(
|
||||||
toolPackageStore,
|
toolPackageStore,
|
||||||
new ProjectRestorer());
|
new ProjectRestorer(additionalRestoreArguments: additionalRestoreArguments));
|
||||||
|
|
||||||
return (toolPackageStore, toolPackageInstaller);
|
return (toolPackageStore, toolPackageInstaller);
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,36 @@
|
||||||
|
// Copyright (c) .NET Foundation and contributors. All rights reserved.
|
||||||
|
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||||
|
|
||||||
|
using Microsoft.DotNet.Cli.CommandLine;
|
||||||
|
using LocalizableStrings = Microsoft.DotNet.Tools.Restore.LocalizableStrings;
|
||||||
|
|
||||||
|
|
||||||
|
namespace Microsoft.DotNet.Cli
|
||||||
|
{
|
||||||
|
internal static class ToolCommandRestorePassThroughOptions
|
||||||
|
{
|
||||||
|
public static Option DisableParallelOption()
|
||||||
|
{
|
||||||
|
return Create.Option(
|
||||||
|
"--disable-parallel",
|
||||||
|
LocalizableStrings.CmdDisableParallelOptionDescription,
|
||||||
|
Accept.NoArguments().ForwardAs("--disable-parallel"));
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Option NoCacheOption()
|
||||||
|
{
|
||||||
|
return Create.Option(
|
||||||
|
"--no-cache",
|
||||||
|
LocalizableStrings.CmdNoCacheOptionDescription,
|
||||||
|
Accept.NoArguments().ForwardAs("--no-cache"));
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Option IgnoreFailedSourcesOption()
|
||||||
|
{
|
||||||
|
return Create.Option(
|
||||||
|
"--ignore-failed-sources",
|
||||||
|
LocalizableStrings.CmdIgnoreFailedSourcesOptionDescription,
|
||||||
|
Accept.NoArguments().ForwardAs("--ignore-failed-sources"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -3,6 +3,7 @@
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
using Microsoft.DotNet.Cli;
|
using Microsoft.DotNet.Cli;
|
||||||
using Microsoft.DotNet.Cli.Utils;
|
using Microsoft.DotNet.Cli.Utils;
|
||||||
using Microsoft.DotNet.Tools;
|
using Microsoft.DotNet.Tools;
|
||||||
|
@ -18,9 +19,12 @@ namespace Microsoft.DotNet.Tools.Tool.Install
|
||||||
private readonly IReporter _reporter;
|
private readonly IReporter _reporter;
|
||||||
private readonly IReporter _errorReporter;
|
private readonly IReporter _errorReporter;
|
||||||
private readonly bool _forceOutputRedirection;
|
private readonly bool _forceOutputRedirection;
|
||||||
|
private readonly IEnumerable<string> _additionalRestoreArguments;
|
||||||
|
|
||||||
public ProjectRestorer(IReporter reporter = null)
|
public ProjectRestorer(IReporter reporter = null,
|
||||||
|
IEnumerable<string> additionalRestoreArguments = null)
|
||||||
{
|
{
|
||||||
|
_additionalRestoreArguments = additionalRestoreArguments;
|
||||||
_reporter = reporter ?? Reporter.Output;
|
_reporter = reporter ?? Reporter.Output;
|
||||||
_errorReporter = reporter ?? Reporter.Error;
|
_errorReporter = reporter ?? Reporter.Error;
|
||||||
_forceOutputRedirection = reporter != null;
|
_forceOutputRedirection = reporter != null;
|
||||||
|
@ -47,6 +51,11 @@ namespace Microsoft.DotNet.Tools.Tool.Install
|
||||||
|
|
||||||
argsToPassToRestore.Add($"-verbosity:{verbosity ?? "quiet"}");
|
argsToPassToRestore.Add($"-verbosity:{verbosity ?? "quiet"}");
|
||||||
|
|
||||||
|
if (_additionalRestoreArguments != null)
|
||||||
|
{
|
||||||
|
argsToPassToRestore.AddRange(_additionalRestoreArguments);
|
||||||
|
}
|
||||||
|
|
||||||
var command = new DotNetCommandFactory(alwaysRunOutOfProc: true)
|
var command = new DotNetCommandFactory(alwaysRunOutOfProc: true)
|
||||||
.Create("restore", argsToPassToRestore);
|
.Create("restore", argsToPassToRestore);
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,10 @@ using NuGet.Versioning;
|
||||||
namespace Microsoft.DotNet.Tools.Tool.Install
|
namespace Microsoft.DotNet.Tools.Tool.Install
|
||||||
{
|
{
|
||||||
internal delegate IShellShimRepository CreateShellShimRepository(DirectoryPath? nonGlobalLocation = null);
|
internal delegate IShellShimRepository CreateShellShimRepository(DirectoryPath? nonGlobalLocation = null);
|
||||||
internal delegate (IToolPackageStore, IToolPackageInstaller) CreateToolPackageStoreAndInstaller(DirectoryPath? nonGlobalLocation = null);
|
|
||||||
|
internal delegate (IToolPackageStore, IToolPackageInstaller) CreateToolPackageStoreAndInstaller(
|
||||||
|
DirectoryPath? nonGlobalLocation = null,
|
||||||
|
IEnumerable<string> forwardRestoreArguments = null);
|
||||||
|
|
||||||
internal class ToolInstallCommand : CommandBase
|
internal class ToolInstallCommand : CommandBase
|
||||||
{
|
{
|
||||||
|
@ -36,6 +39,7 @@ namespace Microsoft.DotNet.Tools.Tool.Install
|
||||||
private readonly bool _global;
|
private readonly bool _global;
|
||||||
private readonly string _verbosity;
|
private readonly string _verbosity;
|
||||||
private readonly string _toolPath;
|
private readonly string _toolPath;
|
||||||
|
private IEnumerable<string> _forwardRestoreArguments;
|
||||||
|
|
||||||
public ToolInstallCommand(
|
public ToolInstallCommand(
|
||||||
AppliedOption appliedCommand,
|
AppliedOption appliedCommand,
|
||||||
|
@ -61,6 +65,7 @@ namespace Microsoft.DotNet.Tools.Tool.Install
|
||||||
_toolPath = appliedCommand.SingleArgumentOrDefault("tool-path");
|
_toolPath = appliedCommand.SingleArgumentOrDefault("tool-path");
|
||||||
|
|
||||||
_createToolPackageStoreAndInstaller = createToolPackageStoreAndInstaller ?? ToolPackageFactory.CreateToolPackageStoreAndInstaller;
|
_createToolPackageStoreAndInstaller = createToolPackageStoreAndInstaller ?? ToolPackageFactory.CreateToolPackageStoreAndInstaller;
|
||||||
|
_forwardRestoreArguments = appliedCommand.OptionValuesToBeForwarded();
|
||||||
|
|
||||||
_environmentPathInstruction = environmentPathInstruction
|
_environmentPathInstruction = environmentPathInstruction
|
||||||
?? EnvironmentPathFactory.CreateEnvironmentPathInstruction();
|
?? EnvironmentPathFactory.CreateEnvironmentPathInstruction();
|
||||||
|
@ -107,7 +112,7 @@ namespace Microsoft.DotNet.Tools.Tool.Install
|
||||||
}
|
}
|
||||||
|
|
||||||
(IToolPackageStore toolPackageStore, IToolPackageInstaller toolPackageInstaller) =
|
(IToolPackageStore toolPackageStore, IToolPackageInstaller toolPackageInstaller) =
|
||||||
_createToolPackageStoreAndInstaller(toolPath);
|
_createToolPackageStoreAndInstaller(toolPath, _forwardRestoreArguments);
|
||||||
IShellShimRepository shellShimRepository = _createShellShimRepository(toolPath);
|
IShellShimRepository shellShimRepository = _createShellShimRepository(toolPath);
|
||||||
|
|
||||||
// Prevent installation if any version of the package is installed
|
// Prevent installation if any version of the package is installed
|
||||||
|
|
|
@ -33,7 +33,7 @@ namespace Microsoft.DotNet.Cli
|
||||||
"--configfile",
|
"--configfile",
|
||||||
LocalizableStrings.ConfigFileOptionDescription,
|
LocalizableStrings.ConfigFileOptionDescription,
|
||||||
Accept.ExactlyOneArgument()
|
Accept.ExactlyOneArgument()
|
||||||
.With(name: LocalizableStrings.ConfigFileOptionName)),
|
.With(name: LocalizableStrings.ConfigFileOptionName)),
|
||||||
Create.Option(
|
Create.Option(
|
||||||
"--add-source",
|
"--add-source",
|
||||||
LocalizableStrings.AddSourceOptionDescription,
|
LocalizableStrings.AddSourceOptionDescription,
|
||||||
|
@ -44,6 +44,9 @@ namespace Microsoft.DotNet.Cli
|
||||||
LocalizableStrings.FrameworkOptionDescription,
|
LocalizableStrings.FrameworkOptionDescription,
|
||||||
Accept.ExactlyOneArgument()
|
Accept.ExactlyOneArgument()
|
||||||
.With(name: LocalizableStrings.FrameworkOptionName)),
|
.With(name: LocalizableStrings.FrameworkOptionName)),
|
||||||
|
ToolCommandRestorePassThroughOptions.DisableParallelOption(),
|
||||||
|
ToolCommandRestorePassThroughOptions.IgnoreFailedSourcesOption(),
|
||||||
|
ToolCommandRestorePassThroughOptions.NoCacheOption(),
|
||||||
CommonOptions.HelpOption(),
|
CommonOptions.HelpOption(),
|
||||||
CommonOptions.VerbosityOption());
|
CommonOptions.VerbosityOption());
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,7 +20,8 @@ namespace Microsoft.DotNet.Tools.Tool.Update
|
||||||
internal delegate IShellShimRepository CreateShellShimRepository(DirectoryPath? nonGlobalLocation = null);
|
internal delegate IShellShimRepository CreateShellShimRepository(DirectoryPath? nonGlobalLocation = null);
|
||||||
|
|
||||||
internal delegate (IToolPackageStore, IToolPackageInstaller) CreateToolPackageStoreAndInstaller(
|
internal delegate (IToolPackageStore, IToolPackageInstaller) CreateToolPackageStoreAndInstaller(
|
||||||
DirectoryPath? nonGlobalLocation = null);
|
DirectoryPath? nonGlobalLocation = null,
|
||||||
|
IEnumerable<string> additionalRestoreArguments = null);
|
||||||
|
|
||||||
internal class ToolUpdateCommand : CommandBase
|
internal class ToolUpdateCommand : CommandBase
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
// Copyright (c) .NET Foundation and contributors. All rights reserved.
|
// Copyright (c) .NET Foundation and contributors. All rights reserved.
|
||||||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||||
|
|
||||||
|
using System.Linq;
|
||||||
using Microsoft.DotNet.Cli.CommandLine;
|
using Microsoft.DotNet.Cli.CommandLine;
|
||||||
using LocalizableStrings = Microsoft.DotNet.Tools.Tool.Update.LocalizableStrings;
|
using LocalizableStrings = Microsoft.DotNet.Tools.Tool.Update.LocalizableStrings;
|
||||||
|
|
||||||
|
@ -28,7 +29,7 @@ namespace Microsoft.DotNet.Cli
|
||||||
"--configfile",
|
"--configfile",
|
||||||
LocalizableStrings.ConfigFileOptionDescription,
|
LocalizableStrings.ConfigFileOptionDescription,
|
||||||
Accept.ExactlyOneArgument()
|
Accept.ExactlyOneArgument()
|
||||||
.With(name: LocalizableStrings.ConfigFileOptionName)),
|
.With(name: LocalizableStrings.ConfigFileOptionName)),
|
||||||
Create.Option(
|
Create.Option(
|
||||||
"--add-source",
|
"--add-source",
|
||||||
LocalizableStrings.AddSourceOptionDescription,
|
LocalizableStrings.AddSourceOptionDescription,
|
||||||
|
@ -39,6 +40,9 @@ namespace Microsoft.DotNet.Cli
|
||||||
LocalizableStrings.FrameworkOptionDescription,
|
LocalizableStrings.FrameworkOptionDescription,
|
||||||
Accept.ExactlyOneArgument()
|
Accept.ExactlyOneArgument()
|
||||||
.With(name: LocalizableStrings.FrameworkOptionName)),
|
.With(name: LocalizableStrings.FrameworkOptionName)),
|
||||||
|
ToolCommandRestorePassThroughOptions.DisableParallelOption(),
|
||||||
|
ToolCommandRestorePassThroughOptions.IgnoreFailedSourcesOption(),
|
||||||
|
ToolCommandRestorePassThroughOptions.NoCacheOption(),
|
||||||
CommonOptions.HelpOption(),
|
CommonOptions.HelpOption(),
|
||||||
CommonOptions.VerbosityOption());
|
CommonOptions.VerbosityOption());
|
||||||
}
|
}
|
||||||
|
|
|
@ -57,7 +57,8 @@ namespace Microsoft.DotNet.Tests.Commands
|
||||||
filePermissionSetter: new NoOpFilePermissionSetter());
|
filePermissionSetter: new NoOpFilePermissionSetter());
|
||||||
_environmentPathInstructionMock =
|
_environmentPathInstructionMock =
|
||||||
new EnvironmentPathInstructionMock(_reporter, _pathToPlaceShim);
|
new EnvironmentPathInstructionMock(_reporter, _pathToPlaceShim);
|
||||||
_createToolPackageStoreAndInstaller = (_) => (_toolPackageStore, CreateToolPackageInstaller());
|
_createToolPackageStoreAndInstaller =
|
||||||
|
(location, forwardArguments) => (_toolPackageStore, CreateToolPackageInstaller());
|
||||||
|
|
||||||
ParseResult result = Parser.Instance.Parse($"dotnet tool install -g {PackageId}");
|
ParseResult result = Parser.Instance.Parse($"dotnet tool install -g {PackageId}");
|
||||||
_appliedCommand = result["dotnet"]["tool"]["install"];
|
_appliedCommand = result["dotnet"]["tool"]["install"];
|
||||||
|
@ -114,7 +115,7 @@ namespace Microsoft.DotNet.Tests.Commands
|
||||||
|
|
||||||
var installCommand = new ToolInstallCommand(appliedCommand,
|
var installCommand = new ToolInstallCommand(appliedCommand,
|
||||||
parseResult,
|
parseResult,
|
||||||
(_) => (_toolPackageStore, toolToolPackageInstaller),
|
(location, forwardArguments) => (_toolPackageStore, toolToolPackageInstaller),
|
||||||
_createShellShimRepository,
|
_createShellShimRepository,
|
||||||
_environmentPathInstructionMock,
|
_environmentPathInstructionMock,
|
||||||
_reporter);
|
_reporter);
|
||||||
|
@ -165,7 +166,7 @@ namespace Microsoft.DotNet.Tests.Commands
|
||||||
var installToolCommand = new ToolInstallCommand(
|
var installToolCommand = new ToolInstallCommand(
|
||||||
_appliedCommand,
|
_appliedCommand,
|
||||||
_parseResult,
|
_parseResult,
|
||||||
(_) => (_toolPackageStore, toolPackageInstaller),
|
(location, forwardArguments) => (_toolPackageStore, toolPackageInstaller),
|
||||||
_createShellShimRepository,
|
_createShellShimRepository,
|
||||||
_environmentPathInstructionMock,
|
_environmentPathInstructionMock,
|
||||||
_reporter);
|
_reporter);
|
||||||
|
@ -188,7 +189,7 @@ namespace Microsoft.DotNet.Tests.Commands
|
||||||
var installCommand = new ToolInstallCommand(
|
var installCommand = new ToolInstallCommand(
|
||||||
_appliedCommand,
|
_appliedCommand,
|
||||||
_parseResult,
|
_parseResult,
|
||||||
(_) => (_toolPackageStore, toolPackageInstaller),
|
(location, forwardArguments) => (_toolPackageStore, toolPackageInstaller),
|
||||||
_createShellShimRepository,
|
_createShellShimRepository,
|
||||||
_environmentPathInstructionMock,
|
_environmentPathInstructionMock,
|
||||||
_reporter);
|
_reporter);
|
||||||
|
@ -237,7 +238,7 @@ namespace Microsoft.DotNet.Tests.Commands
|
||||||
var installCommand = new ToolInstallCommand(
|
var installCommand = new ToolInstallCommand(
|
||||||
_appliedCommand,
|
_appliedCommand,
|
||||||
_parseResult,
|
_parseResult,
|
||||||
(_) => (_toolPackageStore, toolPackageInstaller),
|
(location, forwardArguments) => (_toolPackageStore, toolPackageInstaller),
|
||||||
_createShellShimRepository,
|
_createShellShimRepository,
|
||||||
_environmentPathInstructionMock,
|
_environmentPathInstructionMock,
|
||||||
_reporter);
|
_reporter);
|
||||||
|
@ -486,7 +487,7 @@ namespace Microsoft.DotNet.Tests.Commands
|
||||||
|
|
||||||
var installCommand = new ToolInstallCommand(appliedCommand,
|
var installCommand = new ToolInstallCommand(appliedCommand,
|
||||||
parseResult,
|
parseResult,
|
||||||
(_) => (_toolPackageStore, new ToolPackageInstallerMock(
|
(location, forwardArguments) => (_toolPackageStore, new ToolPackageInstallerMock(
|
||||||
fileSystem: _fileSystem,
|
fileSystem: _fileSystem,
|
||||||
store: _toolPackageStore,
|
store: _toolPackageStore,
|
||||||
packagedShimsMap: packagedShimsMap,
|
packagedShimsMap: packagedShimsMap,
|
||||||
|
|
|
@ -206,7 +206,7 @@ namespace Microsoft.DotNet.Tests.Commands
|
||||||
return new ToolInstallCommand(
|
return new ToolInstallCommand(
|
||||||
result["dotnet"]["tool"]["install"],
|
result["dotnet"]["tool"]["install"],
|
||||||
result,
|
result,
|
||||||
(_) => (store, packageInstallerMock),
|
(location, forwardArguments) => (store, packageInstallerMock),
|
||||||
(_) => new ShellShimRepository(
|
(_) => new ShellShimRepository(
|
||||||
new DirectoryPath(_shimsDirectory),
|
new DirectoryPath(_shimsDirectory),
|
||||||
fileSystem: _fileSystem,
|
fileSystem: _fileSystem,
|
||||||
|
|
|
@ -134,7 +134,7 @@ namespace Microsoft.DotNet.Tests.Commands
|
||||||
var command = new ToolUpdateCommand(
|
var command = new ToolUpdateCommand(
|
||||||
result["dotnet"]["tool"]["update"],
|
result["dotnet"]["tool"]["update"],
|
||||||
result,
|
result,
|
||||||
_ => (_store,
|
(location, forwardArguments) => (_store,
|
||||||
new ToolPackageInstallerMock(
|
new ToolPackageInstallerMock(
|
||||||
_fileSystem,
|
_fileSystem,
|
||||||
_store,
|
_store,
|
||||||
|
@ -163,7 +163,7 @@ namespace Microsoft.DotNet.Tests.Commands
|
||||||
var command = new ToolUpdateCommand(
|
var command = new ToolUpdateCommand(
|
||||||
result["dotnet"]["tool"]["update"],
|
result["dotnet"]["tool"]["update"],
|
||||||
result,
|
result,
|
||||||
_ => (_store,
|
(location, forwardArguments) => (_store,
|
||||||
new ToolPackageInstallerMock(
|
new ToolPackageInstallerMock(
|
||||||
_fileSystem,
|
_fileSystem,
|
||||||
_store,
|
_store,
|
||||||
|
@ -213,7 +213,7 @@ namespace Microsoft.DotNet.Tests.Commands
|
||||||
return new ToolInstallCommand(
|
return new ToolInstallCommand(
|
||||||
result["dotnet"]["tool"]["install"],
|
result["dotnet"]["tool"]["install"],
|
||||||
result,
|
result,
|
||||||
(_) => (_store, new ToolPackageInstallerMock(
|
(location, forwardArguments) => (_store, new ToolPackageInstallerMock(
|
||||||
_fileSystem,
|
_fileSystem,
|
||||||
_store,
|
_store,
|
||||||
new ProjectRestorerMock(
|
new ProjectRestorerMock(
|
||||||
|
@ -233,7 +233,7 @@ namespace Microsoft.DotNet.Tests.Commands
|
||||||
return new ToolUpdateCommand(
|
return new ToolUpdateCommand(
|
||||||
result["dotnet"]["tool"]["update"],
|
result["dotnet"]["tool"]["update"],
|
||||||
result,
|
result,
|
||||||
(_) => (_store, new ToolPackageInstallerMock(
|
(location, forwardArguments) => (_store, new ToolPackageInstallerMock(
|
||||||
_fileSystem,
|
_fileSystem,
|
||||||
_store,
|
_store,
|
||||||
new ProjectRestorerMock(
|
new ProjectRestorerMock(
|
||||||
|
|
|
@ -108,5 +108,35 @@ namespace Microsoft.DotNet.Tests.ParserTests
|
||||||
var appliedOptions = result["dotnet"]["tool"]["install"];
|
var appliedOptions = result["dotnet"]["tool"]["install"];
|
||||||
appliedOptions.SingleArgumentOrDefault("tool-path").Should().Be(@"C:\Tools");
|
appliedOptions.SingleArgumentOrDefault("tool-path").Should().Be(@"C:\Tools");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void InstallToolParserCanParseNoCacheOption()
|
||||||
|
{
|
||||||
|
var result =
|
||||||
|
Parser.Instance.Parse(@"dotnet tool install -g console.test.app --no-cache");
|
||||||
|
|
||||||
|
var appliedOptions = result["dotnet"]["tool"]["install"];
|
||||||
|
appliedOptions.OptionValuesToBeForwarded().Should().ContainSingle("--no-cache");
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void InstallToolParserCanParseIgnoreFailedSourcesOption()
|
||||||
|
{
|
||||||
|
var result =
|
||||||
|
Parser.Instance.Parse(@"dotnet tool install -g console.test.app --ignore-failed-sources");
|
||||||
|
|
||||||
|
var appliedOptions = result["dotnet"]["tool"]["install"];
|
||||||
|
appliedOptions.OptionValuesToBeForwarded().Should().ContainSingle("--ignore-failed-sources");
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void InstallToolParserCanParseDisableParallelOption()
|
||||||
|
{
|
||||||
|
var result =
|
||||||
|
Parser.Instance.Parse(@"dotnet tool install -g console.test.app --disable-parallel");
|
||||||
|
|
||||||
|
var appliedOptions = result["dotnet"]["tool"]["install"];
|
||||||
|
appliedOptions.OptionValuesToBeForwarded().Should().ContainSingle("--disable-parallel");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -107,5 +107,35 @@ namespace Microsoft.DotNet.Tests.ParserTests
|
||||||
var appliedOptions = result["dotnet"]["tool"]["update"];
|
var appliedOptions = result["dotnet"]["tool"]["update"];
|
||||||
appliedOptions.SingleArgumentOrDefault("tool-path").Should().Be(@"C:\TestAssetLocalNugetFeed");
|
appliedOptions.SingleArgumentOrDefault("tool-path").Should().Be(@"C:\TestAssetLocalNugetFeed");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void UpdateToolParserCanParseNoCacheOption()
|
||||||
|
{
|
||||||
|
var result =
|
||||||
|
Parser.Instance.Parse(@"dotnet tool update -g console.test.app --no-cache");
|
||||||
|
|
||||||
|
var appliedOptions = result["dotnet"]["tool"]["update"];
|
||||||
|
appliedOptions.OptionValuesToBeForwarded().Should().ContainSingle("--no-cache");
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void UpdateToolParserCanParseIgnoreFailedSourcesOption()
|
||||||
|
{
|
||||||
|
var result =
|
||||||
|
Parser.Instance.Parse(@"dotnet tool update -g console.test.app --ignore-failed-sources");
|
||||||
|
|
||||||
|
var appliedOptions = result["dotnet"]["tool"]["update"];
|
||||||
|
appliedOptions.OptionValuesToBeForwarded().Should().ContainSingle("--ignore-failed-sources");
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void UpdateToolParserCanParseDisableParallelOption()
|
||||||
|
{
|
||||||
|
var result =
|
||||||
|
Parser.Instance.Parse(@"dotnet tool update -g console.test.app --disable-parallel");
|
||||||
|
|
||||||
|
var appliedOptions = result["dotnet"]["tool"]["update"];
|
||||||
|
appliedOptions.OptionValuesToBeForwarded().Should().ContainSingle("--disable-parallel");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue