mirror of
https://github.com/packwiz/packwiz.git
synced 2025-04-19 13:06:30 +02:00
Allow mc-version-prefixed Forge version in init command
This commit is contained in:
parent
539be71d11
commit
bfe570a6a2
14
cmd/init.go
14
cmd/init.go
@ -9,6 +9,7 @@ import (
|
|||||||
"github.com/packwiz/packwiz/core"
|
"github.com/packwiz/packwiz/core"
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
"github.com/spf13/viper"
|
"github.com/spf13/viper"
|
||||||
|
"golang.org/x/exp/slices"
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"strings"
|
"strings"
|
||||||
@ -100,18 +101,15 @@ var initCmd = &cobra.Command{
|
|||||||
componentVersion = initReadValue(loader.FriendlyName+" version ["+latestVersion+"]: ", latestVersion)
|
componentVersion = initReadValue(loader.FriendlyName+" version ["+latestVersion+"]: ", latestVersion)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
found := false
|
v := componentVersion
|
||||||
for _, v := range versions {
|
if loader.Name == "forge" {
|
||||||
if componentVersion == v {
|
v = cmdshared.GetRawForgeVersion(componentVersion)
|
||||||
found = true
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if !found {
|
if !slices.Contains(versions, v) {
|
||||||
fmt.Println("Given " + loader.FriendlyName + " version cannot be found!")
|
fmt.Println("Given " + loader.FriendlyName + " version cannot be found!")
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
modLoaderVersions[loader.Name] = componentVersion
|
modLoaderVersions[loader.Name] = v
|
||||||
} else {
|
} else {
|
||||||
fmt.Println("Given mod loader is not supported! Use \"none\" to specify no modloader, or to configure one manually.")
|
fmt.Println("Given mod loader is not supported! Use \"none\" to specify no modloader, or to configure one manually.")
|
||||||
fmt.Print("The following mod loaders are supported: ")
|
fmt.Print("The following mod loaders are supported: ")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user