summaryrefslogtreecommitdiffstats
path: root/apt-private/private-output.cc
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--apt-private/private-output.cc35
1 files changed, 24 insertions, 11 deletions
diff --git a/apt-private/private-output.cc b/apt-private/private-output.cc
index 95dc740..09d03d3 100644
--- a/apt-private/private-output.cc
+++ b/apt-private/private-output.cc
@@ -1,6 +1,7 @@
// Include files /*{{{*/
#include <config.h>
+#include <apt-pkg/aptconfiguration.h>
#include <apt-pkg/cachefile.h>
#include <apt-pkg/configuration.h>
#include <apt-pkg/depcache.h>
@@ -30,6 +31,7 @@
/*}}}*/
using namespace std;
+using APT::Configuration::color;
std::ostream c0out(0);
std::ostream c1out(0);
@@ -86,7 +88,7 @@ bool InitOutput(std::basic_streambuf<char> * const out) /*{{{*/
SigWinch(0);
}
- if (isatty(STDOUT_FILENO) == 0 || not _config->FindB("APT::Color", true) || getenv("NO_COLOR") != nullptr)
+ if (isatty(STDOUT_FILENO) == 0 || not _config->FindB("APT::Color", true) || getenv("NO_COLOR") != nullptr || getenv("APT_NO_COLOR") != nullptr)
{
_config->Set("APT::Color", false);
_config->Set("APT::Color::Highlight", "");
@@ -94,6 +96,7 @@ bool InitOutput(std::basic_streambuf<char> * const out) /*{{{*/
} else {
// Colors
_config->CndSet("APT::Color::Highlight", "\x1B[32m");
+ _config->CndSet("APT::Color::Bold", "\x1B[1m");
_config->CndSet("APT::Color::Neutral", "\x1B[0m");
_config->CndSet("APT::Color::Red", "\x1B[31m");
@@ -103,6 +106,14 @@ bool InitOutput(std::basic_streambuf<char> * const out) /*{{{*/
_config->CndSet("APT::Color::Magenta", "\x1B[35m");
_config->CndSet("APT::Color::Cyan", "\x1B[36m");
_config->CndSet("APT::Color::White", "\x1B[37m");
+
+ _config->CndSet("APT::Color::Action::Upgrade", "green");
+ _config->CndSet("APT::Color::Action::Install", "green");
+ _config->CndSet("APT::Color::Action::Install-Dependencies", "green");
+ _config->CndSet("APT::Color::Action::Downgrade", "yellow");
+ _config->CndSet("APT::Color::Action::Remove", "red");
+ _config->CndSet("APT::Color::Show::Field", "\x1B[1m");
+ _config->CndSet("APT::Color::Show::Package", "\x1B[32m");
}
return true;
@@ -302,8 +313,8 @@ void ListSingleVersion(pkgCacheFile &CacheFile, pkgRecords &records, /*{{{*/
else if (V.ParentPkg()->CurrentState == pkgCache::State::ConfigFiles)
StatusStr = _("[residual-config]");
output = SubstVar(output, "${apt:Status}", StatusStr);
- output = SubstVar(output, "${color:highlight}", _config->Find("APT::Color::Highlight", ""));
- output = SubstVar(output, "${color:neutral}", _config->Find("APT::Color::Neutral", ""));
+ output = SubstVar(output, "${color:highlight}", color("Highlight"));
+ output = SubstVar(output, "${color:neutral}", color("Neutral"));
output = SubstVar(output, "${Description}", GetShortDescription(CacheFile, records, P));
if (output.find("${LongDescription}") != string::npos)
output = SubstVar(output, "${LongDescription}", GetLongDescription(CacheFile, records, P));
@@ -555,7 +566,7 @@ void ShowNew(ostream &out,CacheFile &Cache)
[&Cache](pkgCache::PkgIterator const &Pkg) { return Cache[Pkg].NewInstall(); },
&PrettyFullName,
CandidateVersion(&Cache),
- "APT::Color::Green");
+ "action::install");
return;
}
@@ -563,12 +574,12 @@ void ShowNew(ostream &out,CacheFile &Cache)
[&Cache](pkgCache::PkgIterator const &Pkg) { return Cache[Pkg].NewInstall() && (Cache[Pkg].Flags & pkgCache::Flag::Auto) == 0; },
&PrettyFullName,
CandidateVersion(&Cache),
- "APT::Color::Green");
+ "action::install");
ShowList(out,_("Installing dependencies:"), Universe,
[&Cache](pkgCache::PkgIterator const &Pkg) { return Cache[Pkg].NewInstall() && Cache[Pkg].Flags & pkgCache::Flag::Auto;},
&PrettyFullName,
CandidateVersion(&Cache),
- "APT::Color::Green");
+ "action::install-dependencies");
}
/*}}}*/
// ShowDel - Show packages to delete /*{{{*/
@@ -586,7 +597,7 @@ void ShowDel(ostream &out,CacheFile &Cache)
return str;
},
CandidateVersion(&Cache),
- "APT::Color::Red");
+ "action::remove");
}
/*}}}*/
// ShowPhasing - Show packages kept due to phasing /*{{{*/
@@ -625,7 +636,7 @@ void ShowUpgraded(ostream &out,CacheFile &Cache)
},
&PrettyFullName,
CurrentToCandidateVersion(&Cache),
- "APT::Color::Green");
+ "action::upgrade");
}
/*}}}*/
// ShowDowngraded - Show downgraded packages /*{{{*/
@@ -642,7 +653,7 @@ bool ShowDowngraded(ostream &out,CacheFile &Cache)
},
&PrettyFullName,
CurrentToCandidateVersion(&Cache),
- "APT::Color::Yellow");
+ "action::downgrade");
}
/*}}}*/
// ShowHold - Show held but changed packages /*{{{*/
@@ -791,10 +802,12 @@ bool YnPrompt(char const * const Question, bool const Default, bool const ShowGl
// if we ask interactively, show warnings/notices before the question
if (ShowGlobalErrors == true && AssumeYes == false && AssumeNo == false)
{
- if (_config->FindI("quiet",0) > 0)
+ if (_config->FindB("APT::Audit"))
+ _error->DumpErrors(c2o, GlobalError::AUDIT);
+ else if (_config->FindI("quiet",0) > 0)
_error->DumpErrors(c2o);
else
- _error->DumpErrors(c2o, GlobalError::DEBUG);
+ _error->DumpErrors(c2o, GlobalError::NOTICE);
}
c2o << Question << std::flush;