From 22a74aa79312fec041ee3e1ea751dbc7dbe24340 Mon Sep 17 00:00:00 2001 From: Arsen Musayelyan Date: Sun, 18 Dec 2022 17:46:40 -0800 Subject: [PATCH] Add ignorePkgUpdates field to config --- internal/config/config.go | 5 +++-- internal/types/config.go | 7 ++++--- upgrade.go | 4 ++++ 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/internal/config/config.go b/internal/config/config.go index 7746258..3fba58b 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -8,8 +8,9 @@ import ( ) var defaultConfig = types.Config{ - RootCmd: "sudo", - PagerStyle: "native", + RootCmd: "sudo", + PagerStyle: "native", + IgnorePkgUpdates: []string{}, Repos: []types.Repo{ { Name: "default", diff --git a/internal/types/config.go b/internal/types/config.go index 9261673..ad24571 100644 --- a/internal/types/config.go +++ b/internal/types/config.go @@ -2,9 +2,10 @@ package types // Config represents the LURE configuration file type Config struct { - RootCmd string `toml:"rootCmd"` - PagerStyle string `toml:"pagerStyle"` - Repos []Repo `toml:"repo"` + RootCmd string `toml:"rootCmd"` + PagerStyle string `toml:"pagerStyle"` + IgnorePkgUpdates []string `toml:"ignorePkgUpdates"` + Repos []Repo `toml:"repo"` } // Repo represents a LURE repo within a configuration file diff --git a/upgrade.go b/upgrade.go index ac6ad80..0668099 100644 --- a/upgrade.go +++ b/upgrade.go @@ -77,6 +77,10 @@ func checkForUpdates(ctx context.Context, mgr manager.Manager, info *distro.OSRe var out []db.Package for pkgName, pkgs := range found { + if slices.Contains(cfg.IgnorePkgUpdates, pkgName) { + continue + } + if len(pkgs) > 1 { // Puts the element with the highest version first slices.SortFunc(pkgs, func(a, b db.Package) bool {