Don't show provider menu for targets during -Y

Doing `yay -S yay` I expect the provider menu to show, giving me the
choice between yay, yay-bin and yay-git

If I do `yay yay` I will then get a menu of all matching packages. upon
entering 2 for the package yay I would not expect a provider menu.
I have already choosen an exact package.

This commit disables the provider menu during yogurt mode. Only for
targets, the dependencies can still open provider menus.
This commit is contained in:
morganamilo committed 2018-06-02 19:13:20 +01:00
1 parent bd162cc317
commit bf562ee9a7
1 file changed
+18 -25
+18 -25
View File
@@ -377,6 +377,12 @@ func (dp *depPool) findSatisfierAur(dep string) *rpc.Pkg {
// This is mostly used to promote packages from the cache
// to the Install list
// Provide a pacman style provider menu if theres more than one candidate
// This acts slightly differenly from Pacman, It will give
// a menu even if a package with a matching name exists. I believe this
// method is better because most of the time you are choosing between
// foo and foo-git.
// Using Pacman's ways trying to install foo would never give you
// a menu.
// TODO: maybe intermix repo providers in the menu
func (dp *depPool) findSatisfierAurCache(dep string) *rpc.Pkg {
depName, _, _ := splitDep(dep)
@@ -387,33 +393,20 @@ func (dp *depPool) findSatisfierAurCache(dep string) *rpc.Pkg {
if pkg, ok := dp.AurCache[dep]; ok && pkgSatisfies(pkg.Name, pkg.Version, dep) {
return pkg
}
}
//this version prioratizes name over provides
//if theres a direct match for a package return
//that instead of using the menu
//
//providers := make(rpcPkgs, 0)
//for _, pkg := range dp.AurCache {
// if pkgSatisfies(pkg.Name, pkg.Version, dep) {
// return pkg
// }
//}
//for _, pkg := range dp.AurCache {
// for _, provide := range pkg.Provides {
// if provideSatisfies(provide, dep) {
// providers = append(providers, pkg)
// }
// }
//}
// This version acts slightly differenly from Pacman, It will give
// a menu even if a package with a matching name exists. I believe this
// method is better because most of the time you are choosing between
// foo and foo-git.
// Using Pacman's ways trying to install foo would never give you
// a menu.
if cmdArgs.op == "Y" || cmdArgs.op == "yay" {
for _, pkg := range dp.AurCache {
if pkgSatisfies(pkg.Name, pkg.Version, dep) {
for _, target := range dp.Targets {
if target.Name == pkg.Name {
return pkg
}
}
}
}
}
for _, pkg := range dp.AurCache {
if seen.get(pkg.Name) {