1
0
mirror of synced 2024-06-29 07:17:39 +00:00
Tapeti/Tapeti.Cmd/Verbs/ExecutableVerbAttribute.cs
Mark van Renswoude e157598fa7 Implemented #32: Progress and batching for Tapeti.Cmd import
Refactored console interaction to support this feature
Updated documentation with recently added verbs
2021-09-04 14:01:03 +02:00

32 lines
813 B
C#

using System;
using Tapeti.Cmd.ConsoleHelper;
namespace Tapeti.Cmd.Verbs
{
/// <remarks>
/// Implementations are expected to have a constructor which accepts the options class
/// associated with the ExecutableVerb attribute.
/// </remarks>
public interface IVerbExecuter
{
void Execute(IConsole console);
}
[AttributeUsage(AttributeTargets.Class)]
public class ExecutableVerbAttribute : Attribute
{
public Type VerbExecuter { get; }
public ExecutableVerbAttribute(Type verbExecuter)
{
if (!typeof(IVerbExecuter).IsAssignableFrom(verbExecuter))
throw new InvalidCastException("Type must support IVerbExecuter");
VerbExecuter = verbExecuter;
}
}
}