Abstract out the CLI routines so we can reuse them inside the WPF app

This commit is contained in:
Halgari 2022-10-14 16:08:21 -06:00
parent 2b33aeb7d9
commit bb0c6c7ca9
31 changed files with 159 additions and 107 deletions

View File

@ -1,31 +1,20 @@
using System;
using System.Collections.Generic;
using System.CommandLine;
using System.CommandLine.Builder;
using System.CommandLine.Invocation;
using System.CommandLine.NamingConventionBinder;
using System.ComponentModel.Design;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.Extensions.DependencyInjection;
using Wabbajack.CLI.Verbs;
using Wabbajack.Paths;
using Wabbajack.Services.OSIntegrated;
namespace Wabbajack.CLI;
namespace Wabbajack.CLI.Builder;
public partial class CommandLineBuilder
public class CommandLineBuilder
{
private static IServiceProvider _provider;
public CommandLineBuilder(IServiceProvider provider, IConsole console, LoggingRateLimiterReporter _)
public CommandLineBuilder(IServiceProvider provider, IConsole console)
{
_provider = provider;
}
static CommandLineBuilder()
{
RegisterAll();
}
public async Task<int> Run(string[] args)
{
var root = new RootCommand();
@ -58,7 +47,7 @@ public partial class CommandLineBuilder
};
private Command MakeCommend(Type verbType, Func<IVerb, Delegate> verbHandler, VerbDefinition definition)
private Command MakeCommend(Type verbType, Func<object, Delegate> verbHandler, VerbDefinition definition)
{
var command = new Command(definition.Name, definition.Description);
foreach (var option in definition.Options)
@ -73,9 +62,9 @@ public partial class CommandLineBuilder
{
private IServiceProvider _provider;
private Type _type;
private readonly Func<IVerb, Delegate> _delgate;
private readonly Func<object, Delegate> _delgate;
public HandlerDelegate(IServiceProvider provider, Type type, Func<IVerb, Delegate> inner)
public HandlerDelegate(IServiceProvider provider, Type type, Func<object, Delegate> inner)
{
_provider = provider;
_type = type;
@ -83,22 +72,23 @@ public partial class CommandLineBuilder
}
public int Invoke(InvocationContext context)
{
var service = (IVerb)_provider.GetRequiredService(_type);
var service = _provider.GetRequiredService(_type);
var handler = CommandHandler.Create(_delgate(service));
return handler.Invoke(context);
}
public Task<int> InvokeAsync(InvocationContext context)
{
var service = (IVerb)_provider.GetRequiredService(_type);
var service = _provider.GetRequiredService(_type);
var handler = CommandHandler.Create(_delgate(service));
return handler.InvokeAsync(context);
}
}
private static List<(Type Type, VerbDefinition Definition, Func<IVerb, Delegate> Handler)> _commands { get; set; } = new();
private static List<(Type Type, VerbDefinition Definition, Func<object, Delegate> Handler)> _commands { get; set; } = new();
public static IEnumerable<Type> Verbs => _commands.Select(c => c.Type);
public static void RegisterCommand<T>(VerbDefinition definition, Func<IVerb, Delegate> handler)
public static void RegisterCommand<T>(VerbDefinition definition, Func<object, Delegate> handler)
{
_commands.Add((typeof(T), definition, handler));
@ -120,17 +110,3 @@ public record VerbDefinition(string Name, string Description, OptionDefinition[]
{
}
public static class CommandLineBuilderExtensions
{
public static IServiceCollection AddCommands(this IServiceCollection services)
{
services.AddSingleton<CommandLineBuilder>();
foreach (var verb in CommandLineBuilder.Verbs)
{
services.AddSingleton(verb);
}
return services;
}
}

View File

@ -0,0 +1,23 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="6.0.2-mauipre.1.22102.15" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="6.0.2-mauipre.1.22102.15" />
<PackageReference Include="Microsoft.Extensions.Hosting" Version="6.0.2-mauipre.1.22102.15" />
<PackageReference Include="Microsoft.Extensions.Hosting.Abstractions" Version="6.0.2-mauipre.1.22102.15" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="6.0.2" />
<PackageReference Include="System.CommandLine" Version="2.0.0-beta4.22272.1" />
<PackageReference Include="System.CommandLine.NamingConventionBinder" Version="2.0.0-beta4.22272.1" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Wabbajack.Paths\Wabbajack.Paths.csproj" />
</ItemGroup>
</Project>

View File

@ -18,6 +18,7 @@ using Wabbajack.Server.Lib;
using Wabbajack.Services.OSIntegrated;
using Wabbajack.VFS;
using Client = Wabbajack.Networking.GitHub.Client;
using Wabbajack.CLI.Builder;
namespace Wabbajack.CLI;
@ -46,7 +47,13 @@ internal class Program
services.AddTransient<Context>();
services.AddCommands();
services.AddSingleton<CommandLineBuilder>();
services.AddCLIVerbs();
services.AddSingleton<IUserInterventionHandler, UserInterventionHandler>();
}).Build();

View File

@ -1,32 +1,57 @@

using Microsoft.Extensions.DependencyInjection;
namespace Wabbajack.CLI;
using Wabbajack.CLI.Verbs;
using Wabbajack.CLI.Builder;
public partial class CommandLineBuilder {
public static class CommandLineBuilderExtensions{
private static void RegisterAll() {
RegisterCommand<Compile>(Compile.Definition, c => ((Compile)c).Run);
RegisterCommand<Decrypt>(Decrypt.Definition, c => ((Decrypt)c).Run);
RegisterCommand<DownloadAll>(DownloadAll.Definition, c => ((DownloadAll)c).Run);
RegisterCommand<DownloadUrl>(DownloadUrl.Definition, c => ((DownloadUrl)c).Run);
RegisterCommand<DumpZipInfo>(DumpZipInfo.Definition, c => ((DumpZipInfo)c).Run);
RegisterCommand<Encrypt>(Encrypt.Definition, c => ((Encrypt)c).Run);
RegisterCommand<Extract>(Extract.Definition, c => ((Extract)c).Run);
RegisterCommand<ForceHeal>(ForceHeal.Definition, c => ((ForceHeal)c).Run);
RegisterCommand<HashFile>(HashFile.Definition, c => ((HashFile)c).Run);
RegisterCommand<HashUrlString>(HashUrlString.Definition, c => ((HashUrlString)c).Run);
RegisterCommand<Install>(Install.Definition, c => ((Install)c).Run);
RegisterCommand<InstallCompileInstallVerify>(InstallCompileInstallVerify.Definition, c => ((InstallCompileInstallVerify)c).Run);
RegisterCommand<ListCreationClubContent>(ListCreationClubContent.Definition, c => ((ListCreationClubContent)c).Run);
RegisterCommand<ListGames>(ListGames.Definition, c => ((ListGames)c).Run);
RegisterCommand<ListModlists>(ListModlists.Definition, c => ((ListModlists)c).Run);
RegisterCommand<MirrorFile>(MirrorFile.Definition, c => ((MirrorFile)c).Run);
RegisterCommand<ModlistReport>(ModlistReport.Definition, c => ((ModlistReport)c).Run);
RegisterCommand<SteamDownloadFile>(SteamDownloadFile.Definition, c => ((SteamDownloadFile)c).Run);
RegisterCommand<SteamDumpAppInfo>(SteamDumpAppInfo.Definition, c => ((SteamDumpAppInfo)c).Run);
RegisterCommand<SteamLogin>(SteamLogin.Definition, c => ((SteamLogin)c).Run);
RegisterCommand<UploadToNexus>(UploadToNexus.Definition, c => ((UploadToNexus)c).Run);
RegisterCommand<ValidateLists>(ValidateLists.Definition, c => ((ValidateLists)c).Run);
RegisterCommand<VFSIndex>(VFSIndex.Definition, c => ((VFSIndex)c).Run);
public static void AddCLIVerbs(this IServiceCollection services) {
CommandLineBuilder.RegisterCommand<Compile>(Compile.Definition, c => ((Compile)c).Run);
services.AddSingleton<Compile>();
CommandLineBuilder.RegisterCommand<Decrypt>(Decrypt.Definition, c => ((Decrypt)c).Run);
services.AddSingleton<Decrypt>();
CommandLineBuilder.RegisterCommand<DownloadAll>(DownloadAll.Definition, c => ((DownloadAll)c).Run);
services.AddSingleton<DownloadAll>();
CommandLineBuilder.RegisterCommand<DownloadUrl>(DownloadUrl.Definition, c => ((DownloadUrl)c).Run);
services.AddSingleton<DownloadUrl>();
CommandLineBuilder.RegisterCommand<DumpZipInfo>(DumpZipInfo.Definition, c => ((DumpZipInfo)c).Run);
services.AddSingleton<DumpZipInfo>();
CommandLineBuilder.RegisterCommand<Encrypt>(Encrypt.Definition, c => ((Encrypt)c).Run);
services.AddSingleton<Encrypt>();
CommandLineBuilder.RegisterCommand<Extract>(Extract.Definition, c => ((Extract)c).Run);
services.AddSingleton<Extract>();
CommandLineBuilder.RegisterCommand<ForceHeal>(ForceHeal.Definition, c => ((ForceHeal)c).Run);
services.AddSingleton<ForceHeal>();
CommandLineBuilder.RegisterCommand<HashFile>(HashFile.Definition, c => ((HashFile)c).Run);
services.AddSingleton<HashFile>();
CommandLineBuilder.RegisterCommand<HashUrlString>(HashUrlString.Definition, c => ((HashUrlString)c).Run);
services.AddSingleton<HashUrlString>();
CommandLineBuilder.RegisterCommand<Install>(Install.Definition, c => ((Install)c).Run);
services.AddSingleton<Install>();
CommandLineBuilder.RegisterCommand<InstallCompileInstallVerify>(InstallCompileInstallVerify.Definition, c => ((InstallCompileInstallVerify)c).Run);
services.AddSingleton<InstallCompileInstallVerify>();
CommandLineBuilder.RegisterCommand<ListCreationClubContent>(ListCreationClubContent.Definition, c => ((ListCreationClubContent)c).Run);
services.AddSingleton<ListCreationClubContent>();
CommandLineBuilder.RegisterCommand<ListGames>(ListGames.Definition, c => ((ListGames)c).Run);
services.AddSingleton<ListGames>();
CommandLineBuilder.RegisterCommand<ListModlists>(ListModlists.Definition, c => ((ListModlists)c).Run);
services.AddSingleton<ListModlists>();
CommandLineBuilder.RegisterCommand<MirrorFile>(MirrorFile.Definition, c => ((MirrorFile)c).Run);
services.AddSingleton<MirrorFile>();
CommandLineBuilder.RegisterCommand<ModlistReport>(ModlistReport.Definition, c => ((ModlistReport)c).Run);
services.AddSingleton<ModlistReport>();
CommandLineBuilder.RegisterCommand<SteamDownloadFile>(SteamDownloadFile.Definition, c => ((SteamDownloadFile)c).Run);
services.AddSingleton<SteamDownloadFile>();
CommandLineBuilder.RegisterCommand<SteamDumpAppInfo>(SteamDumpAppInfo.Definition, c => ((SteamDumpAppInfo)c).Run);
services.AddSingleton<SteamDumpAppInfo>();
CommandLineBuilder.RegisterCommand<SteamLogin>(SteamLogin.Definition, c => ((SteamLogin)c).Run);
services.AddSingleton<SteamLogin>();
CommandLineBuilder.RegisterCommand<UploadToNexus>(UploadToNexus.Definition, c => ((UploadToNexus)c).Run);
services.AddSingleton<UploadToNexus>();
CommandLineBuilder.RegisterCommand<ValidateLists>(ValidateLists.Definition, c => ((ValidateLists)c).Run);
services.AddSingleton<ValidateLists>();
CommandLineBuilder.RegisterCommand<VFSIndex>(VFSIndex.Definition, c => ((VFSIndex)c).Run);
services.AddSingleton<VFSIndex>();
}
}

View File

@ -5,19 +5,22 @@
<#@ import namespace="System.IO"#>
<#@ import namespace="System.Collections.Generic" #>
using Microsoft.Extensions.DependencyInjection;
namespace Wabbajack.CLI;
using Wabbajack.CLI.Verbs;
using Wabbajack.CLI.Builder;
public partial class CommandLineBuilder {
public static class CommandLineBuilderExtensions{
private static void RegisterAll() {
public static void AddCLIVerbs(this IServiceCollection services) {
<#
foreach (var verb in Directory.EnumerateFiles("Verbs"))
{
var klass = verb.Split('\\').Last().Split('.').First();
if (klass == "IVerb") continue;
#>
RegisterCommand<<#=klass#>>(<#=klass#>.Definition, c => ((<#=klass#>)c).Run);
CommandLineBuilder.RegisterCommand<<#=klass#>>(<#=klass#>.Definition, c => ((<#=klass#>)c).Run);
services.AddSingleton<<#=klass#>>();
<#
}

View File

@ -4,6 +4,7 @@ using System.CommandLine.NamingConventionBinder;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.Extensions.Logging;
using Wabbajack.CLI.Builder;
using Wabbajack.Compiler;
using Wabbajack.Downloaders;
using Wabbajack.Downloaders.GameFile;
@ -14,7 +15,7 @@ using Wabbajack.VFS;
namespace Wabbajack.CLI.Verbs;
public class Compile : IVerb
public class Compile
{
private readonly ILogger<Compile> _logger;
private readonly Client _wjClient;

View File

@ -4,13 +4,14 @@ using System.CommandLine.Invocation;
using System.CommandLine.NamingConventionBinder;
using System.Threading.Tasks;
using Microsoft.Extensions.Logging;
using Wabbajack.CLI.Builder;
using Wabbajack.Paths;
using Wabbajack.Paths.IO;
using Wabbajack.Services.OSIntegrated;
namespace Wabbajack.CLI.Verbs;
public class Decrypt : IVerb
public class Decrypt
{
private readonly ILogger<Decrypt> _logger;

View File

@ -6,6 +6,7 @@ using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.Extensions.Logging;
using Wabbajack.CLI.Builder;
using Wabbajack.Common;
using Wabbajack.Downloaders;
using Wabbajack.DTOs;
@ -20,7 +21,7 @@ using Wabbajack.VFS;
namespace Wabbajack.CLI.Verbs;
public class DownloadAll : IVerb
public class DownloadAll
{
private readonly DownloadDispatcher _dispatcher;
private readonly ILogger<DownloadAll> _logger;

View File

@ -5,6 +5,7 @@ using System.CommandLine.NamingConventionBinder;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.Extensions.Logging;
using Wabbajack.CLI.Builder;
using Wabbajack.Common;
using Wabbajack.Downloaders;
using Wabbajack.DTOs;
@ -13,7 +14,7 @@ using Wabbajack.Paths.IO;
namespace Wabbajack.CLI.Verbs;
public class DownloadUrl : IVerb
public class DownloadUrl
{
private readonly DownloadDispatcher _dispatcher;
private readonly ILogger<DownloadUrl> _logger;

View File

@ -7,6 +7,7 @@ using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.Extensions.Logging;
using Wabbajack.CLI.Builder;
using Wabbajack.Common;
using Wabbajack.Compression.Zip;
using Wabbajack.Downloaders;
@ -16,7 +17,7 @@ using Wabbajack.Paths.IO;
namespace Wabbajack.CLI.Verbs;
public class DumpZipInfo : IVerb
public class DumpZipInfo
{
private readonly ILogger<DumpZipInfo> _logger;

View File

@ -3,13 +3,14 @@ using System.CommandLine.Invocation;
using System.CommandLine.NamingConventionBinder;
using System.Threading.Tasks;
using Microsoft.Extensions.Logging;
using Wabbajack.CLI.Builder;
using Wabbajack.Paths;
using Wabbajack.Paths.IO;
using Wabbajack.Services.OSIntegrated;
namespace Wabbajack.CLI.Verbs;
public class Encrypt : IVerb
public class Encrypt
{
private readonly ILogger<Encrypt> _logger;

View File

@ -5,6 +5,7 @@ using System.CommandLine.NamingConventionBinder;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.Extensions.Logging;
using Wabbajack.CLI.Builder;
using Wabbajack.Common;
using Wabbajack.Downloaders;
using Wabbajack.DTOs;
@ -13,7 +14,7 @@ using Wabbajack.Paths.IO;
namespace Wabbajack.CLI.Verbs;
public class Extract : IVerb
public class Extract
{
private readonly ILogger<DownloadUrl> _logger;

View File

@ -9,6 +9,7 @@ using System.Threading;
using System.Threading.Tasks;
using FluentFTP.Helpers;
using Microsoft.Extensions.Logging;
using Wabbajack.CLI.Builder;
using Wabbajack.Common;
using Wabbajack.Compiler.PatchCache;
using Wabbajack.Downloaders;
@ -25,7 +26,7 @@ using Wabbajack.VFS;
namespace Wabbajack.CLI.Verbs;
public class ForceHeal : IVerb
public class ForceHeal
{
private readonly ILogger<ForceHeal> _logger;
private readonly Client _client;

View File

@ -5,13 +5,14 @@ using System.IO;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.Extensions.Logging;
using Wabbajack.CLI.Builder;
using Wabbajack.Hashing.xxHash64;
using Wabbajack.Paths;
using Wabbajack.Paths.IO;
namespace Wabbajack.CLI.Verbs;
public class HashFile : IVerb
public class HashFile
{
private readonly ILogger<HashFile> _logger;

View File

@ -3,12 +3,13 @@ using System.CommandLine.Invocation;
using System.CommandLine.NamingConventionBinder;
using System.Threading.Tasks;
using Microsoft.Extensions.Logging;
using Wabbajack.CLI.Builder;
using Wabbajack.Hashing.xxHash64;
using Wabbajack.Paths;
namespace Wabbajack.CLI.Verbs;
public class HashUrlString : IVerb
public class HashUrlString
{
private readonly ILogger<HashUrlString> _logger;

View File

@ -1,7 +0,0 @@
using System.CommandLine;
namespace Wabbajack.CLI.Verbs;
public interface IVerb
{
}

View File

@ -6,6 +6,7 @@ using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.Extensions.Logging;
using Wabbajack.CLI.Builder;
using Wabbajack.Downloaders;
using Wabbajack.Downloaders.GameFile;
using Wabbajack.DTOs;
@ -18,7 +19,7 @@ using Wabbajack.VFS;
namespace Wabbajack.CLI.Verbs;
public class Install : IVerb
public class Install
{
private readonly ILogger<Install> _logger;
private readonly Client _wjClient;

View File

@ -8,6 +8,7 @@ using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.Extensions.Logging;
using Wabbajack.CLI.Builder;
using Wabbajack.Common;
using Wabbajack.Compiler;
using Wabbajack.Downloaders;
@ -22,7 +23,7 @@ using Wabbajack.VFS;
namespace Wabbajack.CLI.Verbs;
public class InstallCompileInstallVerify : IVerb
public class InstallCompileInstallVerify
{
private readonly ILogger<InstallCompileInstallVerify> _logger;
private readonly Client _wjClient;
@ -47,7 +48,7 @@ public class InstallCompileInstallVerify : IVerb
_inferencer = inferencer;
}
public static VerbDefinition Definition = new VerbDefinition("install-compile-install-verify",
public static VerbDefinition Definition = new("install-compile-install-verify",
"Installs a modlist, compiles it, installs it again, verifies it", new[]
{
new OptionDefinition(typeof(AbsolutePath), "m", "machineUrl", "Machine url(s) to download"),

View File

@ -7,6 +7,7 @@ using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.Extensions.Logging;
using Wabbajack.CLI.Builder;
using Wabbajack.Common;
using Wabbajack.Downloaders.Bethesda;
using Wabbajack.DTOs;
@ -17,7 +18,7 @@ using Wabbajack.Paths;
namespace Wabbajack.CLI.Verbs;
public class ListCreationClubContent : IVerb
public class ListCreationClubContent
{
private readonly ILogger<ListCreationClubContent> _logger;
private readonly Client _client;

View File

@ -7,13 +7,14 @@ using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.Extensions.Logging;
using Wabbajack.CLI.Builder;
using Wabbajack.Downloaders.GameFile;
using Wabbajack.DTOs;
using Wabbajack.Paths.IO;
namespace Wabbajack.CLI.Verbs;
public class ListGames : IVerb
public class ListGames
{
private readonly ILogger<ListGames> _logger;
private readonly GameLocator _locator;
@ -24,7 +25,7 @@ public class ListGames : IVerb
_locator = locator;
}
public static VerbDefinition Definition = new VerbDefinition("list-games",
public static VerbDefinition Definition = new("list-games",
"Lists all games Wabbajack recognizes, and their installed versions/locations (if any)", Array.Empty<OptionDefinition>());
internal Task<int> Run(CancellationToken token)

View File

@ -7,12 +7,13 @@ using System.Threading;
using System.Threading.Tasks;
using FluentFTP.Helpers;
using Microsoft.Extensions.Logging;
using Wabbajack.CLI.Builder;
using Wabbajack.DTOs;
using Wabbajack.Networking.WabbajackClientApi;
namespace Wabbajack.CLI.Verbs;
public class ListModlists : IVerb
public class ListModlists
{
private readonly ILogger<ListCreationClubContent> _logger;
private readonly Client _client;

View File

@ -3,12 +3,13 @@ using System.CommandLine.Invocation;
using System.CommandLine.NamingConventionBinder;
using System.Threading.Tasks;
using Microsoft.Extensions.Logging;
using Wabbajack.CLI.Builder;
using Wabbajack.Networking.WabbajackClientApi;
using Wabbajack.Paths;
namespace Wabbajack.CLI.Verbs;
public class MirrorFile : IVerb
public class MirrorFile
{
private readonly ILogger<MirrorFile> _logger;
private readonly Client _client;

View File

@ -10,6 +10,7 @@ using System.Text;
using System.Threading.Tasks;
using Microsoft.Extensions.Logging;
using Nettle;
using Wabbajack.CLI.Builder;
using Wabbajack.Common;
using Wabbajack.DTOs.Directives;
using Wabbajack.DTOs.JsonConverters;
@ -19,7 +20,7 @@ using Wabbajack.Paths.IO;
namespace Wabbajack.CLI.Verbs;
public class ModlistReport : IVerb
public class ModlistReport
{
private readonly ILogger<ModlistReport> _logger;
private readonly DTOSerializer _dtos;

View File

@ -7,6 +7,7 @@ using System.Threading.Tasks;
using FluentFTP.Helpers;
using Microsoft.Extensions.Logging;
using SteamKit2;
using Wabbajack.CLI.Builder;
using Wabbajack.DTOs;
using Wabbajack.DTOs.JsonConverters;
using Wabbajack.Networking.Http.Interfaces;
@ -15,7 +16,7 @@ using Wabbajack.Paths;
namespace Wabbajack.CLI.Verbs;
public class SteamDownloadFile : IVerb
public class SteamDownloadFile
{
private readonly ILogger<SteamDownloadFile> _logger;
private readonly Client _client;
@ -35,7 +36,7 @@ public class SteamDownloadFile : IVerb
_wjClient = wjClient;
}
public static VerbDefinition Definition = new VerbDefinition("steam-download-file",
public static VerbDefinition Definition = new("steam-download-file",
"Dumps information to the console about the given app",
new[]
{

View File

@ -7,6 +7,7 @@ using System.Threading.Tasks;
using Microsoft.Extensions.Logging;
using Newtonsoft.Json;
using SteamKit2;
using Wabbajack.CLI.Builder;
using Wabbajack.DTOs;
using Wabbajack.DTOs.JsonConverters;
using Wabbajack.Networking.Http.Interfaces;
@ -15,7 +16,7 @@ using JsonSerializer = System.Text.Json.JsonSerializer;
namespace Wabbajack.CLI.Verbs;
public class SteamDumpAppInfo : IVerb
public class SteamDumpAppInfo
{
private readonly ILogger<SteamDumpAppInfo> _logger;
private readonly Client _client;
@ -33,7 +34,7 @@ public class SteamDumpAppInfo : IVerb
_dtos = dtos;
}
public static VerbDefinition Definition = new VerbDefinition("steam-app-dump-info",
public static VerbDefinition Definition = new("steam-app-dump-info",
"Dumps information to the console about the given app", new[]
{
new OptionDefinition(typeof(string), "g", "game", "Wabbajack game name")

View File

@ -4,13 +4,14 @@ using System.CommandLine.Invocation;
using System.CommandLine.NamingConventionBinder;
using System.Threading.Tasks;
using Microsoft.Extensions.Logging;
using Wabbajack.CLI.Builder;
using Wabbajack.Networking.Http.Interfaces;
using Wabbajack.Networking.Steam;
using Wabbajack.Paths;
namespace Wabbajack.CLI.Verbs;
public class SteamLogin : IVerb
public class SteamLogin
{
private readonly ILogger<SteamLogin> _logger;
private readonly Client _client;

View File

@ -1,20 +1,16 @@
using System.CommandLine;
using System.CommandLine.Invocation;
using System.CommandLine.NamingConventionBinder;
using System.Text.Json;
using System.Threading.Tasks;
using Microsoft.Extensions.Logging;
using Wabbajack.CLI.Builder;
using Wabbajack.Common;
using Wabbajack.DTOs.JsonConverters;
using Wabbajack.Networking.NexusApi;
using Wabbajack.Networking.NexusApi.DTOs;
using Wabbajack.Paths;
using Wabbajack.Paths.IO;
namespace Wabbajack.CLI.Verbs;
public class UploadToNexus : IVerb
public class UploadToNexus
{
private readonly ILogger<UploadToNexus> _logger;
private readonly NexusApi _client;

View File

@ -3,12 +3,13 @@ using System.CommandLine.Invocation;
using System.CommandLine.NamingConventionBinder;
using System.Threading;
using System.Threading.Tasks;
using Wabbajack.CLI.Builder;
using Wabbajack.Paths;
using Wabbajack.VFS;
namespace Wabbajack.CLI.Verbs;
public class VFSIndex : IVerb
public class VFSIndex
{
private readonly Context _context;
@ -17,7 +18,7 @@ public class VFSIndex : IVerb
_context = context;
}
public static VerbDefinition Definition = new VerbDefinition("vfs-index",
public static VerbDefinition Definition = new("vfs-index",
"Index and cache the contents of a folder", new[]
{
new OptionDefinition(typeof(AbsolutePath), "f", "folder", "Folder to index")

View File

@ -12,6 +12,7 @@ using Microsoft.Extensions.Logging;
using SixLabors.ImageSharp;
using SixLabors.ImageSharp.Formats.Webp;
using SixLabors.ImageSharp.Processing;
using Wabbajack.CLI.Builder;
using Wabbajack.CLI.Services;
using Wabbajack.Common;
using Wabbajack.Compression.Zip;
@ -35,7 +36,7 @@ using Wabbajack.Server.Lib.TokenProviders;
namespace Wabbajack.CLI.Verbs;
public class ValidateLists : IVerb
public class ValidateLists
{
private static readonly Uri MirrorPrefix = new("https://mirror.wabbajack.org");
private readonly WriteOnlyClient _discord;
@ -74,7 +75,7 @@ public class ValidateLists : IVerb
_httpLimiter = httpLimiter;
}
public static VerbDefinition Definition = new VerbDefinition("validate-lists",
public static VerbDefinition Definition = new("validate-lists",
"Gets a list of modlists, validates them and exports a result list", new[]
{
new OptionDefinition(typeof(AbsolutePath), "r", "reports", "Location to store validation report outputs")

View File

@ -29,6 +29,7 @@
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Wabbajack.CLI.Builder\Wabbajack.CLI.Builder.csproj" />
<ProjectReference Include="..\Wabbajack.Downloaders.Bethesda\Wabbajack.Downloaders.Bethesda.csproj" />
<ProjectReference Include="..\Wabbajack.Downloaders.Dispatcher\Wabbajack.Downloaders.Dispatcher.csproj" />
<ProjectReference Include="..\Wabbajack.Hashing.xxHash64\Wabbajack.Hashing.xxHash64.csproj" />

View File

@ -141,6 +141,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Wabbajack.App.Wpf", "Wabbaj
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Wabbajack.VFS.Interfaces", "Wabbajack.VFS.Interfaces\Wabbajack.VFS.Interfaces.csproj", "{E4BDB22D-11A4-452F-8D10-D9CA9777EA22}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Wabbajack.CLI.Builder", "Wabbajack.CLI.Builder\Wabbajack.CLI.Builder.csproj", "{99CD51A1-38C9-420E-9497-2C9AEAF0053C}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@ -387,6 +389,10 @@ Global
{E4BDB22D-11A4-452F-8D10-D9CA9777EA22}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E4BDB22D-11A4-452F-8D10-D9CA9777EA22}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E4BDB22D-11A4-452F-8D10-D9CA9777EA22}.Release|Any CPU.Build.0 = Release|Any CPU
{99CD51A1-38C9-420E-9497-2C9AEAF0053C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{99CD51A1-38C9-420E-9497-2C9AEAF0053C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{99CD51A1-38C9-420E-9497-2C9AEAF0053C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{99CD51A1-38C9-420E-9497-2C9AEAF0053C}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE