Files
spectre.console/src/Spectre.Console.Cli/ICommandOfT.cs
Cédric Luthi f5f61ca610 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
2025-10-11 20:51:01 +02:00

18 lines
765 B
C#

namespace Spectre.Console.Cli;
/// <summary>
/// Represents a command.
/// </summary>
/// <typeparam name="TSettings">The settings type.</typeparam>
public interface ICommand<TSettings> : ICommandLimiter<TSettings>
where TSettings : CommandSettings
{
/// <summary>
/// Executes the command.
/// </summary>
/// <param name="context">The command context.</param>
/// <param name="settings">The settings.</param>
/// <param name="cancellationToken">A <see cref="CancellationToken"/> that can be used to abort the command.</param>
/// <returns>An integer indicating whether or not the command executed successfully.</returns>
Task<int> ExecuteAsync(CommandContext context, TSettings settings, CancellationToken cancellationToken);
}