From fa4aeeb4069653001edec1bf6606f9f58b97cbca Mon Sep 17 00:00:00 2001 From: rainyuu Date: Sun, 31 Jan 2021 12:26:41 +0100 Subject: [PATCH] Add another return type to tools.RemoveMod --- cli/cli.go | 5 ++++- tools/tools.go | 3 ++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/cli/cli.go b/cli/cli.go index ed2ba37..abf1292 100644 --- a/cli/cli.go +++ b/cli/cli.go @@ -51,7 +51,10 @@ func RemoveMod(pkg string) { buffer := cyan(fmt.Sprint(" > ", tools.ExposeModString(pkg), "... ")) - if tools.RemoveMod(tools.ExposeModString(pkg)) == 1 { + status := tools.RemoveMod(tools.ExposeModString(pkg)) + if status == 2 { + buffer += red("mod not found") + } else if status == 1 { buffer += red("not installed") } else { buffer += blue("uninstalled") diff --git a/tools/tools.go b/tools/tools.go index a0c2f6b..fdf0ac9 100644 --- a/tools/tools.go +++ b/tools/tools.go @@ -81,12 +81,13 @@ func DownloadMod(depString string) (int, string, []string) { } // 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 func RemoveMod(depString string) int { // fmt.Println(depString) status, mod := api.GetModData(depString) // fmt.Println(mod) if status != 0 { - return 1 + return 2 } modFolder := utils.SystemInfo.PluginDir + "/" + depString + "-" + mod.Versions[0].VersionNumber