mirror of
https://github.com/nsnail/spectre.console.git
synced 2025-06-19 21:38:16 +08:00
(#916) fixed missing call to Validate when using CommandConstructorBinder
This commit is contained in:

committed by
Patrik Svensson

parent
78d841e3dc
commit
0d19ccd8a6
@ -0,0 +1,7 @@
|
||||
namespace Spectre.Console.Tests.Data;
|
||||
|
||||
public class ReptileSettings : AnimalSettings
|
||||
{
|
||||
[CommandOption("-n|-p|--name|--pet-name <VALUE>")]
|
||||
public string Name { get; set; }
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
namespace Spectre.Console.Tests.Data;
|
||||
|
||||
public sealed class TurtleSettings : ReptileSettings
|
||||
{
|
||||
public TurtleSettings(string name)
|
||||
{
|
||||
Name = name;
|
||||
}
|
||||
|
||||
public override ValidationResult Validate()
|
||||
{
|
||||
return Name != "Lonely George"
|
||||
? ValidationResult.Error("Only 'Lonely George' is valid name for a turtle!")
|
||||
: ValidationResult.Success();
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user