Add dependency list builder
This commit is contained in:
		
							parent
							
								
									d6e0e19121
								
							
						
					
					
						commit
						4216fa4256
					
				@ -9,12 +9,13 @@ import (
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
// InstallMod is a CLI frontend for tools.DownloadMod.
 | 
			
		||||
func InstallMod(pkg string) {
 | 
			
		||||
func InstallMod(pkg string) []string {
 | 
			
		||||
	green := color.New(color.FgGreen).SprintFunc()
 | 
			
		||||
	magenta := color.New(color.FgMagenta).SprintFunc()
 | 
			
		||||
	red := color.New(color.FgRed).SprintFunc()
 | 
			
		||||
	blue := color.New(color.FgBlue).SprintFunc()
 | 
			
		||||
	cyan := color.New(color.FgCyan).SprintFunc()
 | 
			
		||||
	deps := []string{}
 | 
			
		||||
 | 
			
		||||
	buffer := cyan(fmt.Sprint(" > ", tools.ExposeModString(pkg), "... "))
 | 
			
		||||
	stat, ov := tools.DownloadMod(tools.ExposeModString(pkg))
 | 
			
		||||
@ -34,13 +35,14 @@ func InstallMod(pkg string) {
 | 
			
		||||
		for _, dep := range mod.Versions[0].Dependencies {
 | 
			
		||||
			depString := tools.ExposeModString(dep)
 | 
			
		||||
			if depString != "tristanmcpherson-R2API" && depString != "bbepis-BepInExPack" {
 | 
			
		||||
				InstallMod(depString)
 | 
			
		||||
				deps = append(deps, depString)
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	fmt.Println(buffer)
 | 
			
		||||
	return deps
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// RemoveMod is a CLI frontend for tools.RemoveMod
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										10
									
								
								main.go
									
									
									
									
									
								
							
							
						
						
									
										10
									
								
								main.go
									
									
									
									
									
								
							@ -71,8 +71,16 @@ func main() {
 | 
			
		||||
		api.CheckAPICache()
 | 
			
		||||
		api.InitAPI()
 | 
			
		||||
		fmt.Println("> Downloading mods...")
 | 
			
		||||
		dependencies := []string{}
 | 
			
		||||
		for _, m := range os.Args[2:] {
 | 
			
		||||
			cli.InstallMod(m)
 | 
			
		||||
			newdeps := cli.InstallMod(m)
 | 
			
		||||
			for _, d := range newdeps {
 | 
			
		||||
				dependencies = append(dependencies, d)
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		fmt.Println("> Downloading dependencies...")
 | 
			
		||||
		for _, d := range dependencies {
 | 
			
		||||
			cli.InstallMod(d)
 | 
			
		||||
		}
 | 
			
		||||
		color.Green("> Complete!")
 | 
			
		||||
	case "remove", "rm", "r":
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user