using MicroForge.CLI.Commands.Interfaces; using MicroForge.CLI.Features; using Microsoft.Extensions.DependencyInjection; namespace MicroForge.CLI.Extensions; public static class ServiceCollectionExtensions { public static IServiceCollection AddServices(this IServiceCollection services, string[] args) { services.AddScoped(_ => new ArgsContext { Args = args }); services.AddScoped(); services.AddScoped(); services.AddScoped(); return services; } public static IServiceCollection AddCommands(this IServiceCollection services) { // Register "m4g" services.AddScoped(); services.AddScoped, Commands.MicroForge.Init>(); services.AddScoped, Commands.MicroForge.Run>(); services.AddScoped, Commands.MicroForge.Install>(); services.AddScoped, Commands.MicroForge.Uninstall>(); // Register "m4g add" services.AddScoped, Commands.MicroForge.Add>(); services.AddScoped, Commands.MicroForge.Add.Api>(); services.AddScoped, Commands.MicroForge.Add.Orm>(); // Register "m4g generate" services.AddScoped, Commands.MicroForge.Generate>(); services.AddScoped, Commands.MicroForge.Generate.Entity>(); services.AddScoped, Commands.MicroForge.Generate.Router>(); services.AddScoped, Commands.MicroForge.Generate.Migration>(); // Register "m4g migrations" services.AddScoped, Commands.MicroForge.Migrations>(); services.AddScoped, Commands.MicroForge.Migrations.Apply>(); services.AddScoped, Commands.MicroForge.Migrations.Rollback>(); return services; } }