dotnet / dotnet/command-line-api
Provide a better way to hook custom help
Open
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
Assessment
This issue has not been assessed yet.