Add top-level CancellationToken support to Spectre.Console.Cli

Also raise CA2016 (forward the CancellationToken parameter to methods that take one) to warning

Fixes #701
This commit is contained in:
Cédric Luthi
2024-09-09 00:21:17 +02:00
committed by Patrik Svensson
parent d90e94dbb3
commit f5f61ca610
55 changed files with 222 additions and 174 deletions

View File

@@ -2,6 +2,7 @@ using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net.Http;
using System.Threading;
using System.Threading.Tasks;
using AngleSharp.Html.Parser;
using Generator.Models;
@@ -39,7 +40,7 @@ namespace Generator.Commands
_parser = new HtmlParser();
}
public override async Task<int> ExecuteAsync(CommandContext context, Settings settings)
public override async Task<int> ExecuteAsync(CommandContext context, Settings settings, CancellationToken cancellationToken)
{
var output = new DirectoryPath(settings.Output);
if (!_fileSystem.Directory.Exists(settings.Output))