Open yufeih opened 1 year ago
FYI. I've nearly fixed this and will submit a PR soon (likely in the coming weeks).
I don‘t think this bug has fixed. When I using SetDefaultCommand, -v is still not work. spectre.console version: 0.49.1
I'll take a look @my522cn, please be on hand if I need help reproducing it.
Unfortunately it's still broken in 0.49.1 @my522cn
Here is my command and application:
using Spectre.Console;
using Spectre.Console.Cli;
public class EmptyCommand : Command<EmptyCommandSettings>
{
public override int Execute(CommandContext context, EmptyCommandSettings settings)
{
AnsiConsole.MarkupLine("Hello world");
return 0;
}
}
public static class Program
{
public static int Main(string[] args)
{
var app = new CommandApp();
app.SetDefaultCommand<EmptyCommand>();
app.Configure(config =>
{
config.SetApplicationVersion("1.0");
});
return app.Run(args);
}
}
The default command is executed, not the version shown:
Expected behavior Shows version instead of executing default command
Information
To Reproduce
SetDefaultCommand
mycmd --version
Expected behavior Shows version instead of executing default command
Additional context
Seemingly caused by this check