Show pkgver during -Ss when package is out of date

This commit is contained in:
morganamilo 2018-04-07 23:02:10 +01:00
parent ec71a5bb87
commit 9ba9b03396
No known key found for this signature in database
GPG Key ID: 6FE9E7996B0B082E

View File

@ -55,9 +55,13 @@ func (q aurQuery) printSearch(start int) {
toprint += bold(red("(Out-of-date "+formatTime(res.OutOfDate)+")")) + " "
}
if _, err := localDb.PkgByName(res.Name); err == nil {
if pkg, err := localDb.PkgByName(res.Name); err == nil {
if pkg.Version() != res.Version {
toprint += bold(green("(Installed: " + pkg.Version() + ")"))
} else {
toprint += bold(green("(Installed)"))
}
}
toprint += "\n " + res.Description
fmt.Println(toprint)
}
@ -89,10 +93,14 @@ func (s repoQuery) printSearch() {
localDb, err := alpmHandle.LocalDb()
if err == nil {
if _, err = localDb.PkgByName(res.Name()); err == nil {
if pkg, err := localDb.PkgByName(res.Name()); err == nil {
if pkg.Version() != res.Version() {
toprint += bold(green("(Installed: " + pkg.Version() + ")"))
} else {
toprint += bold(green("(Installed)"))
}
}
}
toprint += "\n " + res.Description()
fmt.Println(toprint)