mycroforge/MycroForge.CLI/Commands/MycroForge.Add.cs

33 lines
908 B
C#

using System.CommandLine;
using MycroForge.CLI.Commands.Interfaces;
namespace MycroForge.CLI.Commands;
public partial class MycroForge
{
public new partial class Add : Command, ISubCommandOf<MycroForge>
{
public Add(IEnumerable<ISubCommandOf<Add>> subCommands) :
base("add", "Add a predefined feature to your project")
{
foreach (var subCommandOf in subCommands)
AddCommand((subCommandOf as Command)!);
}
}
public class Run : Command, ISubCommandOf<MycroForge>
{
public Run() : base("run", "Run your app")
{
this.SetHandler(ExecuteAsync);
}
private async Task ExecuteAsync()
{
await Bash.RunAsync([
"source .venv/bin/activate",
"uvicorn main:app --reload"
]);
}
}
}