2016-02-10 00:35:43 +00:00
|
|
|
|
// 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.
|
|
|
|
|
|
2016-04-15 04:33:41 +00:00
|
|
|
|
using System;
|
2016-02-10 00:35:43 +00:00
|
|
|
|
using System.Collections.Generic;
|
2016-04-15 04:33:41 +00:00
|
|
|
|
using System.Diagnostics;
|
|
|
|
|
using Microsoft.DotNet.Cli.Utils;
|
2016-02-10 00:35:43 +00:00
|
|
|
|
using NuGet.Frameworks;
|
|
|
|
|
|
2016-04-15 04:33:41 +00:00
|
|
|
|
namespace Microsoft.DotNet.Cli
|
2016-02-10 00:35:43 +00:00
|
|
|
|
{
|
|
|
|
|
public class DotNetCommandFactory : ICommandFactory
|
|
|
|
|
{
|
2016-02-06 02:55:15 +00:00
|
|
|
|
public ICommand Create(
|
|
|
|
|
string commandName,
|
|
|
|
|
IEnumerable<string> args,
|
|
|
|
|
NuGetFramework framework = null,
|
|
|
|
|
string configuration = Constants.DefaultConfiguration)
|
2016-02-10 00:35:43 +00:00
|
|
|
|
{
|
2016-04-15 04:33:41 +00:00
|
|
|
|
Func<string[], int> builtInCommand;
|
|
|
|
|
if (Program.TryGetBuiltInCommand(commandName, out builtInCommand))
|
|
|
|
|
{
|
|
|
|
|
Debug.Assert(framework == null, "BuiltInCommand doesn't support the 'framework' argument.");
|
|
|
|
|
Debug.Assert(configuration == Constants.DefaultConfiguration, "BuiltInCommand doesn't support the 'configuration' argument.");
|
|
|
|
|
|
|
|
|
|
return new BuiltInCommand(commandName, args, builtInCommand);
|
|
|
|
|
}
|
|
|
|
|
|
2016-02-06 02:55:15 +00:00
|
|
|
|
return Command.CreateDotNet(commandName, args, framework, configuration);
|
2016-02-10 00:35:43 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|