mirror of
https://github.com/spectreconsole/spectre.console.git
synced 2026-01-01 00:46:42 +01:00
Move Spectre.Console.Cli to it's own package
This commit is contained in:
committed by
Patrik Svensson
parent
b600832e00
commit
36ca22ffac
32
src/Spectre.Console.Cli/AsyncCommand.cs
Normal file
32
src/Spectre.Console.Cli/AsyncCommand.cs
Normal file
@@ -0,0 +1,32 @@
|
||||
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();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user