about summary refs log tree commit diff
path: root/MatrixUtils.RoomUpgradeCLI/Program.cs
diff options
context:
space:
mode:
authorRory& <root@rory.gay>2025-08-12 16:47:27 +0200
committerRory& <root@rory.gay>2025-08-12 16:47:56 +0200
commitb0581cd4b13e32a0a802ba8ddfcb6daad137cc49 (patch)
treefc7ea1edbab44880c24d60adb508f2f04992f4e8 /MatrixUtils.RoomUpgradeCLI/Program.cs
parentExample config (diff)
downloadMatrixUtils-b0581cd4b13e32a0a802ba8ddfcb6daad137cc49.tar.xz
Room upgrade CLI changes
Diffstat (limited to 'MatrixUtils.RoomUpgradeCLI/Program.cs')
-rw-r--r--MatrixUtils.RoomUpgradeCLI/Program.cs46
1 files changed, 27 insertions, 19 deletions
diff --git a/MatrixUtils.RoomUpgradeCLI/Program.cs b/MatrixUtils.RoomUpgradeCLI/Program.cs

index 64de553..c4157e9 100644 --- a/MatrixUtils.RoomUpgradeCLI/Program.cs +++ b/MatrixUtils.RoomUpgradeCLI/Program.cs
@@ -1,28 +1,36 @@ +using ArcaneLibs.Extensions; using LibMatrix.Services; using LibMatrix.Utilities.Bot; using MatrixUtils.RoomUpgradeCLI; using MatrixUtils.RoomUpgradeCLI.Commands; -var builder = Host.CreateApplicationBuilder(args); -builder.Services.AddRoryLibMatrixServices(); -builder.Services.AddMatrixBot(); +foreach (var group in args.Split(";")) { + var argGroup = group.ToArray(); + var builder = Host.CreateApplicationBuilder(args); + builder.Services.AddRoryLibMatrixServices(); + builder.Services.AddMatrixBot(); -if (args.Length == 0) { - Console.WriteLine("No command provided. Use 'new', 'new-upgrade', or 'import-upgrade'."); - return; -} + if (argGroup.Length == 0) { + Console.WriteLine("Unknown command. Use 'new', 'modify', 'import-upgrade-state' or 'execute'."); + Console.WriteLine("Hint: you can chain commands with a semicolon (;) argument."); + return; + } -builder.Services.AddSingleton<RuntimeContext>(new RuntimeContext() { - Args = args -}); + Console.WriteLine($"Running command: {string.Join(", ", argGroup)}"); -if (args[0] == "new") - builder.Services.AddHostedService<NewFileCommand>(); -else if (args[0] == "import-upgrade") { } -else { - Console.WriteLine("Unknown command. Use 'new', 'new-upgrade', or 'import-upgrade'."); - return; -} + builder.Services.AddSingleton(new RuntimeContext() { + Args = argGroup + }); -var host = builder.Build(); -host.Run(); \ No newline at end of file + if (argGroup[0] == "new") builder.Services.AddHostedService<NewFileCommand>(); + else if (argGroup[0] == "modify") builder.Services.AddHostedService<ModifyCommand>(); + else if (argGroup[0] == "import-upgrade-state") builder.Services.AddHostedService<ImportUpgradeStateCommand>(); + else if (argGroup[0] == "execute") builder.Services.AddHostedService<ExecuteCommand>(); + else { + Console.WriteLine("Unknown command. Use 'new', 'modify', 'import-upgrade-state' or 'execute'."); + return; + } + + var host = builder.Build(); + host.Run(); +} \ No newline at end of file