Add debug info to attempt to resolve removing mods not working for some reason?

This commit is contained in:
rainyuu 2021-01-31 12:56:52 +01:00
parent 49cb2ed889
commit ff60e415b6
3 changed files with 12 additions and 1 deletions

View File

@ -2,6 +2,7 @@ package api
import ( import (
"encoding/json" "encoding/json"
"fmt"
"io/ioutil" "io/ioutil"
"os" "os"
"r2go/utils" "r2go/utils"
@ -114,15 +115,20 @@ func SearchMods(inp string) fuzzy.Ranks {
// GetModData gets object of mod by depString // GetModData gets object of mod by depString
func GetModData(depString string) (int, Mod) { func GetModData(depString string) (int, Mod) {
// ThinkInvis-Yeet
fmt.Printf("Getting data for: %s\n", depString)
fmt.Println([]byte(depString))
if depString == "R2API" { if depString == "R2API" {
depString = "tristanmcpherson-R2API" depString = "tristanmcpherson-R2API"
} }
for i := 0; i < len(PkgList); i++ { for i := 0; i < len(PkgList); i++ {
if PkgList[i].FullName == depString { if PkgList[i].FullName == depString {
fmt.Println("Got mod data!")
return 0, PkgList[i] return 0, PkgList[i]
} }
} }
fmt.Println("Couldn't get mod data :(")
return 1, Mod{} return 1, Mod{}
} }

View File

@ -45,6 +45,8 @@ func InstallMod(pkg string) []string {
// RemoveMod is a CLI frontend for tools.RemoveMod // RemoveMod is a CLI frontend for tools.RemoveMod
func RemoveMod(pkg string) { func RemoveMod(pkg string) {
// ThinkInvis-Yeet
// fmt.Println(pkg)
blue := color.New(color.FgBlue).SprintFunc() blue := color.New(color.FgBlue).SprintFunc()
red := color.New(color.FgRed).SprintFunc() red := color.New(color.FgRed).SprintFunc()
cyan := color.New(color.FgCyan).SprintFunc() cyan := color.New(color.FgCyan).SprintFunc()

View File

@ -1,6 +1,7 @@
package tools package tools
import ( import (
"fmt"
"io/ioutil" "io/ioutil"
"log" "log"
"os" "os"
@ -83,9 +84,11 @@ func DownloadMod(depString string) (int, string, []string) {
// RemoveMod uninstalls a mod // RemoveMod uninstalls a mod
// RemoveMod returns 2 if the mod string was not found, 1 if the mod isn't installed and 0 on success // RemoveMod returns 2 if the mod string was not found, 1 if the mod isn't installed and 0 on success
func RemoveMod(depString string) int { func RemoveMod(depString string) int {
// ThinkInvis-Yeet
// fmt.Println(depString) // fmt.Println(depString)
status, mod := api.GetModData(depString) status, mod := api.GetModData(depString)
// fmt.Println(mod) fmt.Println(status)
fmt.Println(mod)
if status != 0 { if status != 0 {
return 2 return 2
} }