diff --git a/EftPatchHelper/EftPatchHelper/EftPatchHelper.csproj b/EftPatchHelper/EftPatchHelper/EftPatchHelper.csproj
index 5f81d29..3f8f0d0 100644
--- a/EftPatchHelper/EftPatchHelper/EftPatchHelper.csproj
+++ b/EftPatchHelper/EftPatchHelper/EftPatchHelper.csproj
@@ -5,8 +5,8 @@
net6.0
enable
enable
- 1.3.8
- 1.3.8
+ 1.3.9
+ 1.3.9
diff --git a/EftPatchHelper/EftPatchHelper/Helpers/EftClientSelector.cs b/EftPatchHelper/EftPatchHelper/Helpers/EftClientSelector.cs
index c71bcf7..3bc5e8a 100644
--- a/EftPatchHelper/EftPatchHelper/Helpers/EftClientSelector.cs
+++ b/EftPatchHelper/EftPatchHelper/Helpers/EftClientSelector.cs
@@ -75,14 +75,20 @@ namespace EftPatchHelper.Helpers
}
}
- public EftClient GetClientSelection(string Prompt)
+ public EftClient GetClientSelection(string Prompt, string currentReleaseVersion = "")
{
SelectionPrompt clientPrompt = new SelectionPrompt()
{
Title = Prompt,
MoreChoicesText = "Move cursor to see more versions",
PageSize = 10,
- Converter = (x) => x.DisplayName
+ Converter = (x) =>
+ {
+ if (!string.IsNullOrWhiteSpace(currentReleaseVersion) && x.Version.EndsWith(currentReleaseVersion))
+ return $"{x.DisplayName} - Latest Release";
+
+ return x.DisplayName;
+ }
};
clientPrompt.AddChoices(_clientList);
diff --git a/EftPatchHelper/EftPatchHelper/Tasks/CleanupTask.cs b/EftPatchHelper/EftPatchHelper/Tasks/CleanupTask.cs
index 45f7f62..84acc4f 100644
--- a/EftPatchHelper/EftPatchHelper/Tasks/CleanupTask.cs
+++ b/EftPatchHelper/EftPatchHelper/Tasks/CleanupTask.cs
@@ -66,8 +66,6 @@ namespace EftPatchHelper.Tasks
ctx.Refresh();
}
});
-
- AnsiConsole.Write(new Rule());
}
public void Run()
diff --git a/EftPatchHelper/EftPatchHelper/Tasks/ClientSelectionTask.cs b/EftPatchHelper/EftPatchHelper/Tasks/ClientSelectionTask.cs
index 9cc7e65..101491c 100644
--- a/EftPatchHelper/EftPatchHelper/Tasks/ClientSelectionTask.cs
+++ b/EftPatchHelper/EftPatchHelper/Tasks/ClientSelectionTask.cs
@@ -2,6 +2,7 @@
using EftPatchHelper.Helpers;
using EftPatchHelper.Interfaces;
using EftPatchHelper.Model;
+using Gitea.Api;
using Spectre.Console;
namespace EftPatchHelper.Tasks
@@ -19,9 +20,9 @@ namespace EftPatchHelper.Tasks
_clientSelector = clientSelector;
}
- private bool ChangeSettingsTargetVersion()
+ private bool ChangeSettingsTargetVersion(string currentReleaseVersion)
{
- _options.TargetClient = _clientSelector.GetClientSelection("Select [yellow]Target[/] Version");
+ _options.TargetClient = _clientSelector.GetClientSelection("Select [yellow]Target[/] Version", currentReleaseVersion);
AnsiConsole.WriteLine();
ConfirmationPrompt changeVersion = new ConfirmationPrompt($"Update settings target version to use [purple]{_options.TargetClient.Version}[/]?");
@@ -36,13 +37,13 @@ namespace EftPatchHelper.Tasks
return true;
}
- private bool ConfirmExistingTargetVersion()
+ private bool ConfirmExistingTargetVersion(string currentReleaseVersion)
{
_clientSelector.LoadClientList();
_options.TargetClient = _clientSelector.GetClient(_settings.TargetEftVersion);
- ConfirmationPrompt confirmTarget = new ConfirmationPrompt($"Use version [purple]{_settings.TargetEftVersion}[/] as target?");
+ ConfirmationPrompt confirmTarget = new ConfirmationPrompt($"Use version [purple]{_settings.TargetEftVersion}[/] {(_options.TargetClient.Version.EndsWith(currentReleaseVersion) ? " ([green]latest release[/])" : "")} as target?");
// If client is null or requested change, return false to ensure change settings target is called.
return _options.TargetClient == null || !confirmTarget.Show(AnsiConsole.Console);
@@ -55,11 +56,33 @@ namespace EftPatchHelper.Tasks
return _options.SourceClient != null;
}
+ private string GetCurrentReleaseVersion()
+ {
+ if (!_settings.UsingGitea())
+ return "";
+
+ return AnsiConsole.Status().Start("Starting...", ctx =>
+ {
+ RepositoryApi repo = new RepositoryApi();
+
+ ctx.Spinner = Spinner.Known.Dots8;
+ ctx.Status = "Getting latest release ...";
+
+ var releases = repo.RepoListReleases("SPT-AKI", "Stable-releases");
+
+ var release = releases.First(x => !x.Prerelease).Name.Split('(')[1];
+
+ return release.Remove(release.Length - 1);
+ });
+ }
+
public void Run()
{
- if (ConfirmExistingTargetVersion())
+ var currentReleaseVersion = GetCurrentReleaseVersion();
+
+ if (ConfirmExistingTargetVersion(currentReleaseVersion))
{
- ChangeSettingsTargetVersion().ValidateOrExit();
+ ChangeSettingsTargetVersion(currentReleaseVersion).ValidateOrExit();
}
SelectSourceVersion().ValidateOrExit();
diff --git a/EftPatchHelper/EftPatchHelper/Tasks/CreateReleaseTasks.cs b/EftPatchHelper/EftPatchHelper/Tasks/CreateReleaseTasks.cs
index 0355a79..80bcbc0 100644
--- a/EftPatchHelper/EftPatchHelper/Tasks/CreateReleaseTasks.cs
+++ b/EftPatchHelper/EftPatchHelper/Tasks/CreateReleaseTasks.cs
@@ -105,10 +105,6 @@ namespace EftPatchHelper.Tasks
if (!_options.CreateRelease) return;
- Configuration.Default.BasePath = _settings.GiteaApiBasePath;
-
- Configuration.Default.AddApiKey("token", _settings.GiteaApiKey);
-
var repo = new RepositoryApi(Configuration.Default);
var release = MakeRelease(repo).ValidateOrExit();
diff --git a/EftPatchHelper/EftPatchHelper/Tasks/FileProcessingTasks.cs b/EftPatchHelper/EftPatchHelper/Tasks/FileProcessingTasks.cs
index 6fc2039..7a0d5fa 100644
--- a/EftPatchHelper/EftPatchHelper/Tasks/FileProcessingTasks.cs
+++ b/EftPatchHelper/EftPatchHelper/Tasks/FileProcessingTasks.cs
@@ -44,6 +44,8 @@ namespace EftPatchHelper.Tasks
public void Run()
{
+ AnsiConsole.Write(new Rule("Starting Tasks, this will take some time :)"));
+
BackupClients().ValidateOrExit();
CopyData(_options.SourceClient, "[gray]Copying[/] [blue]source[/][gray] to prep area ...[/]").ValidateOrExit();
diff --git a/EftPatchHelper/EftPatchHelper/Tasks/StartupSettingsTask.cs b/EftPatchHelper/EftPatchHelper/Tasks/StartupSettingsTask.cs
index 01a7cbd..ba47508 100644
--- a/EftPatchHelper/EftPatchHelper/Tasks/StartupSettingsTask.cs
+++ b/EftPatchHelper/EftPatchHelper/Tasks/StartupSettingsTask.cs
@@ -1,6 +1,7 @@
using EftPatchHelper.Extensions;
using EftPatchHelper.Interfaces;
using EftPatchHelper.Model;
+using Gitea.Client;
using Spectre.Console;
namespace EftPatchHelper.Tasks
@@ -64,6 +65,9 @@ namespace EftPatchHelper.Tasks
if (_settings.UsingGitea())
{
+ Configuration.Default.BasePath = _settings.GiteaApiBasePath;
+ Configuration.Default.AddApiKey("token", _settings.GiteaApiKey);
+
_options.CreateRelease = new ConfirmationPrompt("Create a release on gitea?").Show(AnsiConsole.Console);
}