mycroforge/MycroForge.CLI/Commands/MycroForge.Api.Run.cs

29 lines
769 B
C#

using System.CommandLine;
using MycroForge.CLI.Commands.Interfaces;
namespace MycroForge.CLI.Commands;
public partial class MycroForge
{
public partial class Api
{
public class Run : Command, ISubCommandOf<Api>
{
private readonly ProjectContext _context;
public Run(ProjectContext context) : base("run", "Run your app")
{
_context = context;
this.SetHandler(ExecuteAsync);
}
private async Task ExecuteAsync()
{
await _context.Bash([
"source .venv/bin/activate",
"uvicorn main:app --reload"
]);
}
}
}
}