commandlineparser / commandlineparser/commandline

Add support for validation and custom types

オープン
#146 コメント 26 件 リアクション 12 件 担当者 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 はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。