commandlineparser / commandlineparser/commandline

Add support for validation and custom types

Đang mở
#146 26 bình luận 12 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
C#
Star
4.8k
Fork
478
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

**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

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Hướng nghiên cứu

Issue nêu parser pipeline, validation attributes, custom type mapping và Reviver của Powerargs là các entry point liên quan, nhưng không có file hoặc test nào trong repository. Hãy bắt đầu bằng việc xem lại parser rewrite của CLP 2.x và cách các giá trị FileInfo và DirectoryInfo hiện đang được xử lý. Công việc được xem là hoàn tất khi có một design đã được thống nhất và các test bao quát validation hooks cùng custom type conversion.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
csharp
Lĩnh vực
cli
Loại issue
Tính năng
Độ khó
5/5
Thời gian dự kiến
Hơn một tuần
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Cần làm rõ
Mức phù hợp với người mới
25/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.