publish, cache, text fixes; rename ForwardAs and introduce ForwardAsMany

This commit is contained in:
jonsequitur 2017-03-16 13:22:08 -07:00
parent 8aa702dc97
commit 973021b214
15 changed files with 72 additions and 63 deletions

View file

@ -13,37 +13,36 @@ namespace Microsoft.DotNet.Cli
public static ArgumentsRule ForwardAs( public static ArgumentsRule ForwardAs(
this ArgumentsRule rule, this ArgumentsRule rule,
string template) => string value) =>
rule.MaterializeAs(o => new ForwardedArgument(template)); rule.MaterializeAs(o => new ForwardedArgument(value));
public static ArgumentsRule ForwardAs( public static ArgumentsRule ForwardAsSingle(
this ArgumentsRule rule, this ArgumentsRule rule,
Func<AppliedOption, string> format) => Func<AppliedOption, string> format) =>
rule.MaterializeAs(o => rule.MaterializeAs(o =>
new ForwardedArgument(format(o))); new ForwardedArgument(format(o)));
public static ArgumentsRule ForwardAsMany(
this ArgumentsRule rule,
Func<AppliedOption, IEnumerable<string>> format) =>
rule.MaterializeAs(o =>
new ForwardedArgument(format(o).ToArray()));
public static IEnumerable<string> OptionValuesToBeForwarded( public static IEnumerable<string> OptionValuesToBeForwarded(
this AppliedOption command) => this AppliedOption command) =>
command.AppliedOptions command.AppliedOptions
.Select(o => o.Value()) .Select(o => o.Value())
.OfType<ForwardedArgument>() .OfType<ForwardedArgument>()
.Select(o => o.ToString()); .SelectMany(o => o.Values);
private class ForwardedArgument private class ForwardedArgument
{ {
private readonly string _value; public ForwardedArgument(params string[] values)
public ForwardedArgument(string value)
{ {
_value = value; Values = values;
} }
public override string ToString() => _value; public string[] Values { get; }
public static explicit operator string(ForwardedArgument argument)
{
return argument.ToString();
}
} }
} }
} }

View file

@ -25,7 +25,7 @@ namespace Microsoft.DotNet.Cli
"n", "normal", "n", "normal",
"d", "detailed", "d", "detailed",
"diag", "diagnostic") "diag", "diagnostic")
.ForwardAs(o => $"/verbosity:{o.Arguments.Single()}")); .ForwardAsSingle(o => $"/verbosity:{o.Arguments.Single()}"));
public static Option FrameworkOption() => public static Option FrameworkOption() =>
Create.Option( Create.Option(
@ -34,7 +34,7 @@ namespace Microsoft.DotNet.Cli
Accept.ExactlyOneArgument() Accept.ExactlyOneArgument()
.WithSuggestionsFrom(_ => Suggest.TargetFrameworksFromProjectFile()) .WithSuggestionsFrom(_ => Suggest.TargetFrameworksFromProjectFile())
.With(name: "FRAMEWORK") .With(name: "FRAMEWORK")
.ForwardAs(o => $"/p:TargetFramework={o.Arguments.Single()}")); .ForwardAsSingle(o => $"/p:TargetFramework={o.Arguments.Single()}"));
public static Option RuntimeOption() => public static Option RuntimeOption() =>
Create.Option( Create.Option(
@ -43,7 +43,7 @@ namespace Microsoft.DotNet.Cli
Accept.ExactlyOneArgument() Accept.ExactlyOneArgument()
.WithSuggestionsFrom(_ => Suggest.RunTimesFromProjectFile()) .WithSuggestionsFrom(_ => Suggest.RunTimesFromProjectFile())
.With(name: "RUNTIME_IDENTIFIER") .With(name: "RUNTIME_IDENTIFIER")
.ForwardAs(o => $"/p:RuntimeIdentifier={o.Arguments.Single()}")); .ForwardAsSingle(o => $"/p:RuntimeIdentifier={o.Arguments.Single()}"));
public static Option ConfigurationOption() => public static Option ConfigurationOption() =>
Create.Option( Create.Option(
@ -52,7 +52,7 @@ namespace Microsoft.DotNet.Cli
Accept.ExactlyOneArgument() Accept.ExactlyOneArgument()
.With(name: "CONFIGURATION") .With(name: "CONFIGURATION")
.WithSuggestionsFrom("DEBUG", "RELEASE") .WithSuggestionsFrom("DEBUG", "RELEASE")
.ForwardAs(o => $"/p:Configuration={o.Arguments.Single()}")); .ForwardAsSingle(o => $"/p:Configuration={o.Arguments.Single()}"));
public static Option VersionSuffixOption() => public static Option VersionSuffixOption() =>
Create.Option( Create.Option(
@ -60,7 +60,7 @@ namespace Microsoft.DotNet.Cli
"Defines the value for the $(VersionSuffix) property in the project.", "Defines the value for the $(VersionSuffix) property in the project.",
Accept.ExactlyOneArgument() Accept.ExactlyOneArgument()
.With(name: "VERSION_SUFFIX") .With(name: "VERSION_SUFFIX")
.ForwardAs(o => $"/p:VersionSuffix={o.Arguments.Single()}")); .ForwardAsSingle(o => $"/p:VersionSuffix={o.Arguments.Single()}"));
public static ArgumentsRule DefaultToCurrentDirectory(this ArgumentsRule rule) => public static ArgumentsRule DefaultToCurrentDirectory(this ArgumentsRule rule) =>
rule.With(defaultValue: () => PathUtility.EnsureTrailingSlash(Directory.GetCurrentDirectory())); rule.With(defaultValue: () => PathUtility.EnsureTrailingSlash(Directory.GetCurrentDirectory()));

