Room upgrade CLI changes
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
|