summaryrefslogtreecommitdiff
path: root/apt-private/private-list.cc
diff options
context:
space:
mode:
authorMichael Vogt <mvo@ubuntu.com>2014-04-09 16:23:14 +0200
committerMichael Vogt <mvo@ubuntu.com>2014-04-09 16:23:14 +0200
commitd6570f8577a955a6950ef9fe1ee9def401759336 (patch)
treef228f37556d0907dacd73709d5e5822cd362807c /apt-private/private-list.cc
parent5572f6bdcb947e11f32e2a035438d9d3899ad46d (diff)
Notice the user about "apt list -a" when only a single hit if found
If the user is using "apt list pattern" and there is only a single hit, notice about "--all-versions" as this is what the user may be interessted in
Diffstat (limited to 'apt-private/private-list.cc')
-rw-r--r--apt-private/private-list.cc15
1 files changed, 14 insertions, 1 deletions
diff --git a/apt-private/private-list.cc b/apt-private/private-list.cc
index b053cbcbe..b69002103 100644
--- a/apt-private/private-list.cc
+++ b/apt-private/private-list.cc
@@ -130,10 +130,11 @@ bool DoList(CommandLine &Cmd)
Cache->Head().PackageCount,
_("Listing"));
GetLocalitySortedVersionSet(CacheFile, bag, matcher, progress);
+ bool ShowAllVersions = _config->FindB("APT::Cmd::All-Versions", false);
for (LocalitySortedVersionSet::iterator V = bag.begin(); V != bag.end(); ++V)
{
std::stringstream outs;
- if(_config->FindB("APT::Cmd::All-Versions", false) == true)
+ if(ShowAllVersions == true)
{
ListAllVersions(CacheFile, records, V.ParentPkg(), outs, includeSummary);
output_map.insert(std::make_pair<std::string, std::string>(
@@ -151,6 +152,18 @@ bool DoList(CommandLine &Cmd)
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++;
+ 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);
+ }
+
return true;
}