Merge pull request #5245 from edolstra/warnings
Change warning messages from yellow to magenta
This commit is contained in:
commit
a4ae601b44
|
@ -9,7 +9,7 @@ namespace nix {
|
||||||
#define ANSI_ITALIC "\e[3m"
|
#define ANSI_ITALIC "\e[3m"
|
||||||
#define ANSI_RED "\e[31;1m"
|
#define ANSI_RED "\e[31;1m"
|
||||||
#define ANSI_GREEN "\e[32;1m"
|
#define ANSI_GREEN "\e[32;1m"
|
||||||
#define ANSI_YELLOW "\e[33;1m"
|
#define ANSI_WARNING "\e[35;1m"
|
||||||
#define ANSI_BLUE "\e[34;1m"
|
#define ANSI_BLUE "\e[34;1m"
|
||||||
#define ANSI_MAGENTA "\e[35;1m"
|
#define ANSI_MAGENTA "\e[35;1m"
|
||||||
#define ANSI_CYAN "\e[36;1m"
|
#define ANSI_CYAN "\e[36;1m"
|
||||||
|
|
|
@ -185,15 +185,15 @@ void printAtPos(const ErrPos & pos, std::ostream & out)
|
||||||
if (pos) {
|
if (pos) {
|
||||||
switch (pos.origin) {
|
switch (pos.origin) {
|
||||||
case foFile: {
|
case foFile: {
|
||||||
out << fmt(ANSI_BLUE "at " ANSI_YELLOW "%s:%s" ANSI_NORMAL ":", pos.file, showErrPos(pos));
|
out << fmt(ANSI_BLUE "at " ANSI_WARNING "%s:%s" ANSI_NORMAL ":", pos.file, showErrPos(pos));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case foString: {
|
case foString: {
|
||||||
out << fmt(ANSI_BLUE "at " ANSI_YELLOW "«string»:%s" ANSI_NORMAL ":", showErrPos(pos));
|
out << fmt(ANSI_BLUE "at " ANSI_WARNING "«string»:%s" ANSI_NORMAL ":", showErrPos(pos));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case foStdin: {
|
case foStdin: {
|
||||||
out << fmt(ANSI_BLUE "at " ANSI_YELLOW "«stdin»:%s" ANSI_NORMAL ":", showErrPos(pos));
|
out << fmt(ANSI_BLUE "at " ANSI_WARNING "«stdin»:%s" ANSI_NORMAL ":", showErrPos(pos));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
|
@ -232,7 +232,7 @@ std::ostream & showErrorInfo(std::ostream & out, const ErrorInfo & einfo, bool s
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case Verbosity::lvlWarn: {
|
case Verbosity::lvlWarn: {
|
||||||
prefix = ANSI_YELLOW "warning";
|
prefix = ANSI_WARNING "warning";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case Verbosity::lvlInfo: {
|
case Verbosity::lvlInfo: {
|
||||||
|
@ -252,7 +252,7 @@ std::ostream & showErrorInfo(std::ostream & out, const ErrorInfo & einfo, bool s
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case Verbosity::lvlDebug: {
|
case Verbosity::lvlDebug: {
|
||||||
prefix = ANSI_YELLOW "debug";
|
prefix = ANSI_WARNING "debug";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -82,7 +82,7 @@ struct yellowtxt
|
||||||
template <class T>
|
template <class T>
|
||||||
std::ostream & operator<<(std::ostream & out, const yellowtxt<T> & y)
|
std::ostream & operator<<(std::ostream & out, const yellowtxt<T> & y)
|
||||||
{
|
{
|
||||||
return out << ANSI_YELLOW << y.value << ANSI_NORMAL;
|
return out << ANSI_WARNING << y.value << ANSI_NORMAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
|
|
|
@ -27,7 +27,7 @@ Logger * logger = makeSimpleLogger(true);
|
||||||
|
|
||||||
void Logger::warn(const std::string & msg)
|
void Logger::warn(const std::string & msg)
|
||||||
{
|
{
|
||||||
log(lvlWarn, ANSI_YELLOW "warning:" ANSI_NORMAL " " + msg);
|
log(lvlWarn, ANSI_WARNING "warning:" ANSI_NORMAL " " + msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Logger::writeToStdout(std::string_view s)
|
void Logger::writeToStdout(std::string_view s)
|
||||||
|
|
|
@ -336,7 +336,7 @@ namespace nix {
|
||||||
|
|
||||||
ASSERT_STREQ(
|
ASSERT_STREQ(
|
||||||
hintfmt("only one arg %1% %2%", "fulfilled").str().c_str(),
|
hintfmt("only one arg %1% %2%", "fulfilled").str().c_str(),
|
||||||
"only one arg " ANSI_YELLOW "fulfilled" ANSI_NORMAL " ");
|
"only one arg " ANSI_WARNING "fulfilled" ANSI_NORMAL " ");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -344,7 +344,7 @@ namespace nix {
|
||||||
|
|
||||||
ASSERT_STREQ(
|
ASSERT_STREQ(
|
||||||
hintfmt("what about this %1% %2%", "%3%", "one", "two").str().c_str(),
|
hintfmt("what about this %1% %2%", "%3%", "one", "two").str().c_str(),
|
||||||
"what about this " ANSI_YELLOW "%3%" ANSI_NORMAL " " ANSI_YELLOW "one" ANSI_NORMAL);
|
"what about this " ANSI_WARNING "%3%" ANSI_NORMAL " " ANSI_YELLOW "one" ANSI_NORMAL);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -962,7 +962,7 @@ struct CmdFlakeShow : FlakeCommand
|
||||||
if (attrPath.size() == 1)
|
if (attrPath.size() == 1)
|
||||||
recurse();
|
recurse();
|
||||||
else if (!showLegacy)
|
else if (!showLegacy)
|
||||||
logger->cout("%s: " ANSI_YELLOW "omitted" ANSI_NORMAL " (use '--legacy' to show)", headerPrefix);
|
logger->cout("%s: " ANSI_WARNING "omitted" ANSI_NORMAL " (use '--legacy' to show)", headerPrefix);
|
||||||
else {
|
else {
|
||||||
if (visitor.isDerivation())
|
if (visitor.isDerivation())
|
||||||
showDerivation();
|
showDerivation();
|
||||||
|
@ -997,7 +997,7 @@ struct CmdFlakeShow : FlakeCommand
|
||||||
|| (attrPath.size() == 2 && attrPath[0] == "overlays") ? "Nixpkgs overlay" :
|
|| (attrPath.size() == 2 && attrPath[0] == "overlays") ? "Nixpkgs overlay" :
|
||||||
attrPath.size() == 2 && attrPath[0] == "nixosConfigurations" ? "NixOS configuration" :
|
attrPath.size() == 2 && attrPath[0] == "nixosConfigurations" ? "NixOS configuration" :
|
||||||
attrPath.size() == 2 && attrPath[0] == "nixosModules" ? "NixOS module" :
|
attrPath.size() == 2 && attrPath[0] == "nixosModules" ? "NixOS module" :
|
||||||
ANSI_YELLOW "unknown" ANSI_NORMAL);
|
ANSI_WARNING "unknown" ANSI_NORMAL);
|
||||||
}
|
}
|
||||||
} catch (EvalError & e) {
|
} catch (EvalError & e) {
|
||||||
if (!(attrPath.size() > 0 && attrPath[0] == "legacyPackages"))
|
if (!(attrPath.size() > 0 && attrPath[0] == "legacyPackages"))
|
||||||
|
|
|
@ -707,7 +707,7 @@ std::ostream & NixRepl::printValue(std::ostream & str, Value & v, unsigned int m
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case nString:
|
case nString:
|
||||||
str << ANSI_YELLOW;
|
str << ANSI_WARNING;
|
||||||
printStringValue(str, v.string.s);
|
printStringValue(str, v.string.s);
|
||||||
str << ANSI_NORMAL;
|
str << ANSI_NORMAL;
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in a new issue