MCPcopy
hub / github.com/Jguer/yay / syncPkgSearchString

Function syncPkgSearchString

pkg/query/types.go:93–122  ·  view source on GitHub ↗

PrintSearch receives a RepoSearch type and outputs pretty text.

(pkg alpm.Package, dbExecutor db.Executor, singleLineResults bool)

Source from the content-addressed store, hash-verified

91
92// PrintSearch receives a RepoSearch type and outputs pretty text.
93func syncPkgSearchString(pkg alpm.Package, dbExecutor db.Executor, singleLineResults bool) string {
94 linkText := text.Bold(text.ColorHash(pkg.DB().Name())) + "/" + text.Bold(pkg.Name())
95 toPrint := text.CreateRepoLink(pkg.DB().Name(), pkg.Architecture(), pkg.Name(), linkText) +
96 " " + text.Cyan(pkg.Version()) +
97 text.Bold(" ("+text.Human(pkg.Size())+
98 " "+text.Human(pkg.ISize())+") ")
99
100 packageGroups := dbExecutor.PackageGroups(pkg)
101 if len(packageGroups) != 0 {
102 toPrint += fmt.Sprint(packageGroups, " ")
103 }
104
105 if localPkg := dbExecutor.LocalPackage(pkg.Name()); localPkg != nil {
106 if localPkg.Version() != pkg.Version() {
107 toPrint += text.Bold(text.Green(gotext.Get("(Installed: %s)", localPkg.Version())))
108 } else {
109 toPrint += text.Bold(text.Green(gotext.Get("(Installed)")))
110 }
111 }
112
113 if singleLineResults {
114 toPrint += "\t"
115 } else {
116 toPrint += "\n "
117 }
118
119 toPrint += pkg.Description()
120
121 return toPrint
122}

Callers 1

ResultsMethod · 0.85

Calls 15

BoldFunction · 0.92
ColorHashFunction · 0.92
CreateRepoLinkFunction · 0.92
CyanFunction · 0.92
HumanFunction · 0.92
GreenFunction · 0.92
ArchitectureMethod · 0.80
VersionMethod · 0.80
SizeMethod · 0.80
ISizeMethod · 0.80
DescriptionMethod · 0.80
PackageGroupsMethod · 0.65

Tested by

no test coverage detected