commandline icon indicating copy to clipboard operation
commandline copied to clipboard

The .Dump() method in the WIKI seems to be missing from the code/nuget

Open BlitzkriegSoftware opened this issue 3 years ago • 1 comments
trafficstars

https://github.com/commandlineparser/commandline/wiki/How-To

  var parser = new Parser(with => with.HelpWriter = null);
  var parserResult = parser.ParseArguments<Options>(args);
  parserResult
    .WithParsed(opt => opt.Dump())
    .WithNotParsed(x =>
    {
      var helpText = HelpText.AutoBuild(parserResult, h =>
      {
        h.AutoHelp = false;     // hides --help
        h.AutoVersion = false;  // hides --version
        return HelpText.DefaultParsingErrorsHandler(parserResult, h);
      }, e => e);
      Console.WriteLine(helpText);
    });

BlitzkriegSoftware avatar Jul 19 '22 18:07 BlitzkriegSoftware

There is an explanation in issue #528 "how to use the Method Dump() for the custom class" Some of the demoes and dotnetfiddle.net links assumes that you have ObjectDumper.NET (Github page: ObjectDumper) installed, though it is not documented. See comments from @moh-hassan , author of many of the demos : "... Dump is used for demonstration ..." and here "I have dropped Dump (built-in method in dotnetfiddle.net) and modified code to use Console.WriteLine") (though in regard to last comment it seems that there are still documentation and links to dotnetfiddle.net examples that haven't been changed to not using the Dump method. Examples: Try It links on Mutually-Exclusive-Options which points to https://dotnetfiddle.net/GeXOFY and https://dotnetfiddle.net/uUIfCb.)

henrik-jensen avatar Sep 12 '22 10:09 henrik-jensen