2022-10-01 00:46:15 +00:00
|
|
|
<#@ template language="C#v3.5" #>
|
|
|
|
<#@ assembly name="System.Core" #>
|
|
|
|
<#@ import namespace="System.Text" #>
|
|
|
|
<#@ import namespace="System.Linq" #>
|
|
|
|
<#@ import namespace="System.IO"#>
|
|
|
|
<#@ import namespace="System.Collections.Generic" #>
|
|
|
|
|
2022-10-14 22:08:21 +00:00
|
|
|
using Microsoft.Extensions.DependencyInjection;
|
2022-10-01 00:46:15 +00:00
|
|
|
namespace Wabbajack.CLI;
|
|
|
|
using Wabbajack.CLI.Verbs;
|
2022-10-14 22:08:21 +00:00
|
|
|
using Wabbajack.CLI.Builder;
|
2022-10-01 00:46:15 +00:00
|
|
|
|
2022-10-14 22:08:21 +00:00
|
|
|
public static class CommandLineBuilderExtensions{
|
2022-10-01 00:46:15 +00:00
|
|
|
|
2022-10-14 22:08:21 +00:00
|
|
|
public static void AddCLIVerbs(this IServiceCollection services) {
|
2022-10-01 00:46:15 +00:00
|
|
|
<#
|
|
|
|
foreach (var verb in Directory.EnumerateFiles("Verbs"))
|
|
|
|
{
|
|
|
|
var klass = verb.Split('\\').Last().Split('.').First();
|
|
|
|
if (klass == "IVerb") continue;
|
|
|
|
#>
|
2022-10-14 22:08:21 +00:00
|
|
|
CommandLineBuilder.RegisterCommand<<#=klass#>>(<#=klass#>.Definition, c => ((<#=klass#>)c).Run);
|
|
|
|
services.AddSingleton<<#=klass#>>();
|
2022-10-01 00:46:15 +00:00
|
|
|
<#
|
|
|
|
}
|
|
|
|
|
|
|
|
#>
|
|
|
|
}
|
|
|
|
}
|