mirror of
https://github.com/Tyrrrz/CliFx.git
synced 2025-10-25 15:19:17 +00:00
23 lines
546 B
C#
23 lines
546 B
C#
using System;
|
|
using System.Threading.Tasks;
|
|
using CliFx.Attributes;
|
|
using CliFx.Services;
|
|
|
|
namespace CliFx.Tests.TestCommands
|
|
{
|
|
[Command("cancel")]
|
|
public class CancellableCommand : ICommand
|
|
{
|
|
public async ValueTask ExecuteAsync(IConsole console)
|
|
{
|
|
await Task.Yield();
|
|
|
|
console.Output.WriteLine("Printed");
|
|
|
|
await Task.Delay(TimeSpan.FromSeconds(1), console.GetCancellationToken()).ConfigureAwait(false);
|
|
|
|
console.Output.WriteLine("Never printed");
|
|
}
|
|
}
|
|
}
|