mirror of
https://github.com/Jguer/yay.git
synced 2024-11-06 17:17:22 +01:00
Refactored AUR package
This commit is contained in:
parent
484eb3b75f
commit
a91984045c
@ -13,6 +13,9 @@ import (
|
||||
rpc "github.com/mikkeloscar/aur"
|
||||
)
|
||||
|
||||
// BaseURL givers the AUR default address.
|
||||
const BaseURL string = "https://aur.archlinux.org"
|
||||
|
||||
// NarrowSearch searches AUR and narrows based on subarguments
|
||||
func NarrowSearch(pkgS []string, sortS bool) (Query, error) {
|
||||
if len(pkgS) == 0 {
|
||||
|
@ -7,8 +7,6 @@ import (
|
||||
rpc "github.com/mikkeloscar/aur"
|
||||
)
|
||||
|
||||
const aurURL = "https://aur.archlinux.org/rpc/?"
|
||||
|
||||
// Query is a collection of Results
|
||||
type Query []rpc.Pkg
|
||||
|
||||
|
20
aur/utils.go
20
aur/utils.go
@ -1,20 +0,0 @@
|
||||
package aur
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
// BaseURL givers the AUR default address.
|
||||
const BaseURL string = "https://aur.archlinux.org"
|
||||
|
||||
// getJSON handles JSON retrieval and decoding to struct
|
||||
func getJSON(url string, target interface{}) error {
|
||||
r, err := http.Get(url)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer r.Body.Close()
|
||||
|
||||
return json.NewDecoder(r.Body).Decode(target)
|
||||
}
|
Loading…
Reference in New Issue
Block a user