Skip to content

Commit

Permalink
Add ListHashesCommand
Browse files Browse the repository at this point in the history
  • Loading branch information
DaZombieKiller committed May 14, 2024
1 parent 5a24811 commit 4ec37fa
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
25 changes: 25 additions & 0 deletions tools/TLTool/ListHashesCommand.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
using System.CommandLine;
using System.CommandLine.Invocation;

namespace TLTool;

public sealed class ListHashesCommand
{
public Command Command { get; } = new("list-hashes");

public Argument<string[]> Names { get; } = new("names") { Arity = ArgumentArity.OneOrMore };

public ListHashesCommand()
{
Command.AddArgument(Names);
Handler.SetHandler(Command, Execute);
}

public void Execute(InvocationContext context)
{
foreach (string name in context.ParseResult.GetValueForArgument(Names))
{
Console.WriteLine($"{NameHash.Compute(name):X8}: {name}");
}
}
}
1 change: 1 addition & 0 deletions tools/TLTool/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@
root.AddCommand(new TextureDdsConvertCommand().Command);
root.AddCommand(new InsertCommand().Command);
root.AddCommand(new ListNamesCommand().Command);
root.AddCommand(new ListHashesCommand().Command);
await root.InvokeAsync(Environment.CommandLine);

0 comments on commit 4ec37fa

Please sign in to comment.