commandlineparser / commandlineparser/commandline

Add support for validation and custom types

未关闭
#146 26 条评论 12 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
C#
星标
4.8k
派生
478
PR 合并指标
30 天内没有已合并 PR

描述

**Issue by [clmcgrath](https://github.com/clmcgrath)**
_Monday Jun 26, 2017 at 18:21 GMT_
_Originally opened as https://github.com/gsscoder/commandline/issues/455_

----

Add some sort of hook or attribute to plug validation into the parser pipeline

similar some similar frameworks use attributes or factory registration to allow an entrypoint for custom validation and type mapping (DI support would be awesome as well ;) )

a typical and widely used usage scenario for this would be filesystem path validation and mapping to IO classes such as FileInfo / DirectoryInfo
an seemingly easy way to to add this type of validation functionality would be to allow validation attributes that inherit from a validation base class or interface and run custom or pre-written code

some examples of validation provided in similar frameworks are
```csharp
[FileExists]
[DirectoryExists]
[FileNotExists]
[DirectoryNotExists]
[RegExValidation]
```

Powerargs provides a special class called a Reviver for custom type mapping as well that the framework looks for to try and map values to a custom or complex type ie path string => `FileInfo`

It is very hard to find a framework that does all 3 of these well currently and make this library a go to framework for myself and many other developers i am sure

as CLP 2.x is still in beta and major rewrite phase i think now would be a good time to look at feature expansion as well to increase the power of this framework

贡献指南

这个仓库没有索引到贡献指南

调研方向

该 issue 将 parser pipeline、validation attributes、custom type mapping 和 Powerargs' Reviver 列为相关入口点,但没有提供任何 repository 文件或测试。首先检查 CLP 2.x 的 parser rewrite,以及当前如何处理 FileInfo 和 DirectoryInfo 值。完成标准是达成一致的 design,并添加覆盖 validation hooks 和 custom type conversion 的测试。

由索引模型根据 Issue 内容生成。

评估

技术栈
csharp
领域
cli
Issue 类型
功能
难度
5/5
预计耗时
一周以上
活跃度
停滞
描述清晰度
需要澄清
新手友好度
25/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。