commandlineparser / commandlineparser/commandline

Enum with 0 value not shown on Example

Open
#379 3 comments 0 reactions 0 assignees View on GitHub
bug good first issue
Dominant language
C#
Stars
4.8k
Forks
478
PR merge metrics
No merged PRs in 30d

Description

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
}

[Usage(ApplicationAlias = "...")]
public static IEnumerable Examples
{
get
{
foreach (EntityType entityType in Enum.GetValues(typeof(EntityType)))
{
yield return new Example(entityType.ToString(), new MyOption { MyEntityType = entityType});
}
}
}
}

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the Examples property and its Enum.GetValues iteration in the reported reproduction, then trace how each yielded Example is rendered. Reproduce the case with X0 as the default enum value and compare it with X0 = 1. Done means the generated example for X0 is populated and displayed consistently with X1 and X2.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.