This repository has been archived on 2023-02-02. You can view files and clone it, but cannot push or open issues or pull requests.
mfgames-toolbuilder-cil/tests/SampleTool/SampleToolModule.cs
2022-04-02 19:15:30 -05:00

43 lines
1.2 KiB
C#

using System.CommandLine;
using Autofac;
using SampleTool;
namespace MfGames.ToolBuilder
{
/// <summary>
/// The Autofac module to pull in the components inside this assembly.
/// </summary>
public class SampleToolModule : Module
{
/// <inheritdoc />
protected override void Load(ContainerBuilder builder)
{
builder
.RegisterAssemblyTypes(this.GetType().Assembly)
.AsSelf()
.AsImplementedInterfaces();
builder
.Register(
c =>
{
var root = new RootCommand
{
Name = "sample-tool",
Description =
"A sample tool that demonstrates functionality",
};
root.AddCommand(c.Resolve<CrashCommand>());
root.AddCommand(c.Resolve<TableCommand>());
root.AddCommand(c.Resolve<LogCommand>());
return root;
})
.AsSelf();
}
}
}