using System.CommandLine; using MycroForge.CLI.Commands.Interfaces; namespace MycroForge.CLI.Commands; public partial class MycroForge { public class Install : Command, ISubCommandOf { private static readonly Argument> PackagesArgument = new(name: "packages", description: "The names of the packages to install"); public Install() : base("install", "Install packages and update the requirements.txt") { AddAlias("i"); AddArgument(PackagesArgument); this.SetHandler(ExecuteAsync, PackagesArgument); } private async Task ExecuteAsync(IEnumerable packages) { await Bash.ExecuteAsync( "source .venv/bin/activate", $"pip install {string.Join(' ', packages)}", "pip freeze > requirements.txt" ); } } }