mirror of
https://github.com/Jguer/yay
synced 2024-10-31 04:12:51 +00:00
Merge pull request #599 from Morganamilo/unused
Remove unneeded variables
This commit is contained in:
commit
5f107ad7ad
4 changed files with 22 additions and 24 deletions
9
cmd.go
9
cmd.go
|
@ -398,10 +398,8 @@ func handleGetpkgbuild() (err error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func handleYogurt() (err error) {
|
func handleYogurt() (err error) {
|
||||||
options := cmdArgs.formatArgs()
|
|
||||||
|
|
||||||
config.SearchMode = NumberMenu
|
config.SearchMode = NumberMenu
|
||||||
err = numberMenu(cmdArgs.targets, options)
|
err = numberMenu(cmdArgs.targets)
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -445,7 +443,7 @@ func handleRemove() (err error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// NumberMenu presents a CLI for selecting packages to install.
|
// NumberMenu presents a CLI for selecting packages to install.
|
||||||
func numberMenu(pkgS []string, flags []string) (err error) {
|
func numberMenu(pkgS []string) (err error) {
|
||||||
pkgS = removeInvalidTargets(pkgS)
|
pkgS = removeInvalidTargets(pkgS)
|
||||||
var aurErr error
|
var aurErr error
|
||||||
var repoErr error
|
var repoErr error
|
||||||
|
@ -538,7 +536,8 @@ func numberMenu(pkgS []string, flags []string) (err error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(arguments.targets) == 0 {
|
if len(arguments.targets) == 0 {
|
||||||
return fmt.Errorf("There is nothing to do")
|
fmt.Println("There is nothing to do")
|
||||||
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
if config.SudoLoop {
|
if config.SudoLoop {
|
||||||
|
|
|
@ -78,7 +78,7 @@ func gitDownload(url string, path string, name string) (bool, error) {
|
||||||
return false, nil
|
return false, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func gitMerge(url string, path string, name string) error {
|
func gitMerge(path string, name string) error {
|
||||||
err := show(passToGit(filepath.Join(path, name), "reset", "--hard", "HEAD"))
|
err := show(passToGit(filepath.Join(path, name), "reset", "--hard", "HEAD"))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("error resetting %s", name)
|
return fmt.Errorf("error resetting %s", name)
|
||||||
|
|
28
install.go
28
install.go
|
@ -179,7 +179,7 @@ func install(parser *arguments) error {
|
||||||
|
|
||||||
if config.CleanMenu {
|
if config.CleanMenu {
|
||||||
askClean := pkgbuildNumberMenu(do.Aur, do.Bases, remoteNamesCache)
|
askClean := pkgbuildNumberMenu(do.Aur, do.Bases, remoteNamesCache)
|
||||||
toClean, err := cleanNumberMenu(do.Aur, do.Bases, remoteNamesCache, askClean)
|
toClean, err := cleanNumberMenu(do.Aur, remoteNamesCache, askClean)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
@ -198,7 +198,7 @@ func install(parser *arguments) error {
|
||||||
|
|
||||||
if config.DiffMenu {
|
if config.DiffMenu {
|
||||||
pkgbuildNumberMenu(do.Aur, do.Bases, remoteNamesCache)
|
pkgbuildNumberMenu(do.Aur, do.Bases, remoteNamesCache)
|
||||||
toDiff, err = diffNumberMenu(do.Aur, do.Bases, remoteNamesCache)
|
toDiff, err = diffNumberMenu(do.Aur, remoteNamesCache)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
@ -234,13 +234,13 @@ func install(parser *arguments) error {
|
||||||
|
|
||||||
if config.EditMenu {
|
if config.EditMenu {
|
||||||
pkgbuildNumberMenu(do.Aur, do.Bases, remoteNamesCache)
|
pkgbuildNumberMenu(do.Aur, do.Bases, remoteNamesCache)
|
||||||
toEdit, err = editNumberMenu(do.Aur, do.Bases, remoteNamesCache)
|
toEdit, err = editNumberMenu(do.Aur, remoteNamesCache)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(toEdit) > 0 {
|
if len(toEdit) > 0 {
|
||||||
err = editPkgBuilds(toEdit, srcinfosStale, do.Bases)
|
err = editPkgBuilds(toEdit, srcinfosStale)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
@ -257,7 +257,7 @@ func install(parser *arguments) error {
|
||||||
config.NoConfirm = oldValue
|
config.NoConfirm = oldValue
|
||||||
}
|
}
|
||||||
|
|
||||||
incompatible, err = getIncompatible(do.Aur, srcinfosStale, do.Bases)
|
incompatible, err = getIncompatible(do.Aur, srcinfosStale)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
@ -418,7 +418,7 @@ func earlyRefresh(parser *arguments) error {
|
||||||
return show(passToPacman(arguments))
|
return show(passToPacman(arguments))
|
||||||
}
|
}
|
||||||
|
|
||||||
func getIncompatible(pkgs []*rpc.Pkg, srcinfos map[string]*gosrc.Srcinfo, bases map[string][]*rpc.Pkg) (stringSet, error) {
|
func getIncompatible(pkgs []*rpc.Pkg, srcinfos map[string]*gosrc.Srcinfo) (stringSet, error) {
|
||||||
incompatible := make(stringSet)
|
incompatible := make(stringSet)
|
||||||
alpmArch, err := alpmHandle.Arch()
|
alpmArch, err := alpmHandle.Arch()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -513,7 +513,7 @@ func pkgbuildNumberMenu(pkgs []*rpc.Pkg, bases map[string][]*rpc.Pkg, installed
|
||||||
return askClean
|
return askClean
|
||||||
}
|
}
|
||||||
|
|
||||||
func cleanNumberMenu(pkgs []*rpc.Pkg, bases map[string][]*rpc.Pkg, installed stringSet, hasClean bool) ([]*rpc.Pkg, error) {
|
func cleanNumberMenu(pkgs []*rpc.Pkg, installed stringSet, hasClean bool) ([]*rpc.Pkg, error) {
|
||||||
toClean := make([]*rpc.Pkg, 0)
|
toClean := make([]*rpc.Pkg, 0)
|
||||||
|
|
||||||
if !hasClean {
|
if !hasClean {
|
||||||
|
@ -576,15 +576,15 @@ func cleanNumberMenu(pkgs []*rpc.Pkg, bases map[string][]*rpc.Pkg, installed str
|
||||||
return toClean, nil
|
return toClean, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func editNumberMenu(pkgs []*rpc.Pkg, bases map[string][]*rpc.Pkg, installed stringSet) ([]*rpc.Pkg, error) {
|
func editNumberMenu(pkgs []*rpc.Pkg, installed stringSet) ([]*rpc.Pkg, error) {
|
||||||
return editDiffNumberMenu(pkgs, bases, installed, false)
|
return editDiffNumberMenu(pkgs, installed, false)
|
||||||
}
|
}
|
||||||
|
|
||||||
func diffNumberMenu(pkgs []*rpc.Pkg, bases map[string][]*rpc.Pkg, installed stringSet) ([]*rpc.Pkg, error) {
|
func diffNumberMenu(pkgs []*rpc.Pkg, installed stringSet) ([]*rpc.Pkg, error) {
|
||||||
return editDiffNumberMenu(pkgs, bases, installed, true)
|
return editDiffNumberMenu(pkgs, installed, true)
|
||||||
}
|
}
|
||||||
|
|
||||||
func editDiffNumberMenu(pkgs []*rpc.Pkg, bases map[string][]*rpc.Pkg, installed stringSet, diff bool) ([]*rpc.Pkg, error) {
|
func editDiffNumberMenu(pkgs []*rpc.Pkg, installed stringSet, diff bool) ([]*rpc.Pkg, error) {
|
||||||
toEdit := make([]*rpc.Pkg, 0)
|
toEdit := make([]*rpc.Pkg, 0)
|
||||||
var editInput string
|
var editInput string
|
||||||
var err error
|
var err error
|
||||||
|
@ -702,7 +702,7 @@ func showPkgBuildDiffs(pkgs []*rpc.Pkg, bases map[string][]*rpc.Pkg, cloned stri
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func editPkgBuilds(pkgs []*rpc.Pkg, srcinfos map[string]*gosrc.Srcinfo, bases map[string][]*rpc.Pkg) error {
|
func editPkgBuilds(pkgs []*rpc.Pkg, srcinfos map[string]*gosrc.Srcinfo) error {
|
||||||
pkgbuilds := make([]string, 0, len(pkgs))
|
pkgbuilds := make([]string, 0, len(pkgs))
|
||||||
for _, pkg := range pkgs {
|
for _, pkg := range pkgs {
|
||||||
dir := filepath.Join(config.BuildDir, pkg.PackageBase)
|
dir := filepath.Join(config.BuildDir, pkg.PackageBase)
|
||||||
|
@ -786,7 +786,7 @@ func pkgBuildsToSkip(pkgs []*rpc.Pkg, targets stringSet) stringSet {
|
||||||
func mergePkgBuilds(pkgs []*rpc.Pkg) error {
|
func mergePkgBuilds(pkgs []*rpc.Pkg) error {
|
||||||
for _, pkg := range pkgs {
|
for _, pkg := range pkgs {
|
||||||
if shouldUseGit(filepath.Join(config.BuildDir, pkg.PackageBase)) {
|
if shouldUseGit(filepath.Join(config.BuildDir, pkg.PackageBase)) {
|
||||||
err := gitMerge(baseURL+"/"+pkg.PackageBase+".git", config.BuildDir, pkg.PackageBase)
|
err := gitMerge(config.BuildDir, pkg.PackageBase)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
@ -120,7 +120,6 @@ func upList(warnings *aurWarnings) (aurUp upSlice, repoUp upSlice, err error) {
|
||||||
|
|
||||||
var repoErr error
|
var repoErr error
|
||||||
var aurErr error
|
var aurErr error
|
||||||
var develErr error
|
|
||||||
|
|
||||||
pkgdata := make(map[string]*rpc.Pkg)
|
pkgdata := make(map[string]*rpc.Pkg)
|
||||||
|
|
||||||
|
@ -145,7 +144,7 @@ func upList(warnings *aurWarnings) (aurUp upSlice, repoUp upSlice, err error) {
|
||||||
fmt.Println(bold(cyan("::") + bold(" Checking development packages...")))
|
fmt.Println(bold(cyan("::") + bold(" Checking development packages...")))
|
||||||
wg.Add(1)
|
wg.Add(1)
|
||||||
go func() {
|
go func() {
|
||||||
develUp, develErr = upDevel(remote)
|
develUp = upDevel(remote)
|
||||||
wg.Done()
|
wg.Done()
|
||||||
}()
|
}()
|
||||||
}
|
}
|
||||||
|
@ -156,7 +155,7 @@ func upList(warnings *aurWarnings) (aurUp upSlice, repoUp upSlice, err error) {
|
||||||
printLocalNewerThanAUR(remote, pkgdata)
|
printLocalNewerThanAUR(remote, pkgdata)
|
||||||
|
|
||||||
errs := make([]string, 0)
|
errs := make([]string, 0)
|
||||||
for _, e := range []error{repoErr, aurErr, develErr} {
|
for _, e := range []error{repoErr, aurErr} {
|
||||||
if e != nil {
|
if e != nil {
|
||||||
errs = append(errs, e.Error())
|
errs = append(errs, e.Error())
|
||||||
}
|
}
|
||||||
|
@ -184,7 +183,7 @@ func upList(warnings *aurWarnings) (aurUp upSlice, repoUp upSlice, err error) {
|
||||||
return aurUp, repoUp, err
|
return aurUp, repoUp, err
|
||||||
}
|
}
|
||||||
|
|
||||||
func upDevel(remote []alpm.Package) (toUpgrade upSlice, err error) {
|
func upDevel(remote []alpm.Package) (toUpgrade upSlice) {
|
||||||
toUpdate := make([]alpm.Package, 0)
|
toUpdate := make([]alpm.Package, 0)
|
||||||
toRemove := make([]string, 0)
|
toRemove := make([]string, 0)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue