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