diff options
| author | hachem <im@hachem.wtf> | 2026-08-29 18:24:42 +0200 |
|---|---|---|
| committer | hachem <im@hachem.wtf> | 2026-08-29 18:24:42 +0200 |
| commit | fcbbeccaa80c7e120933682b330272a1490c1cf5 (patch) | |
| tree | 11de4610f01a3861f7bbea94da63dd2d070f420a /internal/cli/check.go | |
| parent | 4806ee7ef95f0f04079856f7753399b7b7aa6330 (diff) | |
refactor: unify mods command with the search
Diffstat (limited to 'internal/cli/check.go')
| -rw-r--r-- | internal/cli/check.go | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/internal/cli/check.go b/internal/cli/check.go index 1df5137..6d3df5f 100644 --- a/internal/cli/check.go +++ b/internal/cli/check.go @@ -33,16 +33,21 @@ func checkReport(cfg *config.Config) string { client := modrinth.NewClient() var res checkResult - for _, slug := range cfg.ModrinthMods { - versions, err := client.GetVersions(slug) + for _, mod := range cfg.ModrinthMods { + versions, err := client.GetVersions(mod.Slug) if err != nil { - res.failed = append(res.failed, slug) + res.failed = append(res.failed, mod.Slug) continue } - match := modrinth.CompatibleVersion(versions, cfg.MinecraftVersion, "fabric") + var match *modrinth.Version + if mod.Pinned() { + match = modrinth.FindVersion(versions, mod.Version) + } else { + match = modrinth.CompatibleVersion(versions, cfg.MinecraftVersion, "fabric") + } if match == nil { - res.incompatible = append(res.incompatible, slug) + res.incompatible = append(res.incompatible, mod.Slug) continue } @@ -50,7 +55,7 @@ func checkReport(cfg *config.Config) string { if len(match.Files) > 0 { filename = match.Files[0].Filename } - res.compatible = append(res.compatible, compatMod{slug: slug, filename: filename}) + res.compatible = append(res.compatible, compatMod{slug: mod.Slug, filename: filename}) } return renderCheck(cfg, res) |