View file

@ -34,24 +34,24 @@ namespace Microsoft.DotNet.Cli
"Version for the package to be added.", "Version for the package to be added.",
Accept.ExactlyOneArgument() Accept.ExactlyOneArgument()
.With(name: "VERSION") .With(name: "VERSION")
.ForwardAs(o => $"--version {o.Arguments.Single()}")), .ForwardAsSingle(o => $"--version {o.Arguments.Single()}")),
Create.Option("-f|--framework", Create.Option("-f|--framework",
LocalizableStrings.CmdFrameworkDescription, LocalizableStrings.CmdFrameworkDescription,
Accept.ExactlyOneArgument() Accept.ExactlyOneArgument()
.With(name: "FRAMEWORK") .With(name: "FRAMEWORK")
.ForwardAs(o => $"--framework {o.Arguments.Single()}")), .ForwardAsSingle(o => $"--framework {o.Arguments.Single()}")),
Create.Option("-n|--no-restore ", Create.Option("-n|--no-restore ",
"Add reference without performing restore preview and compatibility check."), "Add reference without performing restore preview and compatibility check."),
Create.Option("-s|--source", Create.Option("-s|--source",
"Use specific NuGet package sources to use during the restore.", "Use specific NuGet package sources to use during the restore.",
Accept.ExactlyOneArgument() Accept.ExactlyOneArgument()
.With(name: "SOURCE") .With(name: "SOURCE")
.ForwardAs(o => $"--source {o.Arguments.Single()}")), .ForwardAsSingle(o => $"--source {o.Arguments.Single()}")),
Create.Option("--package-directory", Create.Option("--package-directory",
"Restore the packages to this Directory .", "Restore the packages to this Directory .",
Accept.ExactlyOneArgument() Accept.ExactlyOneArgument()
.With(name: "PACKAGE_DIRECTORY") .With(name: "PACKAGE_DIRECTORY")
.ForwardAs(o => $"--package-directory {o.Arguments.Single()}"))), .ForwardAsSingle(o => $"--package-directory {o.Arguments.Single()}"))),
Create.Command( Create.Command(
"reference", "reference",
Tools.Add.ProjectToProjectReference.LocalizableStrings.AppFullName, Tools.Add.ProjectToProjectReference.LocalizableStrings.AppFullName,

View file

@ -23,7 +23,7 @@ namespace Microsoft.DotNet.Cli
LocalizableStrings.OutputOptionDescription, LocalizableStrings.OutputOptionDescription,
Accept.ExactlyOneArgument() Accept.ExactlyOneArgument()
.With(name: LocalizableStrings.OutputOptionName) .With(name: LocalizableStrings.OutputOptionName)
.ForwardAs(o => $"/p:OutputPath={o.Arguments.Single()}")), .ForwardAsSingle(o => $"/p:OutputPath={o.Arguments.Single()}")),
CommonOptions.FrameworkOption(), CommonOptions.FrameworkOption(),
CommonOptions.RuntimeOption(), CommonOptions.RuntimeOption(),
CommonOptions.ConfigurationOption(), CommonOptions.ConfigurationOption(),

