dotnet / dotnet/command-line-api

Provide a better way to hook custom help

Open
#2,588 6 comments 3 reactions 0 assignees View on GitHub
Area-Help enhancement
Dominant language
C#
Stars
3.7k
Forks
428
PR merge metrics
No merged PRs in 30d

Description

Having to define `internal sealed class CustomHelpAction(HelpAction action) : SynchronousCommandLineAction` and then loop through Options on the `rootCommand` looking for `is HelpOption` is a lot of ceremony.

Could we have something like

```c#
var rootCommand = new RootCommand("RootCommand")
{
myArgument,
myOption1,
myOption2,
HelpAction => () { Console.Writeline("Easy help!") }
};
```

or

```c#
rootCommand.SetHelp((cancellationToken) =>
{
Console.Writeline("Easy help!")
}
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.