Add source option to install tool command.

This commit adds the `--source` option to the `install tool` command.  This
option is equivalent to the option of the same name for the `restore` command.

The option is forwarded to the underlying restore operation.

Fixes #8226.
This commit is contained in:
Peter Huene 2018-01-11 13:54:02 -08:00
parent a212d5a017
commit fe89456f2a
No known key found for this signature in database
GPG key ID: E1D265D820213D6A
22 changed files with 423 additions and 43 deletions

View file

@ -4,6 +4,7 @@
using System;
using System.Collections.Generic;
using Microsoft.DotNet.Cli;
using Microsoft.DotNet.Cli.Utils;
using Microsoft.DotNet.ToolPackage;
using Microsoft.DotNet.PlatformAbstractions;
using Microsoft.Extensions.EnvironmentAbstractions;
@ -15,7 +16,8 @@ namespace Microsoft.DotNet.Tools.Install.Tool
public void Restore(
FilePath projectPath,
DirectoryPath assetJsonOutput,
FilePath? nugetconfig)
FilePath? nugetconfig,
string source = null)
{
var argsToPassToRestore = new List<string>();
@ -26,6 +28,12 @@ namespace Microsoft.DotNet.Tools.Install.Tool
argsToPassToRestore.Add(nugetconfig.Value.Value);
}
if (source != null)
{
argsToPassToRestore.Add("--source");
argsToPassToRestore.Add(source);
}
argsToPassToRestore.AddRange(new List<string>
{
"--runtime",
@ -34,9 +42,7 @@ namespace Microsoft.DotNet.Tools.Install.Tool
});
var command = new DotNetCommandFactory(alwaysRunOutOfProc: true)
.Create(
"restore",
argsToPassToRestore)
.Create("restore", argsToPassToRestore)
.CaptureStdOut()
.CaptureStdErr();