Modified plugin system code
This commit is contained in:
@@ -10,18 +10,21 @@ public partial class MycroForge
|
||||
{
|
||||
public class Init : Command, ISubCommandOf<Plugin>
|
||||
{
|
||||
private static readonly Argument<string> NameArgument =
|
||||
new(name: "name", description: "The name of your project");
|
||||
|
||||
private readonly ProjectContext _context;
|
||||
|
||||
|
||||
public Init(ProjectContext context) : base("init", "Initialize a basic plugin project")
|
||||
{
|
||||
_context = context;
|
||||
this.SetHandler(ExecuteAsync);
|
||||
AddArgument(NameArgument);
|
||||
this.SetHandler(ExecuteAsync, NameArgument);
|
||||
}
|
||||
|
||||
private void ExecuteAsync()
|
||||
private async Task ExecuteAsync(string name)
|
||||
{
|
||||
foreach (var plugin in Plugins.Loaded)
|
||||
Console.WriteLine($"name: {plugin.Name}, command: {plugin.Command}");
|
||||
await _context.Bash($"dotnet new m4gp -n {name}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ public partial class MycroForge
|
||||
private void ExecuteAsync()
|
||||
{
|
||||
foreach (var plugin in Plugins.Loaded)
|
||||
Console.WriteLine($"name: {plugin.Name}, command: {plugin.Command}");
|
||||
Console.WriteLine($"{plugin.Name}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
using System.CommandLine;
|
||||
using MycroForge.Core.Contract;
|
||||
using Core_RootCommand = MycroForge.Core.RootCommand;
|
||||
using RootCommand = MycroForge.Core.RootCommand;
|
||||
|
||||
namespace MycroForge.CLI.Commands;
|
||||
|
||||
public sealed partial class MycroForge : Core_RootCommand
|
||||
public sealed partial class MycroForge : RootCommand
|
||||
{
|
||||
public override string Name => "m4g";
|
||||
|
||||
|
||||
Reference in New Issue
Block a user