dotnet / dotnet/command-line-api
Fluent API: AddOption should return the Option
Open
- Dominant language
- C#
- Stars
- 3.7k
- Forks
- 428
- PR merge metrics
- No merged PRs in 30d
Description
Currently we have to write this:
```
var fileOption = new Option(
name: "--file",
description: "The mdp-accelerator file to use.");
rootCommand.AddOption(fileOption);
```
With a minor change to the API, we could write this instead:
```
var fileOption = rootCommand.AddOption(new Option(
name: "--file",
description: "The mdp-accelerator file to use."));
```
This would allow us to define, register, and capture the option all in one line instead of having to use two separate statements. And all it would cost is adding `return option;` at the end of the `AddOption` function.
Contributor guide
Assessment
This issue has not been assessed yet.