commandlineparser / commandlineparser/commandline
Add support for validation and custom types
- 主要語言
- 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