Make CommandAttribute non-optional on command types

This commit is contained in:
Alexey Golub
2019-08-21 21:04:42 +03:00
parent df01dc055e
commit b45da64664
2 changed files with 70 additions and 65 deletions

View File

@@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection;
using CliFx.Attributes;
using CliFx.Internal;
using CliFx.Models;
using CliFx.Services;
@@ -40,6 +41,7 @@ namespace CliFx
var commandTypes = commandAssembly.ExportedTypes
.Where(t => t.Implements(typeof(ICommand)))
.Where(t => t.IsDefined(typeof(CommandAttribute)))
.Where(t => !t.IsAbstract && !t.IsInterface);
foreach (var commandType in commandTypes)