commandlineparser / commandlineparser/commandline

Code crashes without any concrete error and no help documents

Đang mở
#928 1 bình luận 0 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ả

Basic example crashes with this error on start:
> ERROR(S):
No verb selected.
add Add file contents to the index.
commit Record changes to the repository.
clone Clone a repository into a new directory.
help Display more information on a specific command.
version Display version information.

Process finished with exit code 1.

- If I need to debug it, how it's being done?

```csharp
[Verb("add", HelpText = "Add file contents to the index.")]
class AddOptions {
//normal options here
}
[Verb("commit", HelpText = "Record changes to the repository.")]
class CommitOptions {
//commit options here
}
[Verb("clone", HelpText = "Clone a repository into a new directory.")]
class CloneOptions {
//clone options here
}

static int Main(string[] args) {
return CommandLine.Parser.Default.ParseArguments(args)
.MapResult(
(AddOptions opts) => RunAddAndReturnExitCode(opts),
(CommitOptions opts) => RunCommitAndReturnExitCode(opts),
(CloneOptions opts) => RunCloneAndReturnExitCode(opts),
errs => 1);
}

private static int RunCloneAndReturnExitCode(CloneOptions opts)
{
return 1;
}

private static int RunCommitAndReturnExitCode(CommitOptions opts)
{
return 1;
}

private static int RunAddAndReturnExitCode(AddOptions opts)
{
return 0;
}
}
```

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

Bắt đầu với ví dụ cơ bản được nêu trong issue và tái hiện đường đi khởi động qua Parser.Default.ParseArguments(args). Kiểm tra cách kết quả không có verb được báo cáo và liệu lỗi được hiển thị có đưa ra đủ hướng dẫn cho ví dụ này hay không. Được xem là hoàn thành khi hành vi khởi động và hướng dẫn gỡ lỗi rõ ràng đối với người dùng chạy ví dụ mà không có lệnh.

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
Lỗi
Độ khó
3/5
Thời gian dự kiến
1-2 ngày
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.