-
Couldn't load subscription status.
- Fork 409
Closed
Labels
Milestone
Description
Testing with --help ok, but --version results in errors.
protected virtual Task<int> Sandbox(string[] args)
{
RootCommand root = new("Test command");
ParseResult result = root.Parse(["--version"]);
if (result.Errors.Count > 0)
{
Log.Error("Commandline parsing failed: {Errors}", result.Errors);
return Task.FromResult(1);
}
root = new("Test command");
Option<string> option = new("--settingsfile") { Recursive = true };
root.Options.Add(option);
Command command = new("defaultsettings")
{
Description = "Create JSON configuration file using default settings",
Options = { option },
};
command.SetAction(_ => 0);
root.Subcommands.Add(command);
result = root.Parse(["--version"]);
if (result.Errors.Count > 0)
{
Log.Error("Commandline parsing with sub-command failed: {Errors}", result.Errors);
return Task.FromResult(1);
}
return Task.FromResult(0);
}21:10:13 [ERR] <1> Commandline parsing with sub-command failed: ["Required command was not provided."]
Expect behavior to match that of --help with printing version info and no errors.