diff --git a/Akari.Prototype.Server/Akari.Prototype.Server.csproj b/Akari.Prototype.Server/Akari.Prototype.Server.csproj
index 5848232..f3d3904 100644
--- a/Akari.Prototype.Server/Akari.Prototype.Server.csproj
+++ b/Akari.Prototype.Server/Akari.Prototype.Server.csproj
@@ -9,6 +9,7 @@
+
diff --git a/Akari.Prototype.Server/Cli/Commands/MainCommand.cs b/Akari.Prototype.Server/Cli/Commands/MainCommand.cs
new file mode 100644
index 0000000..bbbb0d8
--- /dev/null
+++ b/Akari.Prototype.Server/Cli/Commands/MainCommand.cs
@@ -0,0 +1,19 @@
+using CliFx;
+using CliFx.Attributes;
+using CliFx.Infrastructure;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+
+namespace Akari.Prototype.Server.Cli.Commands
+{
+ [Command]
+ public class MainCommand : ICommand
+ {
+ public async ValueTask ExecuteAsync(IConsole console)
+ {
+ await Program.AspMain(Array.Empty());
+ }
+ }
+}
diff --git a/Akari.Prototype.Server/Program.cs b/Akari.Prototype.Server/Program.cs
index b9867dd..071759c 100644
--- a/Akari.Prototype.Server/Program.cs
+++ b/Akari.Prototype.Server/Program.cs
@@ -1,4 +1,5 @@
using Akari.Prototype.Server.Options;
+using CliFx;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
@@ -15,7 +16,13 @@ namespace Akari.Prototype.Server
{
public class Program
{
- public static void Main(string[] args)
+ public static async Task Main() =>
+ await new CliApplicationBuilder()
+ .AddCommandsFromThisAssembly()
+ .Build()
+ .RunAsync();
+
+ public static async Task AspMain(string[] args)
{
var host = CreateHostBuilder(args).Build();
@@ -27,7 +34,7 @@ namespace Akari.Prototype.Server
Directory.CreateDirectory(akariOptions.DataPath);
}
- host.Run();
+ await host.RunAsync();
}
// Additional configuration is required to successfully run gRPC on macOS.