commandlineparser / commandlineparser/commandline

Code crashes without any concrete error and no help documents

未关闭
#928 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
C#
星标
4.8k
派生
478
PR 合并指标
30 天内没有已合并 PR

描述

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;
}
}
```

贡献指南

这个仓库没有索引到贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。