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

Function aurPkgSearchString

pkg/query/types.go:50–90  ·  view source on GitHub ↗
(
	pkg *aur.Pkg,
	dbExecutor db.Executor,
	singleLineResults bool,
)

Source from the content-addressed store, hash-verified

48}
49
50func aurPkgSearchString(
51 pkg *aur.Pkg,
52 dbExecutor db.Executor,
53 singleLineResults bool,
54) string {
55 linkText := text.Bold(text.ColorHash("aur")) + "/" + text.Bold(pkg.Name)
56 toPrint := text.CreateRepoLink("aur", "", pkg.Name, linkText) +
57 " " + text.Cyan(pkg.Version) +
58 text.Bold(" (+"+strconv.Itoa(pkg.NumVotes)) +
59 " " + text.Bold(strconv.FormatFloat(pkg.Popularity, 'f', 2, 64)+") ")
60
61 if ageTag := text.FormatAgeTag(int64(pkg.LastModified)); ageTag != "" {
62 toPrint += ageTag + " "
63 }
64
65 if pkg.Maintainer == "" {
66 toPrint += text.Bold(text.Red(gotext.Get("(Orphaned)"))) + " "
67 }
68
69 if pkg.OutOfDate != 0 {
70 toPrint += text.Bold(text.Red(gotext.Get("(Out-of-date: %s)", text.FormatTime(pkg.OutOfDate)))) + " "
71 }
72
73 if localPkg := dbExecutor.LocalPackage(pkg.Name); localPkg != nil {
74 if localPkg.Version() != pkg.Version {
75 toPrint += text.Bold(text.Green(gotext.Get("(Installed: %s)", localPkg.Version())))
76 } else {
77 toPrint += text.Bold(text.Green(gotext.Get("(Installed)")))
78 }
79 }
80
81 if singleLineResults {
82 toPrint += "\t"
83 } else {
84 toPrint += "\n "
85 }
86
87 toPrint += pkg.Description
88
89 return toPrint
90}
91
92// PrintSearch receives a RepoSearch type and outputs pretty text.
93func syncPkgSearchString(pkg alpm.Package, dbExecutor db.Executor, singleLineResults bool) string {

Callers 1

ResultsMethod · 0.85

Calls 11

BoldFunction · 0.92
ColorHashFunction · 0.92
CreateRepoLinkFunction · 0.92
CyanFunction · 0.92
FormatAgeTagFunction · 0.92
RedFunction · 0.92
FormatTimeFunction · 0.92
GreenFunction · 0.92
VersionMethod · 0.80
GetMethod · 0.65
LocalPackageMethod · 0.65

Tested by

no test coverage detected