From b4cf73ec204c1a719c2c3d60c91fbc3c5f1ff485 Mon Sep 17 00:00:00 2001 From: jonsequitur Date: Sun, 19 Mar 2017 14:35:11 -0700 Subject: [PATCH] add additional args to dotnet run help --- src/dotnet/commands/dotnet-run/RunCommand.cs | 6 +-- .../commands/dotnet-run/RunCommandParser.cs | 48 +++++++++---------- 2 files changed, 25 insertions(+), 29 deletions(-) diff --git a/src/dotnet/commands/dotnet-run/RunCommand.cs b/src/dotnet/commands/dotnet-run/RunCommand.cs index e9f0c8bdd..225757c50 100644 --- a/src/dotnet/commands/dotnet-run/RunCommand.cs +++ b/src/dotnet/commands/dotnet-run/RunCommand.cs @@ -16,14 +16,10 @@ namespace Microsoft.DotNet.Tools.Run public string Configuration { get; set; } public string Framework { get; set; } public string Project { get; set; } - public IReadOnlyList Args { get; set; } + public IReadOnlyCollection Args { get; set; } private List _args; - public RunCommand() - { - } - public int Start() { Initialize(); diff --git a/src/dotnet/commands/dotnet-run/RunCommandParser.cs b/src/dotnet/commands/dotnet-run/RunCommandParser.cs index 737e43b23..1dc22c122 100644 --- a/src/dotnet/commands/dotnet-run/RunCommandParser.cs +++ b/src/dotnet/commands/dotnet-run/RunCommandParser.cs @@ -1,7 +1,6 @@ // 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; using Microsoft.DotNet.Cli.CommandLine; using Microsoft.DotNet.Tools.Run; using LocalizableStrings = Microsoft.DotNet.Tools.Run.LocalizableStrings; @@ -14,27 +13,28 @@ namespace Microsoft.DotNet.Cli Create.Command( "run", LocalizableStrings.AppFullName, - Accept.ZeroOrMoreArguments() - .MaterializeAs(o => - { - return new RunCommand() - { - Configuration = o.SingleArgumentOrDefault("--configuration"), - Framework = o.SingleArgumentOrDefault("--framework"), - Project = o.SingleArgumentOrDefault("--project"), - Args = (IReadOnlyList)o.Arguments - }; - }), - CommonOptions.HelpOption(), - CommonOptions.ConfigurationOption(), - CommonOptions.FrameworkOption(), - Create.Option( - "-p|--project", - LocalizableStrings.CommandOptionProjectDescription, - Accept.ExactlyOneArgument()), - Create.Option( - "--no-build", - LocalizableStrings.CommandOptionNoBuildDescription, - Accept.NoArguments().ForwardAs("/p:NoBuild=true"))); + treatUnmatchedTokensAsErrors: false, + arguments: Accept.ZeroOrMoreArguments() + .MaterializeAs(o => new RunCommand + { + Configuration = o.SingleArgumentOrDefault("--configuration"), + Framework = o.SingleArgumentOrDefault("--framework"), + 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, + Accept.NoArguments().ForwardAs("/p:NoBuild=true")) + }); } -} +} \ No newline at end of file