mirror of
https://github.com/nsnail/spectre.console.git
synced 2025-04-16 00:42:51 +08:00

* Add support for C# 12 * Run all tests on all major .NET SDKs * Only build on Ubuntu * Do not build docs for pull requests * Add Cédric Luthi, and Frank Ray to authors * Drop netstandard2.0 for ImageSharp plugin
31 lines
794 B
C#
31 lines
794 B
C#
namespace Spectre.Console.Tests.Data;
|
|
|
|
[Description("The dog command.")]
|
|
public class DogCommand : AnimalCommand<DogSettings>
|
|
{
|
|
public override ValidationResult Validate(CommandContext context, DogSettings settings)
|
|
{
|
|
if (context is null)
|
|
{
|
|
throw new System.ArgumentNullException(nameof(context));
|
|
}
|
|
|
|
if (settings is null)
|
|
{
|
|
throw new System.ArgumentNullException(nameof(settings));
|
|
}
|
|
|
|
if (settings.Age > 100 && !context.Remaining.Raw.Contains("zombie"))
|
|
{
|
|
return ValidationResult.Error("Dog is too old...");
|
|
}
|
|
|
|
return base.Validate(context, settings);
|
|
}
|
|
|
|
public override int Execute(CommandContext context, DogSettings settings)
|
|
{
|
|
return 0;
|
|
}
|
|
}
|