mirror of
https://github.com/spectreconsole/spectre.console.git
synced 2025-10-25 15:19:23 +00:00
* Renames Spectre.Cli to Spectre.Console.Cli. * Now uses Verify with Spectre.Console.Cli tests. * Removes some duplicate definitions. Closes #168
23 lines
619 B
C#
23 lines
619 B
C#
using System;
|
|
using Spectre.Console.Cli;
|
|
|
|
namespace Spectre.Console.Tests.Data
|
|
{
|
|
public sealed class InterceptingCommand<TSettings> : Command<TSettings>
|
|
where TSettings : CommandSettings
|
|
{
|
|
private readonly Action<CommandContext, TSettings> _action;
|
|
|
|
public InterceptingCommand(Action<CommandContext, TSettings> action)
|
|
{
|
|
_action = action ?? throw new ArgumentNullException(nameof(action));
|
|
}
|
|
|
|
public override int Execute(CommandContext context, TSettings settings)
|
|
{
|
|
_action(context, settings);
|
|
return 0;
|
|
}
|
|
}
|
|
}
|