Don't add abstract and interface types that implement ICommand

This commit is contained in:
Alexey Golub
2019-08-20 18:12:22 +03:00
parent 9e04f79469
commit 59ee2e34d8

View File

@@ -38,7 +38,9 @@ namespace CliFx
{ {
commandAssembly.GuardNotNull(nameof(commandAssembly)); commandAssembly.GuardNotNull(nameof(commandAssembly));
var commandTypes = commandAssembly.ExportedTypes.Where(t => t.Implements(typeof(ICommand))); var commandTypes = commandAssembly.ExportedTypes
.Where(t => t.Implements(typeof(ICommand)))
.Where(t => !t.IsAbstract && !t.IsInterface);
foreach (var commandType in commandTypes) foreach (var commandType in commandTypes)
AddCommand(commandType); AddCommand(commandType);