dotnet / dotnet/command-line-api
Allow adding aliases to command using object initializer
- Dominant language
- C#
- Stars
- 3.7k
- Forks
- 428
- PR merge metrics
- No merged PRs in 30d
Description
This is a simple example:
```cs
var rootCommand = new RootCommand
{
new Command("do-something")
{
new Command("abcdefg") // How to add aliases here?
new Command("qwerty")
}
};
```
In this case, you have to give up using the object initializer and manually add the commands.
This supposed example demonstrates an easy way to build commands.
```cs
var rootCommand = new RootCommand
{
new Command("do-something")
{
new Command("abcdefg") { Aliases = { "c", "w" } } // In reality, this will raise a compiler error, because Aliases is a IReadOnlyList
new Command("qwerty")
}
};
```
Contributor guide
Assessment
This issue has not been assessed yet.