dotnet-installer/src/dotnet/commands/dotnet-run/RunCommandParser.cs

41 lines
1.7 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 Microsoft.DotNet.Cli.CommandLine;
2017-03-10 09:08:01 -08:00
using Microsoft.DotNet.Tools.Run;
using LocalizableStrings = Microsoft.DotNet.Tools.Run.LocalizableStrings;
namespace Microsoft.DotNet.Cli
{
internal static class RunCommandParser
{
public static Command Run() =>
2017-03-10 09:08:01 -08:00
Create.Command(
"run",
2017-03-10 13:36:18 -08:00
LocalizableStrings.AppFullName,
treatUnmatchedTokensAsErrors: false,
arguments: Accept.ZeroOrMoreArguments()
.MaterializeAs(o => new RunCommand
(
configuration: o.SingleArgumentOrDefault("--configuration"),
framework: o.SingleArgumentOrDefault("--framework"),
noBuild: o.HasOption("--no-build"),
project: o.SingleArgumentOrDefault("--project"),
args: o.Arguments
)),
options: new[]
{
CommonOptions.HelpOption(),
CommonOptions.ConfigurationOption(),
CommonOptions.FrameworkOption(),
Create.Option(
"-p|--project",
LocalizableStrings.CommandOptionProjectDescription,
Accept.ExactlyOneArgument()),
Create.Option(
"--no-build",
LocalizableStrings.CommandOptionNoBuildDescription,
2017-03-21 14:55:33 -07:00
Accept.NoArguments())
});
}
}