diff --git a/CHANGELOG.md b/CHANGELOG.md index 7ffcccb9..c60ab52c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,9 @@ ### Changelog #### Version - 3.6.1.0 - TBD +* Added `set-nexus-api-key` CLI command * Added Starfield meta data +* Added Fallout New Vegas Epic Games meta data #### Version - 3.6.0.0 - 5/25/2024 * Wabbajack now uses OAuth2 for Nexus Mods logins diff --git a/Wabbajack.CLI/Properties/PublishProfiles/FolderProfile.pubxml b/Wabbajack.CLI/Properties/PublishProfiles/FolderProfile.pubxml new file mode 100644 index 00000000..8345a901 --- /dev/null +++ b/Wabbajack.CLI/Properties/PublishProfiles/FolderProfile.pubxml @@ -0,0 +1,19 @@ + + + + + Release + Any CPU + bin\Release\net8.0\publish\win-x64\ + FileSystem + <_TargetId>Folder + net8.0 + win-x64 + true + false + false + false + + \ No newline at end of file diff --git a/Wabbajack.CLI/VerbRegistration.cs b/Wabbajack.CLI/VerbRegistration.cs index 3854dce4..373b4b43 100644 --- a/Wabbajack.CLI/VerbRegistration.cs +++ b/Wabbajack.CLI/VerbRegistration.cs @@ -43,6 +43,8 @@ CommandLineBuilder.RegisterCommand(MirrorFile.Definition, c => ((Mir services.AddSingleton(); CommandLineBuilder.RegisterCommand(ModlistReport.Definition, c => ((ModlistReport)c).Run); services.AddSingleton(); +CommandLineBuilder.RegisterCommand(SetNexusApiKey.Definition, c => ((SetNexusApiKey)c).Run); +services.AddSingleton(); CommandLineBuilder.RegisterCommand(SteamDownloadFile.Definition, c => ((SteamDownloadFile)c).Run); services.AddSingleton(); CommandLineBuilder.RegisterCommand(SteamDumpAppInfo.Definition, c => ((SteamDumpAppInfo)c).Run); diff --git a/Wabbajack.CLI/Verbs/SetNexusApiKey.cs b/Wabbajack.CLI/Verbs/SetNexusApiKey.cs new file mode 100644 index 00000000..95775d7f --- /dev/null +++ b/Wabbajack.CLI/Verbs/SetNexusApiKey.cs @@ -0,0 +1,46 @@ + +using System.CommandLine; +using System.CommandLine.Invocation; +using System.CommandLine.NamingConventionBinder; +using System.Threading.Tasks; +using Microsoft.Extensions.Logging; +using Wabbajack.CLI.Builder; +using Wabbajack.DTOs.Logins; +using Wabbajack.Paths; +using Wabbajack.Paths.IO; +using Wabbajack.Services.OSIntegrated; + +namespace Wabbajack.CLI.Verbs; + +public class SetNexusApiKey +{ + private readonly EncryptedJsonTokenProvider _tokenProvider; + private readonly ILogger _logger; + + public SetNexusApiKey(EncryptedJsonTokenProvider tokenProvider, ILogger logger) + { + _tokenProvider = tokenProvider; + _logger = logger; + } + + public static VerbDefinition Definition = new VerbDefinition("set-nexus-api-key", + "Sets the Nexus API key to the specified value", + [ + new OptionDefinition(typeof(string), "k", "key", "The Nexus API key") + ]); + + public async Task Run(string key) + { + if (string.IsNullOrEmpty(key)) + { + _logger.LogInformation("Not setting Nexus API key, that looks like an empty string to me."); + return -1; + } + else + { + await _tokenProvider.SetToken(new NexusApiState { ApiKey = key }); + _logger.LogInformation("Set Nexus API Key to {key}", key); + return 0; + } + } +} \ No newline at end of file diff --git a/Wabbajack.CLI/Wabbajack.CLI.csproj b/Wabbajack.CLI/Wabbajack.CLI.csproj index 7fc4af60..f3af5d29 100644 --- a/Wabbajack.CLI/Wabbajack.CLI.csproj +++ b/Wabbajack.CLI/Wabbajack.CLI.csproj @@ -8,12 +8,13 @@ GPL-3.0-or-later $(VERSION) wabbajack-cli - true + false linked CS8600 CS8601 CS8618 true + net8.0