mirror of
https://github.com/Jguer/yay
synced 2024-10-05 23:59:13 +00:00
feat(query): list debug packages missing from AUR separately
This commit is contained in:
parent
5184ef6a04
commit
3efb43af95
|
@ -2,6 +2,7 @@ package query
|
|||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
"github.com/leonelquinteros/gotext"
|
||||
|
||||
|
@ -21,9 +22,16 @@ func NewWarnings() *AURWarnings {
|
|||
}
|
||||
|
||||
func (warnings *AURWarnings) Print() {
|
||||
if len(warnings.Missing) > 0 {
|
||||
normalMissing, debugMissing := filterDebugPkgs(warnings.Missing)
|
||||
|
||||
if len(normalMissing) > 0 {
|
||||
text.Warn(gotext.Get("Missing AUR Packages:"))
|
||||
printRange(warnings.Missing)
|
||||
printRange(normalMissing)
|
||||
}
|
||||
|
||||
if len(debugMissing) > 0 {
|
||||
text.Warn(gotext.Get("Missing AUR Debug Packages:"))
|
||||
printRange(debugMissing)
|
||||
}
|
||||
|
||||
if len(warnings.Orphans) > 0 {
|
||||
|
@ -37,6 +45,21 @@ func (warnings *AURWarnings) Print() {
|
|||
}
|
||||
}
|
||||
|
||||
func filterDebugPkgs(names []string) (normal, debug []string) {
|
||||
normal = make([]string, 0)
|
||||
debug = make([]string, 0)
|
||||
|
||||
for _, name := range names {
|
||||
if strings.HasSuffix(name, "-debug") {
|
||||
debug = append(debug, name)
|
||||
} else {
|
||||
normal = append(normal, name)
|
||||
}
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
func printRange(names []string) {
|
||||
for _, name := range names {
|
||||
fmt.Print(" " + text.Cyan(name))
|
||||
|
|
Loading…
Reference in a new issue