dotnet-installer/src/Microsoft.DotNet.Cli.Utils/CommandResolver.cs

57 lines
1.9 KiB
C#
Raw Normal View History

// 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 System.Collections.Generic;
2016-01-06 10:27:16 +00:00
using System.IO;
using NuGet.Frameworks;
2016-01-06 10:27:16 +00:00
namespace Microsoft.DotNet.Cli.Utils
{
internal class CommandResolver
2016-01-06 10:27:16 +00:00
{
public static CommandSpec TryResolveCommandSpec(
string commandName,
IEnumerable<string> args,
NuGetFramework framework = null,
string configuration = Constants.DefaultConfiguration,
string outputPath = null,
string applicationName = null)
{
return TryResolveCommandSpec(
new DefaultCommandResolverPolicy(),
commandName,
args,
framework,
configuration,
outputPath,
applicationName);
}
public static CommandSpec TryResolveCommandSpec(
ICommandResolverPolicy commandResolverPolicy,
string commandName,
IEnumerable<string> args,
NuGetFramework framework = null,
string configuration = Constants.DefaultConfiguration,
string outputPath = null,
string applicationName = null)
2016-01-06 10:27:16 +00:00
{
var commandResolverArgs = new CommandResolverArguments
2016-01-06 10:27:16 +00:00
{
CommandName = commandName,
CommandArguments = args,
Framework = framework,
ProjectDirectory = Directory.GetCurrentDirectory(),
Configuration = configuration,
OutputPath = outputPath,
ApplicationName = applicationName
};
var defaultCommandResolver = commandResolverPolicy.CreateCommandResolver();
return defaultCommandResolver.Resolve(commandResolverArgs);
}
2016-01-06 10:27:16 +00:00
}
}