Refactored

This commit is contained in:
Jguer 2016-11-30 13:59:38 +00:00
parent 517939d108
commit d490f484ca
3 changed files with 11 additions and 11 deletions

View File

@ -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

View File

@ -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 {

View File

@ -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 {