Add colors

This commit is contained in:
rainyuu 2021-01-30 21:14:03 +01:00
parent 3933f84535
commit d6e0e19121

View File

@ -10,13 +10,14 @@ import (
// InstallMod is a CLI frontend for tools.DownloadMod. // InstallMod is a CLI frontend for tools.DownloadMod.
func InstallMod(pkg string) { func InstallMod(pkg string) {
buffer := fmt.Sprint(" > ", tools.ExposeModString(pkg), "... ")
stat, ov := tools.DownloadMod(tools.ExposeModString(pkg))
green := color.New(color.FgGreen).SprintFunc() green := color.New(color.FgGreen).SprintFunc()
magenta := color.New(color.FgMagenta).SprintFunc() magenta := color.New(color.FgMagenta).SprintFunc()
red := color.New(color.FgRed).SprintFunc() red := color.New(color.FgRed).SprintFunc()
blue := color.New(color.FgBlue).SprintFunc() blue := color.New(color.FgBlue).SprintFunc()
cyan := color.New(color.FgCyan).SprintFunc()
buffer := cyan(fmt.Sprint(" > ", tools.ExposeModString(pkg), "... "))
stat, ov := tools.DownloadMod(tools.ExposeModString(pkg))
if stat == 1 { if stat == 1 {
buffer += green("up to date!") buffer += green("up to date!")
@ -46,8 +47,9 @@ func InstallMod(pkg string) {
func RemoveMod(pkg string) { func RemoveMod(pkg string) {
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()
buffer := fmt.Sprint(" > ", tools.ExposeModString(pkg), "... ") buffer := cyan(fmt.Sprint(" > ", tools.ExposeModString(pkg), "... "))
if tools.RemoveMod(tools.ExposeModString(pkg)) == 1 { if tools.RemoveMod(tools.ExposeModString(pkg)) == 1 {
buffer += red("not installed") buffer += red("not installed")