Added hydrate command
This commit is contained in:
parent
d5f883baca
commit
6b946faf93
28
MycroForge.CLI/Commands/MycroForge.Hydrate.cs
Normal file
28
MycroForge.CLI/Commands/MycroForge.Hydrate.cs
Normal file
@ -0,0 +1,28 @@
|
||||
using System.CommandLine;
|
||||
using MycroForge.CLI.Commands.Interfaces;
|
||||
|
||||
namespace MycroForge.CLI.Commands;
|
||||
|
||||
public partial class MycroForge
|
||||
{
|
||||
public class Hydrate : Command, ISubCommandOf<MycroForge>
|
||||
{
|
||||
private readonly ProjectContext _context;
|
||||
|
||||
public Hydrate(ProjectContext context)
|
||||
: base("hydrate", "Create a new venv and install dependencies listed in 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"
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
@ -23,6 +23,7 @@ public static class ServiceCollectionExtensions
|
||||
services.AddScoped<ISubCommandOf<Commands.MycroForge>, Commands.MycroForge.Init>();
|
||||
services.AddScoped<ISubCommandOf<Commands.MycroForge>, Commands.MycroForge.Install>();
|
||||
services.AddScoped<ISubCommandOf<Commands.MycroForge>, Commands.MycroForge.Uninstall>();
|
||||
services.AddScoped<ISubCommandOf<Commands.MycroForge>, Commands.MycroForge.Hydrate>();
|
||||
|
||||
// Register "m4g generate"
|
||||
services.AddScoped<ISubCommandOf<Commands.MycroForge>, Commands.MycroForge.Generate>();
|
||||
|
Loading…
Reference in New Issue
Block a user