From 74196306fae314cc127971df293fc741ace74ed2 Mon Sep 17 00:00:00 2001 From: morganamilo Date: Mon, 12 Mar 2018 23:25:09 +0000 Subject: [PATCH] Respect --ignore and --ignoregroup flags And enable version colouring on repo ignore and devel ignore --- cmd.go | 11 +++++++++++ upgrade.go | 6 ++++-- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/cmd.go b/cmd.go index 95524c851..81503cb50 100644 --- a/cmd.go +++ b/cmd.go @@ -188,6 +188,17 @@ func initAlpm() (err error) { alpmConf.Architecture = value } + value, _, exists = cmdArgs.getArg("ignore") + if exists { + alpmConf.IgnorePkg = append(alpmConf.IgnorePkg, strings.Split(value, ",")...) + } + + value, _, exists = cmdArgs.getArg("ignoregroup") + if exists { + alpmConf.IgnoreGroup = append(alpmConf.IgnoreGroup, strings.Split(value, ",")...) + } + + //TODO //current system does not allow duplicate arguments //but pacman allows multiple cachdirs to be passed diff --git a/upgrade.go b/upgrade.go index b1ba52a84..2b1f08fdf 100644 --- a/upgrade.go +++ b/upgrade.go @@ -140,8 +140,9 @@ func upDevel(remote []alpm.Package, packageC chan upgrade, done chan bool) { } if found { if pkg.ShouldIgnore() { + left, right := getVersionDiff(pkg.Version(), "latest-commit") fmt.Print(magenta("Warning: ")) - fmt.Printf("%s ignoring package upgrade (%s => %s)\n", cyan(pkg.Name()), pkg.Version(), "git") + fmt.Printf("%s ignoring package upgrade (%s => %s)\n", cyan(pkg.Name()), left, right) } else { packageC <- upgrade{pkg.Name(), "devel", pkg.Version(), "latest-commit"} } @@ -229,8 +230,9 @@ func upRepo(local []alpm.Package) (upSlice, error) { newPkg := pkg.NewVersion(dbList) if newPkg != nil { if pkg.ShouldIgnore() { + left, right := getVersionDiff(pkg.Version(), newPkg.Version()) fmt.Print(magenta("Warning: ")) - fmt.Printf("%s ignoring package upgrade (%s => %s)\n", pkg.Name(), pkg.Version(), newPkg.Version()) + fmt.Printf("%s ignoring package upgrade (%s => %s)\n", cyan(pkg.Name()), left, right) } else { slice = append(slice, upgrade{pkg.Name(), newPkg.DB().Name(), pkg.Version(), newPkg.Version()}) }