Making plugin system more robust

This commit is contained in:
2024-06-30 13:59:40 +02:00
parent f329b00687
commit c220c214d2
10 changed files with 124 additions and 0 deletions

View File

@@ -0,0 +1,28 @@
using System.CommandLine;
using MycroForge.Core;
using MycroForge.Core.Contract;
namespace MycroForge.CLI.Commands;
public partial class MycroForge
{
public partial class Plugin
{
public class Init : Command, ISubCommandOf<Plugin>
{
private readonly ProjectContext _context;
public Init(ProjectContext context) : base("init", "Initialize a basic plugin project")
{
_context = context;
this.SetHandler(ExecuteAsync);
}
private void ExecuteAsync()
{
foreach (var plugin in Plugins.Loaded)
Console.WriteLine($"name: {plugin.Name}, command: {plugin.Command}");
}
}
}
}