commandline icon indicating copy to clipboard operation
commandline copied to clipboard

AddEnumValuesToHelpText does not work for nullable enums

Open peetw opened this issue 8 years ago • 0 comments

When outputting HelpText, the following code will correctly list valid values for enum type options. However, if the option is a nullable enum type, then it will not list the valid values.

parserResult.WithNotParsed(errors =>
{
    // Use custom help text to ensure valid enum values are displayed
    var helpText = HelpText.AutoBuild(parserResult);
    helpText.AddEnumValuesToHelpText = true;
    helpText.AddOptions(parserResult);
    Console.Error.Write(helpText);
    Environment.Exit(1);
});

Is this a bug, or is there another setting/workaround for nullable enums?

peetw avatar Jan 12 '17 08:01 peetw