mirror of
https://github.com/Jguer/yay.git
synced 2025-12-27 10:01:53 -05:00
Re-add functionality for Installed and NotInstalled options in the menus (#2233)
* fix(menus): Handle Installed and NotInstalled options correctly in the menus This functionality was temporarily removed. This commit adds that functionality back. * fix(tests): Mock InstalledRemotePackageNamesFn when necessary
This commit is contained in:
@@ -23,7 +23,9 @@ func anyExistInCache(pkgbuildDirs map[string]string) bool {
|
||||
return false
|
||||
}
|
||||
|
||||
func CleanFn(ctx context.Context, config *settings.Configuration, w io.Writer, pkgbuildDirsByBase map[string]string) error {
|
||||
func CleanFn(ctx context.Context, config *settings.Configuration, w io.Writer,
|
||||
pkgbuildDirsByBase map[string]string, installed mapset.Set[string],
|
||||
) error {
|
||||
if len(pkgbuildDirsByBase) == 0 {
|
||||
return nil // no work to do
|
||||
}
|
||||
@@ -47,8 +49,7 @@ func CleanFn(ctx context.Context, config *settings.Configuration, w io.Writer, p
|
||||
bases = append(bases, pkg)
|
||||
}
|
||||
|
||||
// TOFIX: empty installed slice means installed filter is disabled
|
||||
toClean, errClean := selectionMenu(w, pkgbuildDirsByBase, bases, mapset.NewSet[string](),
|
||||
toClean, errClean := selectionMenu(w, pkgbuildDirsByBase, bases, installed,
|
||||
gotext.Get("Packages to cleanBuild?"),
|
||||
settings.NoConfirm, config.AnswerClean, skipFunc)
|
||||
if errClean != nil {
|
||||
|
||||
@@ -90,7 +90,7 @@ func gitHasDiff(ctx context.Context, cmdBuilder exe.ICmdBuilder, dir string) (bo
|
||||
return true, nil
|
||||
}
|
||||
|
||||
// Return wether or not we have reviewed a diff yet. It checks for the existence of
|
||||
// Return whether or not we have reviewed a diff yet. It checks for the existence of
|
||||
// YAY_DIFF_REVIEW in the git ref-list.
|
||||
func gitHasLastSeenRef(ctx context.Context, cmdBuilder exe.ICmdBuilder, dir string) bool {
|
||||
_, _, err := cmdBuilder.Capture(
|
||||
@@ -145,7 +145,9 @@ func updatePkgbuildSeenRef(ctx context.Context, cmdBuilder exe.ICmdBuilder, pkgb
|
||||
return errMulti.Return()
|
||||
}
|
||||
|
||||
func DiffFn(ctx context.Context, config *settings.Configuration, w io.Writer, pkgbuildDirsByBase map[string]string) error {
|
||||
func DiffFn(ctx context.Context, config *settings.Configuration, w io.Writer,
|
||||
pkgbuildDirsByBase map[string]string, installed mapset.Set[string],
|
||||
) error {
|
||||
if len(pkgbuildDirsByBase) == 0 {
|
||||
return nil // no work to do
|
||||
}
|
||||
@@ -155,7 +157,7 @@ func DiffFn(ctx context.Context, config *settings.Configuration, w io.Writer, pk
|
||||
bases = append(bases, base)
|
||||
}
|
||||
|
||||
toDiff, errMenu := selectionMenu(w, pkgbuildDirsByBase, bases, mapset.NewThreadUnsafeSet[string](), gotext.Get("Diffs to show?"),
|
||||
toDiff, errMenu := selectionMenu(w, pkgbuildDirsByBase, bases, installed, gotext.Get("Diffs to show?"),
|
||||
settings.NoConfirm, config.AnswerDiff, nil)
|
||||
if errMenu != nil || len(toDiff) == 0 {
|
||||
return errMenu
|
||||
|
||||
@@ -114,7 +114,7 @@ func editPkgbuilds(log *text.Logger, pkgbuildDirs map[string]string, bases []str
|
||||
}
|
||||
|
||||
func EditFn(ctx context.Context, cfg *settings.Configuration, w io.Writer,
|
||||
pkgbuildDirsByBase map[string]string,
|
||||
pkgbuildDirsByBase map[string]string, installed mapset.Set[string],
|
||||
) error {
|
||||
if len(pkgbuildDirsByBase) == 0 {
|
||||
return nil // no work to do
|
||||
@@ -125,8 +125,7 @@ func EditFn(ctx context.Context, cfg *settings.Configuration, w io.Writer,
|
||||
bases = append(bases, pkg)
|
||||
}
|
||||
|
||||
toEdit, errMenu := selectionMenu(w, pkgbuildDirsByBase, bases,
|
||||
mapset.NewThreadUnsafeSet[string](),
|
||||
toEdit, errMenu := selectionMenu(w, pkgbuildDirsByBase, bases, installed,
|
||||
gotext.Get("PKGBUILDs to edit?"), settings.NoConfirm, cfg.AnswerEdit, nil)
|
||||
if errMenu != nil || len(toEdit) == 0 {
|
||||
return errMenu
|
||||
|
||||
Reference in New Issue
Block a user