about summary refs log tree commit diff
path: root/MatrixUtils.RoomUpgradeCLI/Program.cs
blob: 64de5530e685e179f827558ac685f95912c97a66 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
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();

if (args.Length == 0) {
    Console.WriteLine("No command provided. Use 'new', 'new-upgrade', or 'import-upgrade'.");
    return;
}

builder.Services.AddSingleton<RuntimeContext>(new RuntimeContext() {
    Args = args
});

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;
}

var host = builder.Build();
host.Run();