5
Vote

Extra args cause parsing to fail but don't show up in help text

description

If we pass args on the command line that aren't defined in the options class, parsing fails but the help text doesn't indicate what is wrong. For example:
public class Options {    
     public string foo { get; set; }
}
And called with these args: "--foo --bar"

In this code, ParseArguments returns false but the "error" variable ends up empty.
if (!Parser.Default.ParseArguments(args, Options))
{
    string error = new CommandLine.Text.HelpText().RenderParsingErrorsText(Options, 0));
}
I would expect something like "Option 'bar' not recognized" or a similar error message.

comments