View file

@ -19,24 +19,34 @@ namespace Microsoft.DotNet.Cli
"-e|--entries", "-e|--entries",
LocalizableStrings.ProjectEntryDescription, LocalizableStrings.ProjectEntryDescription,
Accept.OneOrMoreArguments() Accept.OneOrMoreArguments()
.With(name: LocalizableStrings.ProjectEntries) .With(name: LocalizableStrings.ProjectEntries)
.ForwardAs(o => .ForwardAsMany(o =>
{ {
var materializedString = $"{o.Arguments.First()}"; var materializedString = $"{o.Arguments.First()}";
if (o.Arguments.Count() == 1) return materializedString; if (o.Arguments.Count == 1)
{
var additionalProjects = string.Join("%3B", o.Arguments.Skip(1)); return new[]
{
return $"{materializedString} /p:AdditionalProjects={additionalProjects}"; materializedString
})), };
}
else
{
return new[]
{
materializedString,
$"/p:AdditionalProjects={string.Join("%3B", o.Arguments.Skip(1))}"
};
}
})),
CommonOptions.FrameworkOption(), CommonOptions.FrameworkOption(),
Create.Option( Create.Option(
"--framework-version", "--framework-version",
LocalizableStrings.FrameworkVersionOptionDescription, LocalizableStrings.FrameworkVersionOptionDescription,
Accept.ExactlyOneArgument() Accept.ExactlyOneArgument()
.With(name: LocalizableStrings.FrameworkVersionOption) .With(name: LocalizableStrings.FrameworkVersionOption)
.ForwardAs(o => $"/p:FX_Version={o.Arguments.Single()}")), .ForwardAsSingle(o => $"/p:FX_Version={o.Arguments.Single()}")),
CommonOptions.RuntimeOption(), CommonOptions.RuntimeOption(),
CommonOptions.ConfigurationOption(), CommonOptions.ConfigurationOption(),
Create.Option( Create.Option(
@ -44,18 +54,18 @@ namespace Microsoft.DotNet.Cli
LocalizableStrings.OutputOptionDescription, LocalizableStrings.OutputOptionDescription,
Accept.ExactlyOneArgument() Accept.ExactlyOneArgument()
.With(name: LocalizableStrings.OutputOption) .With(name: LocalizableStrings.OutputOption)
.ForwardAs(o => $"/p:ComposeDir={o.Arguments.Single()}")), .ForwardAsSingle(o => $"/p:ComposeDir={o.Arguments.Single()}")),
Create.Option( Create.Option(
"-w|--working-dir", "-w|--working-dir",
LocalizableStrings.IntermediateWorkingDirOptionDescription, LocalizableStrings.IntermediateWorkingDirOptionDescription,
Accept.ExactlyOneArgument() Accept.ExactlyOneArgument()
.With(name: LocalizableStrings.IntermediateWorkingDirOption) .With(name: LocalizableStrings.IntermediateWorkingDirOption)
.ForwardAs(o => $"/p:ComposeWorkingDir={o.Arguments.Single()}")), .ForwardAsSingle(o => $"/p:ComposeWorkingDir={o.Arguments.Single()}")),
Create.Option( Create.Option(
"--preserve-working-dir", "--preserve-working-dir",
LocalizableStrings.PreserveIntermediateWorkingDirOptionDescription, LocalizableStrings.PreserveIntermediateWorkingDirOptionDescription,
Accept.NoArguments() Accept.NoArguments()
.ForwardAs(o => $"/p:PreserveComposeWorkingDir=true")), .ForwardAsSingle(o => $"/p:PreserveComposeWorkingDir=true")),
Create.Option( Create.Option(
"--skip-optimization", "--skip-optimization",
LocalizableStrings.SkipOptimizationOptionDescription, LocalizableStrings.SkipOptimizationOptionDescription,

View file

@ -19,7 +19,7 @@ namespace Microsoft.DotNet.Cli
LocalizableStrings.CmdOutputDirDescription, LocalizableStrings.CmdOutputDirDescription,
Accept.ExactlyOneArgument() Accept.ExactlyOneArgument()
.With(name: LocalizableStrings.CmdOutputDir) .With(name: LocalizableStrings.CmdOutputDir)
.ForwardAs(o => $"/p:OutputPath={o.Arguments.Single()}")), .ForwardAsSingle(o => $"/p:OutputPath={o.Arguments.Single()}")),
CommonOptions.FrameworkOption(), CommonOptions.FrameworkOption(),
CommonOptions.ConfigurationOption(), CommonOptions.ConfigurationOption(),
CommonOptions.VerbosityOption()); CommonOptions.VerbosityOption());

