mirror of
https://github.com/nsnail/spectre.console.git
synced 2025-09-16 17:35:34 +08:00
Add global usings (#668)
* Use global usings * Fix namespace declarations for test projects
This commit is contained in:
@@ -1,36 +1,31 @@
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using Spectre.Console.Cli;
|
||||
namespace Spectre.Console.Tests.Data;
|
||||
|
||||
namespace Spectre.Console.Tests.Data
|
||||
[Description("The dog command.")]
|
||||
public class DogCommand : AnimalCommand<DogSettings>
|
||||
{
|
||||
[Description("The dog command.")]
|
||||
public class DogCommand : AnimalCommand<DogSettings>
|
||||
public override ValidationResult Validate(CommandContext context, DogSettings settings)
|
||||
{
|
||||
public override ValidationResult Validate(CommandContext context, DogSettings settings)
|
||||
if (context is null)
|
||||
{
|
||||
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);
|
||||
throw new System.ArgumentNullException(nameof(context));
|
||||
}
|
||||
|
||||
public override int Execute(CommandContext context, DogSettings settings)
|
||||
if (settings is null)
|
||||
{
|
||||
DumpSettings(context, settings);
|
||||
return 0;
|
||||
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)
|
||||
{
|
||||
DumpSettings(context, settings);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user