dotnet / dotnet/command-line-api

Add generic host builder pattern for System.CommandLine.Hosting

Open
#918 17 comments 16 reactions 0 assignees View on GitHub
Area-App Models enhancement
Dominant language
C#
Stars
3.7k
Forks
428
PR merge metrics
No merged PRs in 30d

Description

Align `System.CommadLine.Hosting` model with the way ASP.NET Core uses _Generic Host_.

It should be possible to configure CommandLineBuilder like this:
```csharp
public static IHostBuilder CreateHostBuilder(string[] args) =>
CommandLineHost.CreateDefaultBuilder(args)
.ConfigureAppConfiguration((hostingContext, config) =>
{
})
.ConfigureCommandLineDefaults(cmdHost =>
{
cmdHost.ConfigureServices(services =>
{
})
})
.ConfigureCommandLineBuilder(cmdBuilder => // CommandLineBuilder
{
cmdBuilder.UseReflectionAppModel(); // e.g. https://github.com/KathleenDollard/command-line-api-starfruit
});
});
```

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.