Added 'search' subcommand and removed repository functionality from 'info' subcommand

This commit is contained in:
2024-09-08 12:51:47 +03:00
parent c24b7c85e3
commit 6247c6eff7
2 changed files with 42 additions and 45 deletions
+2 -18
View File
@@ -353,7 +353,7 @@ func CreateInfoFile(pkgInfo *PackageInfo) string {
return string(bytes)
}
func CreateReadableInfo(showArchitecture, showType, showPackageRelations, showRemoteInfo, showInstallationReason bool, pkgInfo *PackageInfo, rootDir string) string {
func CreateReadableInfo(showArchitecture, showType, showPackageRelations bool, pkgInfo *PackageInfo, rootDir string) string {
ret := make([]string, 0)
appendArray := func(label string, array []string) {
if len(array) == 0 {
@@ -380,23 +380,7 @@ func CreateReadableInfo(showArchitecture, showType, showPackageRelations, showRe
appendArray("Provided packages", pkgInfo.Provides)
}
if showRemoteInfo {
arr := make([]string, 0)
for _, repo := range BPMConfig.Repositories {
if repo.ContainsPackage(pkgInfo.Name) {
arr = append(arr, repo.Name)
}
}
appendArray("Repositories", arr)
}
if showInstallationReason {
if IsPackageInstalled(pkgInfo.Name, rootDir) {
ret = append(ret, "Installed: yes")
ret = append(ret, "Installation Reason: "+string(GetInstallationReason(pkgInfo.Name, rootDir)))
} else {
ret = append(ret, "Installed: no")
}
}
ret = append(ret, "Installation Reason: "+string(GetInstallationReason(pkgInfo.Name, rootDir)))
return strings.Join(ret, "\n")
}