View file

@ -20,7 +20,7 @@ namespace Microsoft.DotNet.Cli
LocalizableStrings.CmdOutputDirDescription, LocalizableStrings.CmdOutputDirDescription,
Accept.ExactlyOneArgument() Accept.ExactlyOneArgument()
.With(name: LocalizableStrings.CmdOutputDir) .With(name: LocalizableStrings.CmdOutputDir)
.ForwardAs(o => $"/p:PackageOutputPath={o.Arguments.Single()}")), .ForwardAsSingle(o => $"/p:PackageOutputPath={o.Arguments.Single()}")),
Create.Option( Create.Option(
"--no-build", "--no-build",
LocalizableStrings.CmdNoBuildOptionDescription, LocalizableStrings.CmdNoBuildOptionDescription,

View file

@ -22,15 +22,15 @@ namespace Microsoft.DotNet.Cli
LocalizableStrings.OutputOptionDescription, LocalizableStrings.OutputOptionDescription,
Accept.ExactlyOneArgument() Accept.ExactlyOneArgument()
.With(name: LocalizableStrings.OutputOption) .With(name: LocalizableStrings.OutputOption)
.ForwardAs(o => $"/p:PublishDir={o.Arguments.Single()}")), .ForwardAsSingle(o => $"/p:PublishDir={o.Arguments.Single()}")),
CommonOptions.ConfigurationOption(), CommonOptions.ConfigurationOption(),
CommonOptions.VersionSuffixOption(), CommonOptions.VersionSuffixOption(),
Create.Option( Create.Option(
"--filter", "--filter",
LocalizableStrings.FilterProjOptionDescription, LocalizableStrings.FilterProjOptionDescription,
Accept.ExactlyOneArgument() Accept.OneOrMoreArguments()
.With(name: LocalizableStrings.FilterProjOption) .With(name: LocalizableStrings.FilterProjOption)
.ForwardAs(o => $"/p:FilterProjectFiles={o.Arguments.Single()}")), .ForwardAsSingle(o => $"/p:FilterProjectFiles={string.Join("%3B", o.Arguments)}")),
CommonOptions.VerbosityOption()); CommonOptions.VerbosityOption());
} }
} }

View file

