diff options
author | eldritch horrors <pennae@lix.systems> | 2024-03-08 06:47:57 +0100 |
---|---|---|
committer | eldritch horrors <pennae@lix.systems> | 2024-03-09 03:37:35 -0700 |
commit | c8649239280360877a33c7aacf14889cb441f643 (patch) | |
tree | 4237444d0ca22a724dbfcb283d8a339387db9791 /src/libexpr | |
parent | 3e1be9c5304f87d84409a91c8c8a867ceaa21c3e (diff) |
Merge pull request #9929 from 9999years/dont-print-values-in-magenta
Don't print the first bracket in values in magenta in error messages
(cherry picked from commit 46a0625a40aef6946a35f92fdacf0e6b4a14414f)
Change-Id: I8435565c87db182116140eaeea9df1243e67ea94
Diffstat (limited to 'src/libexpr')
-rw-r--r-- | src/libexpr/print.cc | 7 | ||||
-rw-r--r-- | src/libexpr/print.hh | 10 |
2 files changed, 17 insertions, 0 deletions
diff --git a/src/libexpr/print.cc b/src/libexpr/print.cc index 8b45475d8..fbd91e484 100644 --- a/src/libexpr/print.cc +++ b/src/libexpr/print.cc @@ -509,4 +509,11 @@ std::ostream & operator<<(std::ostream & output, const ValuePrinter & printer) return output; } +template<> +hintformat & hintformat::operator%(const ValuePrinter & value) +{ + fmt % value; + return *this; +} + } diff --git a/src/libexpr/print.hh b/src/libexpr/print.hh index a8300264a..a542bc7b1 100644 --- a/src/libexpr/print.hh +++ b/src/libexpr/print.hh @@ -9,6 +9,7 @@ #include <iostream> +#include "fmt.hh" #include "print-options.hh" namespace nix { @@ -78,4 +79,13 @@ public: }; std::ostream & operator<<(std::ostream & output, const ValuePrinter & printer); + + +/** + * `ValuePrinter` does its own ANSI formatting, so we don't color it + * magenta. + */ +template<> +hintformat & hintformat::operator%(const ValuePrinter & value); + } |