using System.CommandLine; using MicroForge.CLI; using MicroForge.CLI.CodeGen; using MicroForge.CLI.Exceptions; using MicroForge.CLI.Extensions; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Hosting; using RootCommand = MicroForge.CLI.Commands.MicroForge; using var host = Host .CreateDefaultBuilder() .ConfigureServices((_, services) => { services .AddServices(args) .AddCommands(); }) .Build(); try { var ctx = host.Services.GetRequiredService(); await ctx.LoadConfig(); await host.Services.GetRequiredService().InvokeAsync(args); await ctx.SaveConfig(); } catch { // Console.WriteLine(e.Message); } // var src = new OrmEnvInitializer(await File.ReadAllTextAsync("scripts/env.py")).Rewrite(); // Console.WriteLine(src);