@ -20,20 +20,20 @@ namespace Microsoft.DotNet.Cli
LocalizableStrings.CmdSourceOptionDescription, LocalizableStrings.CmdSourceOptionDescription,
Accept.OneOrMoreArguments() Accept.OneOrMoreArguments()
.With(name: LocalizableStrings.CmdSourceOption) .With(name: LocalizableStrings.CmdSourceOption)
.ForwardAs(o => $"/p:RestoreSources={string.Join("%3B", o.Arguments)}")), .ForwardAsSingle(o => $"/p:RestoreSources={string.Join("%3B", o.Arguments)}")),
Create.Option( Create.Option(
"-r|--runtime", "-r|--runtime",
LocalizableStrings.CmdRuntimeOptionDescription, LocalizableStrings.CmdRuntimeOptionDescription,
Accept.OneOrMoreArguments() Accept.OneOrMoreArguments()
.WithSuggestionsFrom(_ => Suggest.RunTimesFromProjectFile()) .WithSuggestionsFrom(_ => Suggest.RunTimesFromProjectFile())
.With(name: LocalizableStrings.CmdRuntimeOption) .With(name: LocalizableStrings.CmdRuntimeOption)
.ForwardAs(o => $"/p:RuntimeIdentifiers={string.Join("%3B", o.Arguments)}")), .ForwardAsSingle(o => $"/p:RuntimeIdentifiers={string.Join("%3B", o.Arguments)}")),
Create.Option( Create.Option(
"--packages", "--packages",
LocalizableStrings.CmdPackagesOptionDescription, LocalizableStrings.CmdPackagesOptionDescription,
Accept.ExactlyOneArgument() Accept.ExactlyOneArgument()
.With(name: LocalizableStrings.CmdPackagesOption) .With(name: LocalizableStrings.CmdPackagesOption)
.ForwardAs(o => $"/p:RestorePackagesPath={o.Arguments.Single()}")), .ForwardAsSingle(o => $"/p:RestorePackagesPath={o.Arguments.Single()}")),
Create.Option( Create.Option(
"--disable-parallel", "--disable-parallel",
LocalizableStrings.CmdDisableParallelOptionDescription, LocalizableStrings.CmdDisableParallelOptionDescription,
@ -44,7 +44,7 @@ namespace Microsoft.DotNet.Cli
LocalizableStrings.CmdConfigFileOptionDescription, LocalizableStrings.CmdConfigFileOptionDescription,
Accept.ExactlyOneArgument() Accept.ExactlyOneArgument()
.With(name: LocalizableStrings.CmdConfigFileOption) .With(name: LocalizableStrings.CmdConfigFileOption)
.ForwardAs(o => $"/p:RestoreConfigFile={o.Arguments.Single()}")), .ForwardAsSingle(o => $"/p:RestoreConfigFile={o.Arguments.Single()}")),
Create.Option( Create.Option(
"--no-cache", "--no-cache",
LocalizableStrings.CmdNoCacheOptionDescription, LocalizableStrings.CmdNoCacheOptionDescription,

View file

@ -20,30 +20,30 @@ namespace Microsoft.DotNet.Cli
LocalizableStrings.CmdSettingsDescription, LocalizableStrings.CmdSettingsDescription,
Accept.ExactlyOneArgument() Accept.ExactlyOneArgument()
.With(name: LocalizableStrings.CmdSettingsFile) .With(name: LocalizableStrings.CmdSettingsFile)
.ForwardAs(o => $"/p:VSTestSetting={o.Arguments.Single()}")), .ForwardAsSingle(o => $"/p:VSTestSetting={o.Arguments.Single()}")),
Create.Option( Create.Option(
"-t|--list-tests", "-t|--list-tests",
LocalizableStrings.CmdListTestsDescription, LocalizableStrings.CmdListTestsDescription,
Accept.NoArguments() Accept.NoArguments()
.ForwardAs(o => "/p:VSTestListTests=true")), .ForwardAsSingle(o => "/p:VSTestListTests=true")),
Create.Option( Create.Option(
"--filter", "--filter",
LocalizableStrings.CmdTestCaseFilterDescription, LocalizableStrings.CmdTestCaseFilterDescription,
Accept.ExactlyOneArgument() Accept.ExactlyOneArgument()
.With(name: LocalizableStrings.CmdTestCaseFilterExpression) .With(name: LocalizableStrings.CmdTestCaseFilterExpression)
.ForwardAs(o => $"/p:VSTestTestCaseFilter={o.Arguments.Single()}")), .ForwardAsSingle(o => $"/p:VSTestTestCaseFilter={o.Arguments.Single()}")),
Create.Option( Create.Option(
"-a|--test-adapter-path", "-a|--test-adapter-path",
LocalizableStrings.CmdTestAdapterPathDescription, LocalizableStrings.CmdTestAdapterPathDescription,
Accept.ExactlyOneArgument() Accept.ExactlyOneArgument()
.With(name: LocalizableStrings.CmdTestAdapterPath) .With(name: LocalizableStrings.CmdTestAdapterPath)
.ForwardAs(o => $"/p:VSTestTestAdapterPath={o.Arguments.Single()}")), .ForwardAsSingle(o => $"/p:VSTestTestAdapterPath={o.Arguments.Single()}")),
Create.Option( Create.Option(
"-l|--logger", "-l|--logger",
LocalizableStrings.CmdLoggerDescription, LocalizableStrings.CmdLoggerDescription,
Accept.ExactlyOneArgument() Accept.ExactlyOneArgument()
.With(name: LocalizableStrings.CmdLoggerOption) .With(name: LocalizableStrings.CmdLoggerOption)
.ForwardAs(o => .ForwardAsSingle(o =>
{ {
var loggersString = string.Join(";", GetSemiColonEscapedArgs(o.Arguments)); var loggersString = string.Join(";", GetSemiColonEscapedArgs(o.Arguments));
@ -56,18 +56,18 @@ namespace Microsoft.DotNet.Cli
LocalizableStrings.CmdOutputDescription, LocalizableStrings.CmdOutputDescription,
Accept.ExactlyOneArgument() Accept.ExactlyOneArgument()
.With(name: LocalizableStrings.CmdOutputDir) .With(name: LocalizableStrings.CmdOutputDir)
.ForwardAs(o => $"/p:OutputPath={o.Arguments.Single()}")), .ForwardAsSingle(o => $"/p:OutputPath={o.Arguments.Single()}")),
Create.Option( Create.Option(
"-d|--diag", "-d|--diag",
LocalizableStrings.CmdPathTologFileDescription, LocalizableStrings.CmdPathTologFileDescription,
Accept.ExactlyOneArgument() Accept.ExactlyOneArgument()
.With(name: LocalizableStrings.CmdPathToLogFile) .With(name: LocalizableStrings.CmdPathToLogFile)
.ForwardAs(o => $"/p:VSTestDiag={o.Arguments.Single()}")), .ForwardAsSingle(o => $"/p:VSTestDiag={o.Arguments.Single()}")),
Create.Option( Create.Option(
"--no-build", "--no-build",
LocalizableStrings.CmdNoBuildDescription, LocalizableStrings.CmdNoBuildDescription,
Accept.NoArguments() Accept.NoArguments()
.ForwardAs(o => "/p:VSTestNoBuild=true")), .ForwardAsSingle(o => "/p:VSTestNoBuild=true")),
CommonOptions.VerbosityOption()); CommonOptions.VerbosityOption());
private static string GetSemiColonEsacpedstring(string arg) private static string GetSemiColonEsacpedstring(string arg)

View file

@ -58,7 +58,7 @@ Options:
.Execute("proj.csproj"); .Execute("proj.csproj");
cmd.ExitCode.Should().NotBe(0); cmd.ExitCode.Should().NotBe(0);
cmd.StdErr.Should().BeVisuallyEquivalentTo( cmd.StdErr.Should().BeVisuallyEquivalentTo(
"Unrecognized command or argument 'one'\r\nUnrecognized command or argument 'two'\r\nUnrecognized command or argument 'three'"); "Unrecognized command or argument 'two'\r\nUnrecognized command or argument 'three'");
} }
[Theory] [Theory]

