Change CLI library

This commit is contained in:
Jarrod Doyle 2024-12-09 16:03:27 +00:00
parent 1b962831a0
commit 07e7fb1801
Signed by: Jayrude
GPG Key ID: 38B57B16E7C0ADF7
2 changed files with 20 additions and 20 deletions

View File

@ -8,7 +8,7 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="clifx" Version="2.3.5" /> <PackageReference Include="DotMake.CommandLine" Version="1.8.8" />
<PackageReference Include="TinyEmbree" Version="1.0.3" /> <PackageReference Include="TinyEmbree" Version="1.0.3" />
</ItemGroup> </ItemGroup>

View File

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