Closed
Description
I have a console application that uses System.CommandLine
to parse arguments and options.
To be able to deal with exceptions better, I've switched from RootCommand.Invoke(args)
to using a CommandLineBuilder
in the way I saw discussed here in one of the earlier threads:
CommandLineBuilder oCLB = new(oRootCmd);
oCLB.UseExceptionHandler((e, c) => LogExceptionAndRaiseEvent(e));
Parser oPrs = oCLB.Build();
int iRC = oPrs.Invoke(p_StartupArgs);
Now I've noticed that this way of invoking doesn't write to the console anymore, neither when there is a parsing error nor when being called with the default help switch "-h".
I suspect it has to do with the second (IConsole) parameter in Invoke -- I've tried oPrs.Invoke(p_StartupArgs, new SystemConsole());
, but without success. What am I missing?
Metadata
Metadata
Assignees
Labels
No labels