33 lines
912 B
C#
33 lines
912 B
C#
using System.CommandLine;
|
|
using MicroForge.CLI.Commands.Interfaces;
|
|
|
|
namespace MicroForge.CLI.Commands;
|
|
|
|
public partial class MicroForge
|
|
{
|
|
public new partial class Add : Command, ISubCommandOf<MicroForge>
|
|
{
|
|
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<MicroForge>
|
|
{
|
|
public Run() : base("run", "Run your app")
|
|
{
|
|
this.SetHandler(ExecuteAsync);
|
|
}
|
|
|
|
private async Task ExecuteAsync()
|
|
{
|
|
await Bash.ExecuteAsync([
|
|
"source .venv/bin/activate",
|
|
"uvicorn main:app --reload"
|
|
]);
|
|
}
|
|
}
|
|
} |