50 lines
1.2 KiB
C#
50 lines
1.2 KiB
C#
using System.CommandLine;
|
|
using MycroForge.CLI;
|
|
using MycroForge.CLI.Extensions;
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
using Microsoft.Extensions.Hosting;
|
|
|
|
using var host = Host
|
|
.CreateDefaultBuilder()
|
|
.ConfigureServices((_, services) =>
|
|
{
|
|
services
|
|
.AddServices()
|
|
.AddCommands();
|
|
})
|
|
.Build();
|
|
|
|
try
|
|
{
|
|
await host.Services.GetRequiredService<MycroForge.CLI.Commands.MycroForge>().InvokeAsync(args);
|
|
}
|
|
catch(Exception e)
|
|
{
|
|
Console.WriteLine(e.Message);
|
|
}
|
|
|
|
|
|
// using MycroForge.CLI.CodeGen;
|
|
// using MycroForge.Parsing;
|
|
//
|
|
// var src = new Tester().Rewrite();
|
|
// Console.WriteLine(src);
|
|
//
|
|
// class Tester : PythonSourceModifier
|
|
// {
|
|
// public Tester() : base(File.ReadAllText("scripts/user.py"))
|
|
// {
|
|
//
|
|
// }
|
|
//
|
|
// public override object? VisitAssignment(PythonParser.AssignmentContext context)
|
|
// {
|
|
// Console.WriteLine(GetOriginalText(context));
|
|
// return base.VisitAssignment(context);
|
|
// }
|
|
// }
|
|
|
|
|
|
// using MycroForge.CLI.CodeGen;
|
|
// var src = new EntityModifier(await File.ReadAllTextAsync("scripts/user.py")).Rewrite();
|
|
// Console.WriteLine(src); |