summaryrefslogtreecommitdiff
path: root/cmdline/apt-cache.cc
diff options
context:
space:
mode:
authorDavid Kalnischkies <kalnischkies@gmail.com>2010-07-26 09:22:53 +0200
committerDavid Kalnischkies <kalnischkies@gmail.com>2010-07-26 09:22:53 +0200
commita5032f842366f482371173d030e505d79366fd19 (patch)
tree475c374648bbc057874d9f4985ddbbd9c746443e /cmdline/apt-cache.cc
parentf6bfb482a32543deed925b127c972a7c258df4a1 (diff)
add APT::Cache::ShowOnlyFirstOr option to print only the first
alternative in the apt-cache (r)depends commands
Diffstat (limited to 'cmdline/apt-cache.cc')
-rw-r--r--cmdline/apt-cache.cc12
1 files changed, 10 insertions, 2 deletions
diff --git a/cmdline/apt-cache.cc b/cmdline/apt-cache.cc
index 1a1ddcb8c..88bf3a049 100644
--- a/cmdline/apt-cache.cc
+++ b/cmdline/apt-cache.cc
@@ -580,6 +580,7 @@ bool Depends(CommandLine &CmdL)
bool const ShowConflicts = _config->FindB("APT::Cache::ShowConflicts", Important == false);
bool const ShowBreaks = _config->FindB("APT::Cache::ShowBreaks", Important == false);
bool const ShowEnhances = _config->FindB("APT::Cache::ShowEnhances", Important == false);
+ bool const ShowOnlyFirstOr = _config->FindB("APT::Cache::ShowOnlyFirstOr", false);
bool DidSomething;
do
{
@@ -618,7 +619,7 @@ bool Depends(CommandLine &CmdL)
if((Installed && Trg->CurrentVer != 0) || !Installed)
{
- if ((D->CompareOp & pkgCache::Dep::Or) == pkgCache::Dep::Or)
+ if ((D->CompareOp & pkgCache::Dep::Or) == pkgCache::Dep::Or && ShowOnlyFirstOr == false)
cout << " |";
else
cout << " ";
@@ -650,6 +651,9 @@ bool Depends(CommandLine &CmdL)
if (Recurse == true)
Colours[D.ParentPkg()->ID]++;
}
+
+ if (ShowOnlyFirstOr == true)
+ while ((D->CompareOp & pkgCache::Dep::Or) == pkgCache::Dep::Or) ++D;
}
}
}
@@ -687,6 +691,7 @@ bool RDepends(CommandLine &CmdL)
bool const ShowConflicts = _config->FindB("APT::Cache::ShowConflicts", Important == false);
bool const ShowBreaks = _config->FindB("APT::Cache::ShowBreaks", Important == false);
bool const ShowEnhances = _config->FindB("APT::Cache::ShowEnhances", Important == false);
+ bool const ShowOnlyFirstOr = _config->FindB("APT::Cache::ShowOnlyFirstOr", false);
bool DidSomething;
do
{
@@ -727,7 +732,7 @@ bool RDepends(CommandLine &CmdL)
if((Installed && Trg->CurrentVer != 0) || !Installed)
{
- if ((D->CompareOp & pkgCache::Dep::Or) == pkgCache::Dep::Or)
+ if ((D->CompareOp & pkgCache::Dep::Or) == pkgCache::Dep::Or && ShowOnlyFirstOr == false)
cout << " |";
else
cout << " ";
@@ -758,6 +763,9 @@ bool RDepends(CommandLine &CmdL)
if (Recurse == true)
Colours[D.ParentPkg()->ID]++;
}
+
+ if (ShowOnlyFirstOr == true)
+ while ((D->CompareOp & pkgCache::Dep::Or) == pkgCache::Dep::Or) ++D;
}
}
}