GetUpdateableMods made and public for testing

This commit is contained in:
Canon
2026-03-12 06:54:31 +08:00
parent 08f467aaee
commit 0bd4151271
4 changed files with 8 additions and 8 deletions
+4 -3
View File
@@ -11,6 +11,9 @@ namespace FCPModUpdater.Commands;
[UsedImplicitly]
public class UpdateCommand : AsyncCommand<ModPathSettings>
{
public static IReadOnlyList<InstalledMod> GetUpdateableMods(IReadOnlyList<InstalledMod> mods)
=> mods.Where(m => m.Source == ModSource.Git && m.Status == ModStatus.Behind).ToList();
public override async Task<int> ExecuteAsync(CommandContext context, ModPathSettings settings,
CancellationToken cancellationToken)
{
@@ -41,9 +44,7 @@ public class UpdateCommand : AsyncCommand<ModPathSettings>
async () => await modDiscoveryService.DiscoverModsAsync(modsDirectory, ct: cancellationToken));
// Find updateable mods
var updateableMods = mods
.Where(m => m.Source == ModSource.Git && m.Status == ModStatus.Behind)
.ToList();
var updateableMods = GetUpdateableMods(mods);
if (updateableMods.Count == 0)
{
+1 -1
View File
@@ -244,7 +244,7 @@ public partial class GitService : IGitService
}
}
private static IReadOnlyList<GitCommitInfo> ParseCommitLog(string output)
internal static IReadOnlyList<GitCommitInfo> ParseCommitLog(string output)
{
var commits = new List<GitCommitInfo>();
var entries = output.Split("---", StringSplitOptions.RemoveEmptyEntries);
+2 -2
View File
@@ -171,7 +171,7 @@ public class ModDiscoveryService : IModDiscoveryService
/// <summary>
/// Tries to match a folder name to an org repo, accounting for GitHub ZIP download suffixes like -main, -master.
/// </summary>
private static string? MatchRepoName(string folderName, HashSet<string> orgRepoNames)
internal static string? MatchRepoName(string folderName, HashSet<string> orgRepoNames)
{
// Direct match
if (orgRepoNames.Contains(folderName))
@@ -191,7 +191,7 @@ public class ModDiscoveryService : IModDiscoveryService
return null;
}
private static ModStatus DetermineStatus(int behind, int ahead, bool hasLocalChanges, string? branch)
internal static ModStatus DetermineStatus(int behind, int ahead, bool hasLocalChanges, string? branch)
{
if (branch == null)
{
+1 -2
View File
@@ -29,7 +29,6 @@
"Spectre.Console": "0.53.1"
}
}
},
"net10.0/linux-x64": {}
}
}
}