new CliCommandLine version with help fix

This commit is contained in:
Jon Sequeira 2017-03-13 09:03:14 -07:00
parent 8a0f37ed79
commit 02ac115f2b
4 changed files with 6 additions and 4 deletions

View file

@ -14,7 +14,7 @@ namespace Microsoft.DotNet.Cli
public static void ShowHelpIfRequested(this ParseResult parseResult) public static void ShowHelpIfRequested(this ParseResult parseResult)
{ {
if (parseResult.HasOption("help")) if (parseResult.AppliedCommand().HasOption("help"))
{ {
// NOTE: this is a temporary stage in refactoring toward the ClicCommandLineParser being used at the CLI entry point. // NOTE: this is a temporary stage in refactoring toward the ClicCommandLineParser being used at the CLI entry point.
throw new HelpException(parseResult.Command().HelpView()); throw new HelpException(parseResult.Command().HelpView());

View file

@ -18,12 +18,14 @@ namespace Microsoft.DotNet.Cli
"add", "add",
".NET Add Command", ".NET Add Command",
Accept.ExactlyOneArgument() Accept.ExactlyOneArgument()
.ExistingFilesOnly()
.DefaultToCurrentDirectory(), .DefaultToCurrentDirectory(),
Create.Command( Create.Command(
"package", "package",
".NET Add Package reference Command", ".NET Add Package reference Command",
Accept.ExactlyOneArgument() Accept.ExactlyOneArgument()
.WithSuggestionsFrom(QueryNuGet), CommonOptions.HelpOption(), .WithSuggestionsFrom(QueryNuGet),
CommonOptions.HelpOption(),
Create.Option("-v|--version", Create.Option("-v|--version",
"Version for the package to be added.", "Version for the package to be added.",
Accept.ExactlyOneArgument() Accept.ExactlyOneArgument()

View file

@ -40,7 +40,7 @@
<PackageReference Include="Microsoft.Win32.Registry" Version="4.3.0" /> <PackageReference Include="Microsoft.Win32.Registry" Version="4.3.0" />
<PackageReference Include="Microsoft.Build" Version="$(CLI_MSBuild_Version)" /> <PackageReference Include="Microsoft.Build" Version="$(CLI_MSBuild_Version)" />
<PackageReference Include="Microsoft.DotNet.PlatformAbstractions" Version="$(PlatformAbstractionsVersion)" /> <PackageReference Include="Microsoft.DotNet.PlatformAbstractions" Version="$(PlatformAbstractionsVersion)" />
<PackageReference Include="Microsoft.DotNet.Cli.CommandLine" Version="0.1.0-alpha-94" /> <PackageReference Include="Microsoft.DotNet.Cli.CommandLine" Version="0.1.0-alpha-96" />
<PackageReference Include="Microsoft.TemplateEngine.Abstractions" Version="$(TemplateEngineVersion)" /> <PackageReference Include="Microsoft.TemplateEngine.Abstractions" Version="$(TemplateEngineVersion)" />
<PackageReference Include="Microsoft.TemplateEngine.Cli" Version="$(TemplateEngineVersion)" /> <PackageReference Include="Microsoft.TemplateEngine.Cli" Version="$(TemplateEngineVersion)" />
<PackageReference Include="Microsoft.TemplateEngine.Orchestrator.RunnableProjects" Version="$(TemplateEngineVersion)" /> <PackageReference Include="Microsoft.TemplateEngine.Orchestrator.RunnableProjects" Version="$(TemplateEngineVersion)" />

View file

@ -42,6 +42,6 @@
<PackageReference Include="xunit" Version="2.2.0-beta4-build3444" /> <PackageReference Include="xunit" Version="2.2.0-beta4-build3444" />
<PackageReference Include="xunit.netcore.extensions" Version="1.0.0-prerelease-00206" /> <PackageReference Include="xunit.netcore.extensions" Version="1.0.0-prerelease-00206" />
<PackageReference Include="Microsoft.DotNet.PlatformAbstractions" Version="$(PlatformAbstractionsVersion)" /> <PackageReference Include="Microsoft.DotNet.PlatformAbstractions" Version="$(PlatformAbstractionsVersion)" />
<PackageReference Include="Microsoft.DotNet.Cli.CommandLine" Version="0.1.0-alpha-94" /> <PackageReference Include="Microsoft.DotNet.Cli.CommandLine" Version="0.1.0-alpha-96" />
</ItemGroup> </ItemGroup>
</Project> </Project>