mirror of
https://github.com/Jguer/yay
synced 2024-07-18 16:33:38 +00:00
fix(clean_menu): optimize any base installed
This commit is contained in:
parent
a43fbacc96
commit
f3c3e2e4d4
|
@ -36,11 +36,7 @@ func cleanNumberMenu(bases []dep.Base, installed stringset.StringSet) ([]dep.Bas
|
||||||
if !cOtherInclude.Get("n") && !cOtherInclude.Get("none") {
|
if !cOtherInclude.Get("n") && !cOtherInclude.Get("none") {
|
||||||
for i, base := range bases {
|
for i, base := range bases {
|
||||||
pkg := base.Pkgbase()
|
pkg := base.Pkgbase()
|
||||||
anyInstalled := false
|
anyInstalled := base.AnyIsInSet(installed)
|
||||||
|
|
||||||
for _, b := range base {
|
|
||||||
anyInstalled = anyInstalled || installed.Get(b.Name)
|
|
||||||
}
|
|
||||||
|
|
||||||
dir := filepath.Join(config.BuildDir, pkg)
|
dir := filepath.Join(config.BuildDir, pkg)
|
||||||
if _, err := os.Stat(dir); os.IsNotExist(err) {
|
if _, err := os.Stat(dir); os.IsNotExist(err) {
|
||||||
|
|
13
install.go
13
install.go
|
@ -564,12 +564,7 @@ func pkgbuildNumberMenu(bases []dep.Base, installed stringset.StringSet) {
|
||||||
toPrint += fmt.Sprintf(text.Magenta("%3d")+" %-40s", len(bases)-n,
|
toPrint += fmt.Sprintf(text.Magenta("%3d")+" %-40s", len(bases)-n,
|
||||||
text.Bold(base.String()))
|
text.Bold(base.String()))
|
||||||
|
|
||||||
anyInstalled := false
|
if base.AnyIsInSet(installed) {
|
||||||
for _, b := range base {
|
|
||||||
anyInstalled = anyInstalled || installed.Get(b.Name)
|
|
||||||
}
|
|
||||||
|
|
||||||
if anyInstalled {
|
|
||||||
toPrint += text.Bold(text.Green(gotext.Get(" (Installed)")))
|
toPrint += text.Bold(text.Green(gotext.Get(" (Installed)")))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -625,11 +620,7 @@ func editDiffNumberMenu(bases []dep.Base, installed stringset.StringSet, diff bo
|
||||||
if !eOtherInclude.Get("n") && !eOtherInclude.Get("none") {
|
if !eOtherInclude.Get("n") && !eOtherInclude.Get("none") {
|
||||||
for i, base := range bases {
|
for i, base := range bases {
|
||||||
pkg := base.Pkgbase()
|
pkg := base.Pkgbase()
|
||||||
anyInstalled := false
|
anyInstalled := base.AnyIsInSet(installed)
|
||||||
|
|
||||||
for _, b := range base {
|
|
||||||
anyInstalled = anyInstalled || installed.Get(b.Name)
|
|
||||||
}
|
|
||||||
|
|
||||||
if !eIsInclude && eExclude.Get(len(bases)-i) {
|
if !eIsInclude && eExclude.Get(len(bases)-i) {
|
||||||
continue
|
continue
|
||||||
|
|
|
@ -1,6 +1,9 @@
|
||||||
package dep
|
package dep
|
||||||
|
|
||||||
import aur "github.com/Jguer/yay/v11/pkg/query"
|
import (
|
||||||
|
aur "github.com/Jguer/yay/v11/pkg/query"
|
||||||
|
"github.com/Jguer/yay/v11/pkg/stringset"
|
||||||
|
)
|
||||||
|
|
||||||
// Base is an AUR base package.
|
// Base is an AUR base package.
|
||||||
type Base []*aur.Pkg
|
type Base []*aur.Pkg
|
||||||
|
@ -20,6 +23,16 @@ func (b Base) URLPath() string {
|
||||||
return b[0].URLPath
|
return b[0].URLPath
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (b Base) AnyIsInSet(set stringset.StringSet) bool {
|
||||||
|
for _, pkg := range b {
|
||||||
|
if set.Get(pkg.Name) {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
// Packages foo and bar from a pkgbase named base would print like so:
|
// Packages foo and bar from a pkgbase named base would print like so:
|
||||||
// base (foo bar).
|
// base (foo bar).
|
||||||
func (b Base) String() string {
|
func (b Base) String() string {
|
||||||
|
|
Loading…
Reference in a new issue