Is there any way to make the Command Line Parser library report unknown arguments?
Given the following options class:
public class Options
{
[Option('i', "int-option", DefaultValue = 10, HelpText = "Set the int")]
public int IntOption { get; set; }
[ParserState]
public IParserState LastParserState { get; set; }
[HelpOption]
public string GetUsage()
{
return HelpText.AutoBuild(this,
HelpText.DefaultParsingErrorsHandler(this, current));
}
}
And the following program:
var options = new Options();
var parser = new Parser(settings =>
{
settings.HelpWriter = Console.Error;
settings.IgnoreUnknownArguments = false;
});
if (parser.ParseArgumentsStrict(args, options))
{
Console.WriteLine("Int value set: {0}", options.IntOption);
}
When calling the program with "MyProgram.exe --unknown" I just get the default usage information, but no mention of what error made the parsing fail. I'd like to get some kind of indication to the user what went wrong.