summaryrefslogtreecommitdiff
path: root/apt-private/private-list.cc
diff options
context:
space:
mode:
authorDavid Kalnischkies <david@kalnischkies.de>2014-09-02 14:32:48 +0200
committerDavid Kalnischkies <david@kalnischkies.de>2014-09-07 19:27:10 +0200
commit1a68655de92fd036ebc7c920bc2e5e88c54eb34e (patch)
tree5f93ec94a16b0c1997f6f2b219045ff5093464b9 /apt-private/private-list.cc
parent2409df55f65c4937ceda21ba069eec769af9e460 (diff)
implement --full in apt search
Diffstat (limited to 'apt-private/private-list.cc')
-rw-r--r--apt-private/private-list.cc39
1 files changed, 17 insertions, 22 deletions
diff --git a/apt-private/private-list.cc b/apt-private/private-list.cc
index b69002103..d746acf3f 100644
--- a/apt-private/private-list.cc
+++ b/apt-private/private-list.cc
@@ -85,15 +85,14 @@ private:
};
/*}}}*/
static void ListAllVersions(pkgCacheFile &CacheFile, pkgRecords &records,/*{{{*/
- pkgCache::PkgIterator P,
- std::ostream &outs,
- bool include_summary=true)
+ pkgCache::PkgIterator const &P, std::ostream &outs,
+ std::string const &format)
{
for (pkgCache::VerIterator Ver = P.VersionList();
Ver.end() == false; ++Ver)
{
- ListSingleVersion(CacheFile, records, Ver, outs, include_summary);
- outs << "\n";
+ ListSingleVersion(CacheFile, records, Ver, outs, format);
+ outs << std::endl;
}
}
/*}}}*/
@@ -117,10 +116,9 @@ bool DoList(CommandLine &Cmd)
patterns = Cmd.FileList + 1;
}
- std::map<std::string, std::string> output_map;
- std::map<std::string, std::string>::const_iterator K;
-
- bool includeSummary = _config->FindB("APT::Cmd::List-Include-Summary");
+ std::string format = "${color:highlight}${Package}${color:neutral}/${Origin} ${Version} ${Architecture}${ }${apt:Status}";
+ if (_config->FindB("APT::Cmd::List-Include-Summary", false) == true)
+ format += "\n ${Description}\n";
PackageNameMatcher matcher(patterns);
LocalitySortedVersionSet bag;
@@ -130,36 +128,33 @@ bool DoList(CommandLine &Cmd)
Cache->Head().PackageCount,
_("Listing"));
GetLocalitySortedVersionSet(CacheFile, bag, matcher, progress);
- bool ShowAllVersions = _config->FindB("APT::Cmd::All-Versions", false);
+ bool const ShowAllVersions = _config->FindB("APT::Cmd::All-Versions", false);
+ std::map<std::string, std::string> output_map;
for (LocalitySortedVersionSet::iterator V = bag.begin(); V != bag.end(); ++V)
{
std::stringstream outs;
if(ShowAllVersions == true)
- {
- ListAllVersions(CacheFile, records, V.ParentPkg(), outs, includeSummary);
- output_map.insert(std::make_pair<std::string, std::string>(
- V.ParentPkg().Name(), outs.str()));
- } else {
- ListSingleVersion(CacheFile, records, V, outs, includeSummary);
- output_map.insert(std::make_pair<std::string, std::string>(
- V.ParentPkg().Name(), outs.str()));
- }
+ ListAllVersions(CacheFile, records, V.ParentPkg(), outs, format);
+ else
+ ListSingleVersion(CacheFile, records, V, outs, format);
+ output_map.insert(std::make_pair<std::string, std::string>(
+ V.ParentPkg().Name(), outs.str()));
}
// FIXME: SORT! and make sorting flexible (alphabetic, by pkg status)
// output the sorted map
+ std::map<std::string, std::string>::const_iterator K;
for (K = output_map.begin(); K != output_map.end(); ++K)
std::cout << (*K).second << std::endl;
-
// be nice and tell the user if there is more to see
if (bag.size() == 1 && ShowAllVersions == false)
{
// start with -1 as we already displayed one version
int versions = -1;
pkgCache::VerIterator Ver = *bag.begin();
- for ( ; Ver.end() == false; Ver++)
- versions++;
+ for ( ; Ver.end() == false; ++Ver)
+ ++versions;
if (versions > 0)
_error->Notice(P_("There is %i additional version. Please use the '-a' switch to see it", "There are %i additional versions. Please use the '-a' switch to see them.", versions), versions);
}