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

Also moves tests to `./test` which makes it possible for all test projects to share the same .editorconfig files and similar.
40 lines
1.1 KiB
C#
40 lines
1.1 KiB
C#
using System.Diagnostics.CodeAnalysis;
|
|
using System.Linq;
|
|
using Spectre.Console.Cli;
|
|
|
|
namespace Spectre.Console.Tests.Data
|
|
{
|
|
public sealed class DumpRemainingCommand : Command<EmptyCommandSettings>
|
|
{
|
|
private readonly IAnsiConsole _console;
|
|
|
|
public DumpRemainingCommand(IAnsiConsole console)
|
|
{
|
|
_console = console;
|
|
}
|
|
|
|
public override int Execute([NotNull] CommandContext context, [NotNull] EmptyCommandSettings settings)
|
|
{
|
|
if (context.Remaining.Raw.Count > 0)
|
|
{
|
|
_console.WriteLine("# Raw");
|
|
foreach (var item in context.Remaining.Raw)
|
|
{
|
|
_console.WriteLine(item);
|
|
}
|
|
}
|
|
|
|
if (context.Remaining.Parsed.Count > 0)
|
|
{
|
|
_console.WriteLine("# Parsed");
|
|
foreach (var item in context.Remaining.Parsed)
|
|
{
|
|
_console.WriteLine(string.Format("{0}={1}", item.Key, string.Join(",", item.Select(x => x))));
|
|
}
|
|
}
|
|
|
|
return 0;
|
|
}
|
|
}
|
|
}
|