commandline
commandline copied to clipboard
The .Dump() method in the WIKI seems to be missing from the code/nuget
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);
});
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.)