commandlineparser / commandlineparser/commandline
Enum list options not displayed in help text
- 主要语言
- C#
- 星标
- 4.8k
- 派生
- 478
- PR 合并指标
- 30 天内没有已合并 PR
描述
Apologies if this question/bug was already open
**Describe the bug**
The property: `HelpText.AddenumValuesToHelpText` does not work when the option is of type `IEnummerable<{Enum}>`. I'm guessing the list is masking the fact that its containing an enum.
Is it possible to have the same `Valid values: {enum values}` in the help text to be displayed when its a list of enums?
**To Reproduce**
1. Create an option of type `IEnummerable<{Enum}>`
2. configure a parser as follows:
```cs
var parser = new Parser(with =>
{
with.CaseInsensitiveEnumValues = true;
with.HelpWriter = null;
with.AutoVersion = false;
});
var parserResult = parser.ParseArguments(args.SplitArgs());
parserResult
.WithNotParsed(_ =>
{
var helpText = HelpText.AutoBuild(parserResult, h =>
{
h.AutoVersion = false;
h.Heading = string.Empty;
h.Copyright = string.Empty;
h.AddEnumValuesToHelpText = true;
return h;
});
Console.WriteLine(helpText);
});
```
3. use the --help to find no `Valid values: {enum values}` in the help text.
**Expected behavior**
I expected a list of enums to still show available options
**Screenshots**



贡献指南
这个仓库没有索引到贡献指南
调研方向
首先,使用报告中所示的 Parser 和 HelpText.AutoBuild 配置,复现类型为 IEnumerable 的选项所出现的问题。跟踪 AddEnumValuesToHelpText 如何处理集合选项类型;完成的标准是,生成的 --help 输出包含列表选项的 enum 有效值,同时保留标量 enum 的现有行为。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- csharp
- 领域
- cli
- Issue 类型
- 缺陷
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 35/100