mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-22 14:06:16 +02:00
add normaltxt, yellowify->yellowtxt
This commit is contained in:
parent
8c8f2b74ec
commit
f30de61578
1 changed files with 17 additions and 4 deletions
|
@ -73,18 +73,31 @@ inline std::string fmt(const std::string & fs, const Args & ... args)
|
|||
// are always in yellow.
|
||||
|
||||
template <class T>
|
||||
struct yellowify
|
||||
struct yellowtxt
|
||||
{
|
||||
yellowify(T &s) : value(s) {}
|
||||
yellowtxt(T &s) : value(s) {}
|
||||
T &value;
|
||||
};
|
||||
|
||||
template <class T>
|
||||
std::ostream& operator<<(std::ostream &out, const yellowify<T> &y)
|
||||
std::ostream& operator<<(std::ostream &out, const yellowtxt<T> &y)
|
||||
{
|
||||
return out << ANSI_YELLOW << y.value << ANSI_NORMAL;
|
||||
}
|
||||
|
||||
template <class T>
|
||||
struct normaltxt
|
||||
{
|
||||
normaltxt(T &s) : value(s) {}
|
||||
T &value;
|
||||
};
|
||||
|
||||
template <class T>
|
||||
std::ostream& operator<<(std::ostream &out, const normaltxt<T> &y)
|
||||
{
|
||||
return out << ANSI_NORMAL << y.value;
|
||||
}
|
||||
|
||||
class hintformat
|
||||
{
|
||||
public:
|
||||
|
@ -100,7 +113,7 @@ public:
|
|||
template<class T>
|
||||
hintformat& operator%(const T &value)
|
||||
{
|
||||
fmt % yellowify(value);
|
||||
fmt % yellowtxt(value);
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue