mirror of
https://github.com/nsnail/spectre.console.git
synced 2025-04-17 17:32:50 +08:00
32 lines
988 B
C#
32 lines
988 B
C#
namespace Spectre.Console.Cli;
|
|
|
|
/// <summary>
|
|
/// Base class for an asynchronous command with no settings.
|
|
/// </summary>
|
|
public abstract class AsyncCommand : ICommand<EmptyCommandSettings>
|
|
{
|
|
/// <summary>
|
|
/// Executes the command.
|
|
/// </summary>
|
|
/// <param name="context">The command context.</param>
|
|
/// <returns>An integer indicating whether or not the command executed successfully.</returns>
|
|
public abstract Task<int> ExecuteAsync(CommandContext context);
|
|
|
|
/// <inheritdoc/>
|
|
Task<int> ICommand<EmptyCommandSettings>.Execute(CommandContext context, EmptyCommandSettings settings)
|
|
{
|
|
return ExecuteAsync(context);
|
|
}
|
|
|
|
/// <inheritdoc/>
|
|
Task<int> ICommand.Execute(CommandContext context, CommandSettings settings)
|
|
{
|
|
return ExecuteAsync(context);
|
|
}
|
|
|
|
/// <inheritdoc/>
|
|
ValidationResult ICommand.Validate(CommandContext context, CommandSettings settings)
|
|
{
|
|
return ValidationResult.Success();
|
|
}
|
|
} |