Prefer game versions according to acceptable versions list (fixes #181)

The acceptable versions list should now be specified in order of preference, where the last version is the most preferable Minecraft version
This commit is contained in:
comp500
2023-02-14 16:10:06 +00:00
parent d667447a88
commit d38d279d98
9 changed files with 123 additions and 145 deletions

View File

@@ -30,11 +30,6 @@ var updateCmd = &cobra.Command{
fmt.Println(err)
os.Exit(1)
}
mcVersion, err := pack.GetMCVersion()
if err != nil {
fmt.Println(err)
os.Exit(1)
}
var singleUpdatedName string
if viper.GetBool("update.all") {
@@ -70,7 +65,7 @@ var updateCmd = &cobra.Command{
updaterPointerMap := make(map[string][]*core.Mod)
updaterCachedStateMap := make(map[string][]interface{})
for k, v := range updaterMap {
checks, err := core.Updaters[k].CheckUpdate(v, mcVersion, pack)
checks, err := core.Updaters[k].CheckUpdate(v, pack)
if err != nil {
// TODO: do we return err code 1?
fmt.Printf("Failed to check updates for %s: %s\n", k, err.Error())
@@ -148,7 +143,7 @@ var updateCmd = &cobra.Command{
}
updaterFound = true
check, err := updater.CheckUpdate([]core.Mod{modData}, mcVersion, pack)
check, err := updater.CheckUpdate([]core.Mod{modData}, pack)
if err != nil {
fmt.Println(err)
os.Exit(1)