mirror of
https://github.com/spectreconsole/spectre.console.git
synced 2025-10-25 15:19:23 +00:00
Also raise CA2016 (forward the CancellationToken parameter to methods that take one) to warning Fixes #701
24 lines
928 B
C#
24 lines
928 B
C#
namespace Spectre.Console.Cli;
|
|
|
|
/// <summary>
|
|
/// Represents a command.
|
|
/// </summary>
|
|
public interface ICommand
|
|
{
|
|
/// <summary>
|
|
/// Validates the specified settings and remaining arguments.
|
|
/// </summary>
|
|
/// <param name="context">The command context.</param>
|
|
/// <param name="settings">The settings.</param>
|
|
/// <returns>The validation result.</returns>
|
|
ValidationResult Validate(CommandContext context, CommandSettings settings);
|
|
|
|
/// <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>The validation result.</returns>
|
|
Task<int> ExecuteAsync(CommandContext context, CommandSettings settings, CancellationToken cancellationToken);
|
|
} |