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

@@ -18,6 +18,7 @@ internal sealed class CommandAppSettings : ICommandAppSettings
public HelpProviderStyle? HelpProviderStyles { get; set; }
public bool StrictParsing { get; set; }
public bool ConvertFlagsToRemainingArguments { get; set; }
public int CancellationExitCode { get; set; }
public ParsingMode ParsingMode =>
StrictParsing ? ParsingMode.Strict : ParsingMode.Relaxed;
@@ -33,6 +34,7 @@ internal sealed class CommandAppSettings : ICommandAppSettings
TrimTrailingPeriod = true;
HelpProviderStyles = HelpProviderStyle.Default;
ConvertFlagsToRemainingArguments = false;
CancellationExitCode = 130;
}
public bool IsTrue(Func<CommandAppSettings, bool> func, string environmentVariableName)