namespace Spectre.Console.Testing; /// /// A that triggers a callback when invoked. /// public sealed class CallbackCommandInterceptor : ICommandInterceptor { private readonly Action _callback; /// /// Initializes a new instance of the class. /// /// The callback to call when the interceptor is invoked. public CallbackCommandInterceptor(Action callback) { _callback = callback ?? throw new ArgumentNullException(nameof(callback)); } /// public void Intercept(CommandContext context, CommandSettings settings) { _callback(context, settings); } }