Skip to content

Displaying help text with fluent syntax? #223

Open
@jawn

Description

@jawn

Using the latest nuget of the version 2.0 pre-release, I can display help text like this:

var results = Parser.Default.ParseArguments<Options>(args)
  .WithParsed(opts => /* handle options here */)

if (results.Tag == ParserResultType.NotParsed)
{
  var helpText = HelpText.AutoBuild(results);
  Console.WriteLine(helpText);
}

Is there a way to do this within the fluent syntax?

Something like
var results = Parser.Default.ParseArguments(args)
.WithNotParsed(opts => Console.WriteLine(HelpText.AutoBuild()));
.WithParsed(opts => /* handle options here */)

Since AutoBuild() requires results, this can't be called within the fluent syntax. That's already logged as #88, however I would like to know whether a different solution is available.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions