mirror of
https://github.com/spectreconsole/spectre.console.git
synced 2025-10-25 15:19:23 +00:00
Also raise CA2016 (forward the CancellationToken parameter to methods that take one) to warning Fixes #701
31 lines
831 B
C#
31 lines
831 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, CancellationToken cancellationToken)
|
|
{
|
|
return 0;
|
|
}
|
|
}
|