mycroforge/MycroForge.Plugin.Template/HelloWorldCommand.cs

25 lines
714 B
C#

using System.CommandLine;
using MycroForge.Core;
using MycroForge.Core.Contract;
using RootCommand = MycroForge.Core.RootCommand;
namespace MycroForge.Plugin.Template;
public class HelloWorldCommand : Command, ISubCommandOf<RootCommand>
{
private readonly ProjectContext _context;
public HelloWorldCommand(ProjectContext context) :
base(Constants.MainCommandName, "Custom command for My Jewellery specific stuff")
{
_context = context;
this.SetHandler(ExecuteAsync);
}
private async Task ExecuteAsync()
{
await _context.CreateFile("hello_world.txt",
"My Jewellery command plugin is working!"
);
}
}