Compare commits

...

2 Commits

Author SHA1 Message Date
Jarrod Doyle 00c2d14a06
Make published build AOT and trimmed 2024-12-09 16:04:08 +00:00
Jarrod Doyle 07e7fb1801
Change CLI library 2024-12-09 16:03:27 +00:00
2 changed files with 23 additions and 20 deletions

View File

@ -5,10 +5,13 @@
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<SelfContained>true</SelfContained>
<PublishTrimmed>true</PublishTrimmed>
<PublishAot>true</PublishAot>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="clifx" Version="2.3.5" />
<PackageReference Include="DotMake.CommandLine" Version="1.8.8" />
<PackageReference Include="TinyEmbree" Version="1.0.3" />
</ItemGroup>

View File

@ -1,28 +1,29 @@
using CliFx;
using CliFx.Attributes;
using IConsole = CliFx.Infrastructure.IConsole;
using DotMake.CommandLine;
namespace KeepersCompound.Lightmapper;
internal static class Program
{
public static async Task<int> Main() =>
await new CliApplicationBuilder().AddCommandsFromThisAssembly().Build().RunAsync();
public static async Task<int> Main(string[] args) =>
await Cli.RunAsync<LightCommand>(args);
}
[Command(Description = "Compute lightmaps for a NewDark .MIS/.COW")]
public class LightCommand : ICommand
[CliCommand(Description = "Compute lightmaps for a NewDark .MIS/.COW")]
public class LightCommand
{
[CommandParameter(0, Description = "The path to the root Thief installation.")]
public required string InstallPath { get; init; }
[CommandParameter(1, Description = "The folder name of the fan mission. For OMs this is blank.")]
public required string CampaignName { get; init; }
[CommandParameter(2, Description = "The name of the mission file including extension.")]
public required string MissionName { get; init; }
[CommandOption("output", 'o', Description = "Name of output file excluding extension.")]
public string OutputName { get; init; } = "kc_lit";
[CliArgument(Description = "The path to the root Thief installation.")]
public required string InstallPath { get; set; }
public ValueTask ExecuteAsync(IConsole console)
[CliArgument(Description = "The folder name of the fan mission. For OMs this is blank.")]
public required string CampaignName { get; set; }
[CliArgument(Description = "The name of the mission file including extension.")]
public required string MissionName { get; set; }
[CliOption(Description = "Name of output file excluding extension.")]
public string OutputName { get; set; } = "kc_lit";
public void Run()
{
Timing.Reset();
@ -31,6 +32,5 @@ public class LightCommand : ICommand
lightMapper.Save(OutputName);
Timing.LogAll();
return default;
}
}