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

Make the help customiztaion "easier"

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

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

Đánh giá

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

Hướng nghiên cứu

Bắt đầu với tài liệu được liên kết về tùy chỉnh trợ giúp, sau đó lần theo SynchronousCommandLineAction, AsynchronousCommandLineAction, AnonymousSynchronousCommandLineAction, AnonymousAsynchronousCommandLineAction, SetAction và cách lệnh gốc xử lý HelpOption và VersionOption. So sánh các lớp public được đề xuất, các phương án thay thế bằng delegate và các phương thức helper với API hiện tại, đồng thời xác định thiết kế được chấp nhận, các bài kiểm thử và các cập nhật tài liệu là tiêu chí hoàn thành.

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

Mô tả

The documentation (https://learn.microsoft.com/en-us/dotnet/standard/commandline/how-to-customize-help) shows that when the user wants to customize the help he needs to write a lot of unnecessary code. Create a class which in inherited from SynchronousCommandLineAction / AsynchronousCommandLineAction, find the HelpOption, etc...

I'd suggest you to simplify this.

For example:

  • the AnonymousSynchronousCommandLineAction / AnonymousAsynchronousCommandLineAction classes (which are used in the SetAction methods) could be public. So the user can write this:
                defaultHelpOption.Action = new AnonymousSynchronousCommandLineAction(parseResult =>
                {
                    Console.WriteLine("HEADER");
                    return oldAction.Invoke(parseResult);
                });

  • or replace the XXCommandLineAction classes with just simple delegates:
    public delegate int SynchronousCommandLineAction(ParseResult parseResult);
    public delegate Task<int> AsynchronousCommandLineAction(ParseResult parseResult, CancellationToken cancellationToken);

  • add helper methods to the root command which returns the Help and VersionOptions
Ngôn ngữ chính
C#
Star
3.7k
Fork
434
Merge trung bình
4 giờ 46 phút
Pull request đã merge (30 ngày)
1

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.