View file

@ -31,6 +31,7 @@ namespace Microsoft.DotNet.Cli.MSBuild.Tests
[InlineData(new string[] { "--framework", "<tfm>" }, @"/p:TargetFramework=<tfm>")] [InlineData(new string[] { "--framework", "<tfm>" }, @"/p:TargetFramework=<tfm>")]
[InlineData(new string[] { "-r", "<rid>" }, @"/p:RuntimeIdentifier=<rid>")] [InlineData(new string[] { "-r", "<rid>" }, @"/p:RuntimeIdentifier=<rid>")]
[InlineData(new string[] { "--runtime", "<rid>" }, @"/p:RuntimeIdentifier=<rid>")] [InlineData(new string[] { "--runtime", "<rid>" }, @"/p:RuntimeIdentifier=<rid>")]
[InlineData(new string[] { "--entries", "one.xml", "--entries", "two.xml", "--entries", "three.xml" }, @"/p:AdditionalProjects=one.xml%3Btwo.xml%3Bthree.xml")]
public void MsbuildInvocationIsCorrect(string[] args, string expectedAdditionalArgs) public void MsbuildInvocationIsCorrect(string[] args, string expectedAdditionalArgs)
{ {
args = ArgsPrefix.Concat(args).ToArray(); args = ArgsPrefix.Concat(args).ToArray();

View file

@ -52,7 +52,7 @@ Options:
var cmd = new DotnetCommand() var cmd = new DotnetCommand()
.ExecuteWithCapturedOutput("sln one.sln two.sln three.sln list"); .ExecuteWithCapturedOutput("sln one.sln two.sln three.sln list");
cmd.Should().Fail(); cmd.Should().Fail();
cmd.StdErr.Should().Be("Unrecognized command or argument 'two.sln'"); cmd.StdErr.Should().BeVisuallyEquivalentTo("Unrecognized command or argument 'two.sln'\r\nUnrecognized command or argument 'three.sln'");
} }
[Theory] [Theory]

