Add console abstraction, remove CommandContext

This commit is contained in:
Alexey Golub
2019-07-30 17:35:06 +03:00
parent 5174d5354b
commit 041a995c62
26 changed files with 399 additions and 391 deletions

View File

@@ -3,7 +3,7 @@ using System.Collections.Generic;
using System.Threading.Tasks;
using CliFx.Attributes;
using CliFx.Exceptions;
using CliFx.Models;
using CliFx.Services;
using FluentAssertions;
using NUnit.Framework;
@@ -14,19 +14,19 @@ namespace CliFx.Tests
[Command]
private class TestDefaultCommand : ICommand
{
public Task ExecuteAsync(CommandContext context) => Task.CompletedTask;
public Task ExecuteAsync(IConsole console) => Task.CompletedTask;
}
[Command("command")]
private class TestNamedCommand : ICommand
{
public Task ExecuteAsync(CommandContext context) => Task.CompletedTask;
public Task ExecuteAsync(IConsole console) => Task.CompletedTask;
}
[Command("faulty command")]
private class TestFaultyCommand : ICommand
{
public Task ExecuteAsync(CommandContext context) => Task.FromException(new CommandErrorException(-1337));
public Task ExecuteAsync(IConsole console) => Task.FromException(new CommandErrorException(-1337));
}
}