mirror of
https://github.com/nsnail/spectre.console.git
synced 2025-07-01 18:38:16 +08:00
Update dependencies
* 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
This commit is contained in:

committed by
Patrik Svensson

parent
703d653ec5
commit
b21e07ea94
@ -5,41 +5,4 @@ namespace Spectre.Console.Tests.Data;
|
||||
public abstract class AnimalCommand<TSettings> : Command<TSettings>
|
||||
where TSettings : CommandSettings
|
||||
{
|
||||
protected void DumpSettings(CommandContext context, TSettings settings)
|
||||
{
|
||||
if (context == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(context));
|
||||
}
|
||||
|
||||
if (settings == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(settings));
|
||||
}
|
||||
|
||||
var properties = settings.GetType().GetProperties();
|
||||
foreach (var group in properties.GroupBy(x => x.DeclaringType).Reverse())
|
||||
{
|
||||
SystemConsole.WriteLine();
|
||||
SystemConsole.ForegroundColor = ConsoleColor.Yellow;
|
||||
SystemConsole.WriteLine(group.Key.FullName);
|
||||
SystemConsole.ResetColor();
|
||||
|
||||
foreach (var property in group)
|
||||
{
|
||||
SystemConsole.WriteLine($" {property.Name} = {property.GetValue(settings)}");
|
||||
}
|
||||
}
|
||||
|
||||
if (context.Remaining.Raw.Count > 0)
|
||||
{
|
||||
SystemConsole.WriteLine();
|
||||
SystemConsole.ForegroundColor = ConsoleColor.Yellow;
|
||||
SystemConsole.WriteLine("Remaining:");
|
||||
SystemConsole.ResetColor();
|
||||
SystemConsole.WriteLine(string.Join(", ", context.Remaining));
|
||||
}
|
||||
|
||||
SystemConsole.WriteLine();
|
||||
}
|
||||
}
|
||||
|
@ -4,7 +4,6 @@ public class CatCommand : AnimalCommand<CatSettings>
|
||||
{
|
||||
public override int Execute(CommandContext context, CatSettings settings)
|
||||
{
|
||||
DumpSettings(context, settings);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
@ -25,7 +25,6 @@ public class DogCommand : AnimalCommand<DogSettings>
|
||||
|
||||
public override int Execute(CommandContext context, DogSettings settings)
|
||||
{
|
||||
DumpSettings(context, settings);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
@ -5,7 +5,6 @@ public class HorseCommand : AnimalCommand<HorseSettings>
|
||||
{
|
||||
public override int Execute(CommandContext context, HorseSettings settings)
|
||||
{
|
||||
DumpSettings(context, settings);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
@ -5,7 +5,6 @@ public class TurtleCommand : AnimalCommand<TurtleSettings>
|
||||
{
|
||||
public override int Execute(CommandContext context, TurtleSettings settings)
|
||||
{
|
||||
DumpSettings(context, settings);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user