enforce repeating options to for multiple arguments
This commit is contained in:
parent
6866bc2f4a
commit
7a90675be7
4 changed files with 32 additions and 9 deletions
|
@ -20,17 +20,17 @@ namespace Microsoft.DotNet.Cli
|
|||
Create.Option(
|
||||
"-o|--output",
|
||||
LocalizableStrings.OutputOptionDescription,
|
||||
Accept.ExactlyOneArgument()
|
||||
.With(name: LocalizableStrings.OutputOption)
|
||||
.ForwardAsSingle(o => $"/p:PublishDir={o.Arguments.Single()}")),
|
||||
Accept.ExactlyOneArgument()
|
||||
.With(name: LocalizableStrings.OutputOption)
|
||||
.ForwardAsSingle(o => $"/p:PublishDir={o.Arguments.Single()}")),
|
||||
CommonOptions.ConfigurationOption(),
|
||||
CommonOptions.VersionSuffixOption(),
|
||||
Create.Option(
|
||||
"--filter",
|
||||
"--filter",
|
||||
LocalizableStrings.FilterProjOptionDescription,
|
||||
Accept.OneOrMoreArguments()
|
||||
.With(name: LocalizableStrings.FilterProjOption)
|
||||
.ForwardAsSingle(o => $"/p:FilterProjectFiles={string.Join("%3B", o.Arguments)}")),
|
||||
Accept.OneOrMoreArguments()
|
||||
.With(name: LocalizableStrings.FilterProjOption)
|
||||
.ForwardAsSingle(o => $"/p:FilterProjectFiles={string.Join("%3B", o.Arguments)}")),
|
||||
CommonOptions.VerbosityOption());
|
||||
}
|
||||
}
|
|
@ -40,7 +40,7 @@
|
|||
<PackageReference Include="Microsoft.Win32.Registry" Version="4.3.0" />
|
||||
<PackageReference Include="Microsoft.Build" Version="$(CLI_MSBuild_Version)" />
|
||||
<PackageReference Include="Microsoft.DotNet.PlatformAbstractions" Version="$(PlatformAbstractionsVersion)" />
|
||||
<PackageReference Include="Microsoft.DotNet.Cli.CommandLine" Version="0.1.0-alpha-125" />
|
||||
<PackageReference Include="Microsoft.DotNet.Cli.CommandLine" Version="0.1.0-alpha-132" />
|
||||
<PackageReference Include="Microsoft.TemplateEngine.Abstractions" Version="$(TemplateEngineVersion)" />
|
||||
<PackageReference Include="Microsoft.TemplateEngine.Cli" Version="$(TemplateEngineVersion)" />
|
||||
<PackageReference Include="Microsoft.TemplateEngine.Orchestrator.RunnableProjects" Version="$(TemplateEngineVersion)" />
|
||||
|
|
|
@ -44,5 +44,28 @@ namespace Microsoft.DotNet.Tests.ParserTests
|
|||
.Should()
|
||||
.BeEquivalentTo(@"/p:SkipInvalidConfigurations=true");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void RestoreDistinguishesRepeatSourceArgsFromCommandArgs()
|
||||
{
|
||||
var restore =
|
||||
Parser.Instance
|
||||
.Parse(
|
||||
@"dotnet restore --no-cache --packages ""D:\OSS\corefx\packages"" --source https://dotnet.myget.org/F/dotnet-buildtools/api/v3/index.json --source https://dotnet.myget.org/F/dotnet-core/api/v3/index.json --source https://api.nuget.org/v3/index.json D:\OSS\corefx\external\runtime\runtime.depproj")
|
||||
.AppliedCommand();
|
||||
|
||||
restore
|
||||
.Arguments
|
||||
.Should()
|
||||
.BeEquivalentTo(@"D:\OSS\corefx\external\runtime\runtime.depproj");
|
||||
|
||||
restore["--source"]
|
||||
.Arguments
|
||||
.Should()
|
||||
.BeEquivalentTo(
|
||||
"https://dotnet.myget.org/F/dotnet-buildtools/api/v3/index.json",
|
||||
"https://dotnet.myget.org/F/dotnet-core/api/v3/index.json",
|
||||
"https://api.nuget.org/v3/index.json");
|
||||
}
|
||||
}
|
||||
}
|
|
@ -42,6 +42,6 @@
|
|||
<PackageReference Include="xunit" Version="2.2.0-beta4-build3444" />
|
||||
<PackageReference Include="xunit.netcore.extensions" Version="1.0.0-prerelease-00206" />
|
||||
<PackageReference Include="Microsoft.DotNet.PlatformAbstractions" Version="$(PlatformAbstractionsVersion)" />
|
||||
<PackageReference Include="Microsoft.DotNet.Cli.CommandLine" Version="0.1.0-alpha-125" />
|
||||
<PackageReference Include="Microsoft.DotNet.Cli.CommandLine" Version="0.1.0-alpha-132" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
|
|
Loading…
Reference in a new issue