Gracefully exit on info with no 2nd parameter
This commit is contained in:
parent
9b83d7beea
commit
584c6cd90e
@ -44,6 +44,7 @@ type Version struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// CheckAPICache checks if the cached json is expired
|
// CheckAPICache checks if the cached json is expired
|
||||||
|
// TODO: REWRITE
|
||||||
func CheckAPICache() {
|
func CheckAPICache() {
|
||||||
// TODO: move the printing out, add returns
|
// TODO: move the printing out, add returns
|
||||||
|
|
||||||
@ -70,6 +71,7 @@ func CheckAPICache() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// UpdateAPICache gets a new copy of the thunderstore pkgfile
|
// UpdateAPICache gets a new copy of the thunderstore pkgfile
|
||||||
|
// TODO: ARIA2 IMPLEMENTATION
|
||||||
func UpdateAPICache() {
|
func UpdateAPICache() {
|
||||||
apiURL := "https://thunderstore.io/api/v1/package/"
|
apiURL := "https://thunderstore.io/api/v1/package/"
|
||||||
|
|
||||||
|
18
main.go
18
main.go
@ -42,16 +42,20 @@ func main() {
|
|||||||
> remove, rem, r -- remove mod(s)
|
> remove, rem, r -- remove mod(s)
|
||||||
> list, ls, li -- list mods
|
> list, ls, li -- list mods
|
||||||
> update, upgrade, up -- update mods and API cache
|
> update, upgrade, up -- update mods and API cache
|
||||||
> toggle, tg, togglemods -- toggle mods
|
> toggle, tm, togglemods -- toggle mods
|
||||||
> filter -- remove version numbers using regex from stdin
|
> filter -- remove version numbers using regex from stdin
|
||||||
`)
|
`)
|
||||||
case "info":
|
case "info":
|
||||||
var selectedmod api.Mod = api.GetModData(os.Args[2])
|
if len(os.Args) <= 2 {
|
||||||
color.Cyan("Mod Info: %s", os.Args[2])
|
fmt.Println("Usage: r2mod-go info <dependency string>")
|
||||||
fmt.Println(" Name: " + selectedmod.Versions[0].FullName)
|
} else {
|
||||||
fmt.Println(" Desc: " + selectedmod.Versions[0].Description)
|
var selectedmod api.Mod = api.GetModData(os.Args[2])
|
||||||
fmt.Println(" Version: " + selectedmod.Versions[0].VersionNumber)
|
color.Cyan("Mod Info: %s", os.Args[2])
|
||||||
fmt.Println(" Download URL: " + selectedmod.Versions[0].DownloadURL)
|
fmt.Println(" Name: " + selectedmod.Versions[0].FullName)
|
||||||
|
fmt.Println(" Desc: " + selectedmod.Versions[0].Description)
|
||||||
|
fmt.Println(" Version: " + selectedmod.Versions[0].VersionNumber)
|
||||||
|
fmt.Println(" Download URL: " + selectedmod.Versions[0].DownloadURL)
|
||||||
|
}
|
||||||
case "install", "ins", "i":
|
case "install", "ins", "i":
|
||||||
api.CheckAPICache()
|
api.CheckAPICache()
|
||||||
for _, m := range os.Args[2:] {
|
for _, m := range os.Args[2:] {
|
||||||
|
Loading…
Reference in New Issue
Block a user