Files
CliFx/CliFx.Tests/TestCommands/CommandExceptionCommand.cs
Alexey Golub 6ce52c70f7 Use ValueTask
2019-12-16 22:16:16 +02:00

19 lines
519 B
C#

using System.Threading.Tasks;
using CliFx.Attributes;
using CliFx.Exceptions;
using CliFx.Services;
namespace CliFx.Tests.TestCommands
{
[Command("exc")]
public class CommandExceptionCommand : ICommand
{
[CommandOption("code", 'c')]
public int ExitCode { get; set; } = 1337;
[CommandOption("msg", 'm')]
public string? Message { get; set; }
public ValueTask ExecuteAsync(IConsole console) => throw new CommandException(Message, ExitCode);
}
}