2026-02-04 13:17:44 +08:00
|
|
|
using System.Runtime.InteropServices;
|
2026-02-10 18:23:28 +08:00
|
|
|
using FCPModUpdater;
|
2026-02-04 08:58:36 +08:00
|
|
|
using FCPModUpdater.Commands;
|
2026-02-04 13:17:44 +08:00
|
|
|
using Spectre.Console;
|
2026-02-04 08:58:36 +08:00
|
|
|
using Spectre.Console.Cli;
|
|
|
|
|
|
|
|
|
|
var app = new CommandApp();
|
|
|
|
|
|
|
|
|
|
app.Configure(config =>
|
|
|
|
|
{
|
|
|
|
|
config.SetApplicationName("fcp-mod-manager");
|
2026-02-10 18:23:28 +08:00
|
|
|
config.SetApplicationVersion(AppVersion.InformationalVersion);
|
2026-02-04 13:50:34 +08:00
|
|
|
config.SetInterceptor(new GitRequiredInterceptor());
|
2026-02-04 08:58:36 +08:00
|
|
|
|
|
|
|
|
config.AddCommand<ScanCommand>("scan")
|
2026-02-04 13:17:44 +08:00
|
|
|
.WithDescription("Scan mods and show interactive menu (DEFAULT)")
|
2026-02-04 08:58:36 +08:00
|
|
|
.WithExample("scan")
|
|
|
|
|
.WithExample("scan", "--directory", "/path/to/RimWorld/Mods");
|
|
|
|
|
|
|
|
|
|
config.AddCommand<UpdateCommand>("update")
|
|
|
|
|
.WithDescription("Update all FCP mods (non-interactive)")
|
|
|
|
|
.WithExample("update")
|
|
|
|
|
.WithExample("update", "--directory", "/path/to/RimWorld/Mods");
|
2026-02-04 13:17:44 +08:00
|
|
|
|
2026-02-04 08:58:36 +08:00
|
|
|
});
|
|
|
|
|
|
2026-02-04 13:17:44 +08:00
|
|
|
app.SetDefaultCommand<ScanCommand>();
|
|
|
|
|
|
|
|
|
|
var result = await app.RunAsync(args);
|
|
|
|
|
|
|
|
|
|
// On Windows, wait for key press before closing so the window doesn't vanish
|
|
|
|
|
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
|
|
|
|
|
{
|
|
|
|
|
AnsiConsole.WriteLine();
|
|
|
|
|
AnsiConsole.MarkupLine("[grey]Press any key to exit...[/]");
|
|
|
|
|
Console.ReadKey(true);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return result;
|