1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-27 16:51:15 +02:00

Rename yellowtxt -> magentatxt

`yellowtxt` wraps its value with `ANSI_WARNING`, but `ANSI_WARNING` has
been equal to `ANSI_MAGENTA` for a long time. Now the name is updated.
This commit is contained in:
Rebecca Turner 2024-02-03 19:16:30 -08:00
parent 49cf090cb2
commit a7939a6c2a
No known key found for this signature in database
3 changed files with 9 additions and 11 deletions

View file

@ -63,19 +63,17 @@ inline std::string fmt(const std::string & fs, const Args & ... args)
return f.str();
}
// -----------------------------------------------------------------------------
// format function for hints in errors. same as fmt, except templated values
// are always in yellow.
// are always in magenta.
template <class T>
struct yellowtxt
struct magentatxt
{
yellowtxt(const T &s) : value(s) {}
magentatxt(const T &s) : value(s) {}
const T & value;
};
template <class T>
std::ostream & operator<<(std::ostream & out, const yellowtxt<T> & y)
std::ostream & operator<<(std::ostream & out, const magentatxt<T> & y)
{
return out << ANSI_WARNING << y.value << ANSI_NORMAL;
}
@ -114,7 +112,7 @@ public:
template<class T>
hintformat & operator%(const T & value)
{
fmt % yellowtxt(value);
fmt % magentatxt(value);
return *this;
}