2017-03-06 11:57:19 -08: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.
|
|
|
|
|
2017-06-02 23:32:53 -07:00
|
|
|
using System.Collections.Generic;
|
|
|
|
using System.Linq;
|
2017-03-06 11:57:19 -08:00
|
|
|
using Microsoft.DotNet.Cli.CommandLine;
|
2017-06-07 14:43:48 -07:00
|
|
|
using Microsoft.DotNet.Tools;
|
2017-03-10 09:08:01 -08:00
|
|
|
using Microsoft.DotNet.Tools.Run;
|
|
|
|
using LocalizableStrings = Microsoft.DotNet.Tools.Run.LocalizableStrings;
|
2017-03-06 11:57:19 -08:00
|
|
|
|
|
|
|
namespace Microsoft.DotNet.Cli
|
|
|
|
{
|
|
|
|
internal static class RunCommandParser
|
|
|
|
{
|
|
|
|
public static Command Run() =>
|
2017-06-07 14:43:48 -07:00
|
|
|
CreateWithRestoreOptions.Command(
|
2017-03-10 09:08:01 -08:00
|
|
|
"run",
|
2017-03-10 13:36:18 -08:00
|
|
|
LocalizableStrings.AppFullName,
|
2017-03-19 14:35:11 -07:00
|
|
|
treatUnmatchedTokensAsErrors: false,
|
|
|
|
arguments: Accept.ZeroOrMoreArguments()
|
2017-04-12 16:03:45 -07:00
|
|
|
.MaterializeAs(o => new RunCommand
|
|
|
|
(
|
|
|
|
configuration: o.SingleArgumentOrDefault("--configuration"),
|
|
|
|
framework: o.SingleArgumentOrDefault("--framework"),
|
|
|
|
noBuild: o.HasOption("--no-build"),
|
|
|
|
project: o.SingleArgumentOrDefault("--project"),
|
2017-05-25 18:47:59 -07:00
|
|
|
launchProfile: o.SingleArgumentOrDefault("--launch-profile"),
|
|
|
|
noLaunchProfile: o.HasOption("--no-launch-profile"),
|
2017-11-27 21:09:26 -08:00
|
|
|
noRestore: o.HasOption("--no-restore") || o.HasOption("--no-build"),
|
2017-06-02 23:32:53 -07:00
|
|
|
restoreArgs: o.OptionValuesToBeForwarded(),
|
2017-04-12 16:03:45 -07:00
|
|
|
args: o.Arguments
|
|
|
|
)),
|
2017-06-07 14:43:48 -07:00
|
|
|
options: new[]
|
2017-03-19 14:35:11 -07:00
|
|
|
{
|
|
|
|
CommonOptions.HelpOption(),
|
|
|
|
CommonOptions.ConfigurationOption(),
|
|
|
|
CommonOptions.FrameworkOption(),
|
|
|
|
Create.Option(
|
|
|
|
"-p|--project",
|
|
|
|
LocalizableStrings.CommandOptionProjectDescription,
|
|
|
|
Accept.ExactlyOneArgument()),
|
2017-05-25 18:47:59 -07:00
|
|
|
Create.Option(
|
|
|
|
"--launch-profile",
|
|
|
|
LocalizableStrings.CommandOptionLaunchProfileDescription,
|
|
|
|
Accept.ExactlyOneArgument()),
|
|
|
|
Create.Option(
|
|
|
|
"--no-launch-profile",
|
|
|
|
LocalizableStrings.CommandOptionNoLaunchProfileDescription,
|
|
|
|
Accept.NoArguments()),
|
2017-03-19 14:35:11 -07:00
|
|
|
Create.Option(
|
|
|
|
"--no-build",
|
|
|
|
LocalizableStrings.CommandOptionNoBuildDescription,
|
2017-06-01 21:25:06 -07:00
|
|
|
Accept.NoArguments()),
|
2017-11-27 23:03:33 -08:00
|
|
|
CommonOptions.NoRestoreOption(),
|
|
|
|
CommonOptions.VerbosityOption()
|
2017-06-07 14:43:48 -07:00
|
|
|
});
|
2017-03-06 11:57:19 -08:00
|
|
|
}
|
2017-03-19 14:35:11 -07:00
|
|
|
}
|