mycroforge/MycroForge.CLI/Commands/MycroForge.Hydrate.cs

29 lines
815 B
C#

using System.CommandLine;
using MycroForge.Core;
using MycroForge.Core.Contract;
namespace MycroForge.CLI.Commands;
public partial class MycroForge
{
public class Hydrate : Command, ISubCommandOf<MycroForge>
{
private readonly ProjectContext _context;
public Hydrate(ProjectContext context)
: base("hydrate", "Initialize venv and install dependencies from requirements.txt")
{
_context = context;
this.SetHandler(ExecuteAsync);
}
private async Task ExecuteAsync()
{
await _context.Bash(
"python3 -m venv .venv",
"source .venv/bin/activate",
"python3 -m pip install -r requirements.txt"
);
}
}
}