mirror of
https://github.com/Jguer/yay.git
synced 2024-11-06 17:17:22 +01:00
Refactored
This commit is contained in:
parent
517939d108
commit
d490f484ca
10
actions.go
10
actions.go
@ -26,7 +26,7 @@ func NumberMenu(pkgName string, flags []string) (err error) {
|
||||
var args []string
|
||||
|
||||
a, err := aur.Search(pkgName, true)
|
||||
r, err := SearchPackages(pkgName, conf)
|
||||
r, err := SearchPackages(pkgName)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
@ -76,7 +76,7 @@ func NumberMenu(pkgName string, flags []string) (err error) {
|
||||
}
|
||||
|
||||
for _, aurpkg := range aurInstall {
|
||||
err = aurpkg.Install(BuildDir, conf, flags)
|
||||
err = aurpkg.Install(BuildDir, &conf, flags)
|
||||
if err != nil {
|
||||
// Do not abandon program, we might still be able to install the rest
|
||||
fmt.Println(err)
|
||||
@ -133,7 +133,7 @@ func Install(pkgs []string, flags []string) error {
|
||||
}
|
||||
|
||||
for _, aurpkg := range foreign {
|
||||
err = aur.Install(aurpkg, BuildDir, conf, flags)
|
||||
err = aur.Install(aurpkg, BuildDir, &conf, flags)
|
||||
}
|
||||
|
||||
return nil
|
||||
@ -142,7 +142,7 @@ func Install(pkgs []string, flags []string) error {
|
||||
// Upgrade handles updating the cache and installing updates.
|
||||
func Upgrade(flags []string) error {
|
||||
errp := UpdatePackages(flags)
|
||||
erra := aur.UpdatePackages(BuildDir, conf, flags)
|
||||
erra := aur.UpdatePackages(BuildDir, &conf, flags)
|
||||
|
||||
if errp != nil {
|
||||
return errp
|
||||
@ -158,7 +158,7 @@ func Search(pkg string) (err error) {
|
||||
return err
|
||||
}
|
||||
|
||||
SearchRepos(pkg, conf, SearchMode)
|
||||
SearchRepos(pkg, SearchMode)
|
||||
a.PrintSearch(SearchMode)
|
||||
|
||||
return nil
|
||||
|
@ -68,21 +68,21 @@ func main() {
|
||||
err = yay.LocalStatistics()
|
||||
case "-Ss":
|
||||
for _, pkg := range pkgs {
|
||||
err = searchMode(pkg, &conf)
|
||||
err = yay.Search(pkg)
|
||||
}
|
||||
case "-S":
|
||||
err = InstallPackage(pkgs, &conf, options)
|
||||
err = yay.Install(pkgs, options)
|
||||
case "-Syu", "-Suy":
|
||||
err = yay.Upgrade(options)
|
||||
case "yogurt":
|
||||
for _, pkg := range pkgs {
|
||||
err = yay.NumberMenu(pkg, &conf, options)
|
||||
err = yay.NumberMenu(pkg, options)
|
||||
break
|
||||
}
|
||||
case "--help", "-h":
|
||||
usage()
|
||||
default:
|
||||
err = passToPacman(op, pkgs, options)
|
||||
err = yay.PassToPacman(op, pkgs, options)
|
||||
}
|
||||
|
||||
if err != nil {
|
||||
|
@ -61,7 +61,7 @@ func UpdatePackages(flags []string) error {
|
||||
}
|
||||
|
||||
// SearchRepos searches and prints packages in repo
|
||||
func SearchRepos(pkgName string, conf *alpm.PacmanConfig, mode int) (err error) {
|
||||
func SearchRepos(pkgName string, mode int) (err error) {
|
||||
h, err := conf.CreateHandle()
|
||||
defer h.Release()
|
||||
if err != nil {
|
||||
@ -103,7 +103,7 @@ func SearchRepos(pkgName string, conf *alpm.PacmanConfig, mode int) (err error)
|
||||
}
|
||||
|
||||
// SearchPackages handles repo searches. Creates a RepoSearch struct.
|
||||
func SearchPackages(pkgName string, conf *alpm.PacmanConfig) (s RepoSearch, err error) {
|
||||
func SearchPackages(pkgName string) (s RepoSearch, err error) {
|
||||
h, err := conf.CreateHandle()
|
||||
defer h.Release()
|
||||
if err != nil {
|
||||
|
Loading…
Reference in New Issue
Block a user