Open
Description
Use codes from test
but add
UseParseErrorReporting
like this:
[Fact]
public static async Task Constructor_Injection_Injects_Service()
{
var service = new MyService();
var parser = new CommandLineBuilder(
new MyCommand()
)
.UseHost((builder) => {
builder.ConfigureServices(services =>
{
services.AddTransient(x => service);
})
.UseCommandHandler<MyCommand, MyCommand.MyHandler>();
})
.UseParseErrorReporting()
.Build();
var result = await parser.InvokeAsync(new string[] { "--int-option", "54"});
service.Value.Should().Be(54);
}
It will report Required command was not provided.
when parsing.