Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

`Command.Validators` should be invoked only when the command options are arguments are valid

Đang mở
#2,779 5 bình luận 1 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
45/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Ít trao đổi
Công nghệ
csharp
Lĩnh vực
cli

Hướng nghiên cứu

Không có tệp mã nguồn hoặc bài kiểm thử nào được nêu. Hãy bắt đầu bằng cách đọc issue liên quan #2645 và lần theo nơi các trình xác thực của Command được gọi so với việc xác thực tùy chọn và đối số. Công việc được xem là hoàn tất khi thứ tự khớp với hành vi được yêu cầu trong issue, hoặc tài liệu giải thích rõ ràng vì sao các trình xác thực của Command không thể đọc các giá trị tùy chọn và đối số đã được xác thực.

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

Mô tả

For Option<T> and Argument<T>, custom validators are invoked before the conversion from the token (string) to T. It's well behavior for the use case such the production of better error messages, even so the behavior is not well documented (related #2645).

For Command, as same as above, validators are invoked before its options and arguments today, but it's useless.

I expect to be able to use Command validators for the complex validation of our command line. In other words, the options and arguments should be validated with their definitions (Arity, AllowMultipleArgumentsPerToken, CustomParser, etc, and Validators) first, then only when no one have any errors, the command validators should be invoked.

Or, reading the values of options and arguments from Command.Validators is incorrect? If so, better documentation is needed.

Ngôn ngữ chính
C#
Star
3.7k
Fork
434
Merge trung bình
6 giờ 27 phút
Pull request đã merge (30 ngày)
2

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của dotnet/command-line-api

Tất cả issue của dotnet/command-line-api

Issue tương tự

Thêm issue về C#

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.