-
Notifications
You must be signed in to change notification settings - Fork 480
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enum with 0 value not shown on Example #379
Comments
This looks like a bug around examples with But the example generator should look at whether the option is required and include it whether or not it's the default value. |
I took a look at this again and noticed that other value types have the same issue. class Options_With_Examples_Having_Default_Values
{
[Option('t', "type", HelpText = "My entity")]
public EntityType MyEntityType { get; set; }
public enum EntityType
{
T0
}
[Option('v', "value")]
public int Value { get; set; }
[Option('d')]
public double Double { get; set; }
[Option('b')]
public bool Bool { get; set; }
[Usage(ApplicationAlias = "test.exe")]
public static IEnumerable<Example> Examples
{
get
{
yield return new Example("1", new Options_With_Examples_Having_Default_Values { MyEntityType = EntityType.T0 });
yield return new Example("2", new Options_With_Examples_Having_Default_Values { Value = 1, Double = 0.1, Bool = true });
}
}
} Returns
and the same example with non-default values returns
The enum is included in both examples too, because of the change I made in #452. |
If you are looking for help on this.. I would be glad to take it up @nemec @ericnewton76 @moh-hassan It would be my first open-source contribution Thanks In Advance :) |
public class MyOption
{
[Option('t', "type", Required = true, HelpText = "My entity")]
public EntityType MyEntityType { get; set; }
public enum MyEntityType
{
X0, // Example for X0 is empty. If change this line to X0 =1, everything is ok
X1,
X2
}
The text was updated successfully, but these errors were encountered: