diff --git a/cli/cli.go b/cli/cli.go index 3ec378d..ed2ba37 100644 --- a/cli/cli.go +++ b/cli/cli.go @@ -2,7 +2,6 @@ package cli import ( "fmt" - "r2go/api" "r2go/tools" "github.com/fatih/color" @@ -15,10 +14,10 @@ func InstallMod(pkg string) []string { red := color.New(color.FgRed).SprintFunc() blue := color.New(color.FgBlue).SprintFunc() cyan := color.New(color.FgCyan).SprintFunc() - deps := []string{} + // deps := []string{} buffer := cyan(fmt.Sprint(" > ", tools.ExposeModString(pkg), "... ")) - stat, ov := tools.DownloadMod(tools.ExposeModString(pkg)) + stat, ov, deps := tools.DownloadMod(tools.ExposeModString(pkg)) if stat == 1 { buffer += green("up to date!") @@ -30,15 +29,15 @@ func InstallMod(pkg string) []string { buffer += blue("downloaded") } - if stat != 3 { - _, mod := api.GetModData(tools.ExposeModString(pkg)) - for _, dep := range mod.Versions[0].Dependencies { - depString := tools.ExposeModString(dep) - if depString != "tristanmcpherson-R2API" && depString != "bbepis-BepInExPack" { - deps = append(deps, depString) - } - } - } + // if stat != 3 { + // _, mod := api.GetModData(tools.ExposeModString(pkg)) + // for _, dep := range mod.Versions[0].Dependencies { + // depString := tools.ExposeModString(dep) + // if depString != "tristanmcpherson-R2API" && depString != "bbepis-BepInExPack" { + // deps = append(deps, depString) + // } + // } + // } fmt.Println(buffer) return deps diff --git a/tools/tools.go b/tools/tools.go index 53f6345..1bda9b0 100644 --- a/tools/tools.go +++ b/tools/tools.go @@ -21,9 +21,10 @@ func ExposeModString(input string) string { // DownloadMod gets the download URL and installs the mod in the correct folder // DownloadMod returns 0 if the download is sucessful, and 1 if it is already installed // DownlaodMod returns 2 if the mod updated, and 3 if the mod could not be found. -func DownloadMod(depString string) (int, string) { +func DownloadMod(depString string) (int, string, []string) { var status int var modver string + var deps []string if depString == "R2API" { depString = "tristanmcpherson-R2API" @@ -32,7 +33,7 @@ func DownloadMod(depString string) (int, string) { sysinfo := utils.GetSysInfo() status, mod := api.GetModData(depString) if status != 0 { - return 3, "not_found" + return 3, "not_found", deps } downloadURL := mod.Versions[0].DownloadURL @@ -43,7 +44,7 @@ func DownloadMod(depString string) (int, string) { if utils.PathExists(modFolder) { - return 1, modver + return 1, modver, deps } status, mod = api.GetModData(depString) @@ -67,13 +68,17 @@ func DownloadMod(depString string) (int, string) { log.Println(unzip) utils.CheckErr(err) + for _, dep := range mod.Versions[0].Dependencies { + deps = append(deps, dep) + } + // TODO: Dependencies! // fmt.Println("pog") // for _, dep := range mod.Versions[0].Dependencies { // DownloadMod(dep) // } - return status, modver + return status, modver, deps } // RemoveMod uninstalls a mod