Making plugin system more robust
This commit is contained in:
28
MycroForge.CLI/Commands/MycroForge.Plugin.Init.cs
Normal file
28
MycroForge.CLI/Commands/MycroForge.Plugin.Init.cs
Normal 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}");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user