mirror of
https://github.com/Tyrrrz/CliFx.git
synced 2025-10-25 15:19:17 +00:00
Don't add abstract and interface types that implement ICommand
This commit is contained in:
@@ -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);
|
||||||
|
|||||||
Reference in New Issue
Block a user