View file

@ -175,8 +175,7 @@ EndGlobal
var cmd = new DotnetCommand() var cmd = new DotnetCommand()
.ExecuteWithCapturedOutput("sln one.sln two.sln three.sln remove"); .ExecuteWithCapturedOutput("sln one.sln two.sln three.sln remove");
cmd.Should().Fail(); cmd.Should().Fail();
cmd.StdErr.Should().Be("Unrecognized command or argument 'two.sln'"); cmd.StdErr.Should().BeVisuallyEquivalentTo("Unrecognized command or argument 'two.sln'\r\nUnrecognized command or argument 'three.sln'\r\nYou must specify at least one project to remove.");
cmd.StdOut.Should().Be("Specify --help for a list of available options and commands.");
} }
[Theory] [Theory]

View file

@ -19,7 +19,7 @@ namespace Microsoft.DotNet.Tests.ParserTests
var command = Command("the-command", "", var command = Command("the-command", "",
Option("-o|--one", "", Option("-o|--one", "",
ZeroOrOneArgument() ZeroOrOneArgument()
.ForwardAs(o => $"/i:{o.Arguments.Single()}")), .ForwardAsSingle(o => $"/i:{o.Arguments.Single()}")),
Option("-t|--two", "", Option("-t|--two", "",
NoArguments() NoArguments()
.ForwardAs("/s:true"))); .ForwardAs("/s:true")));
@ -38,7 +38,7 @@ namespace Microsoft.DotNet.Tests.ParserTests
var command = Command("the-command", "", var command = Command("the-command", "",
Option("-x", "", Option("-x", "",
ZeroOrMoreArguments() ZeroOrMoreArguments()
.ForwardAs(o => $"/x:{string.Join("&", o.Arguments)}"))); .ForwardAsSingle(o => $"/x:{string.Join("&", o.Arguments)}")));
var result = command.Parse("the-command -x one -x two"); var result = command.Parse("the-command -x one -x two");