PrintSearch receives a RepoSearch type and outputs pretty text.
(pkg alpm.Package, dbExecutor db.Executor, singleLineResults bool)
| 91 | |
| 92 | // PrintSearch receives a RepoSearch type and outputs pretty text. |
| 93 | func 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 | } |
no test coverage detected