WIP: fmt: add convenience functions

Change-Id: I48f14b4e9f722485482ec7952565e79084c6f5ed
This commit is contained in:
Qyriad 2024-07-04 15:27:53 -06:00
parent 95edfa1d03
commit ddc3e3bcfc

View file

@ -10,11 +10,28 @@
#define BOOST_STACKTRACE_GNU_SOURCE_NOT_REQUIRED #define BOOST_STACKTRACE_GNU_SOURCE_NOT_REQUIRED
#endif #endif
#include <boost/stacktrace.hpp> #include <boost/stacktrace.hpp>
#include <fmt/core.h>
#include <fmt/format.h>
#include "ansicolor.hh" #include "ansicolor.hh"
namespace nix { namespace nix {
/// Hot sale: order now and you can get two characters off of every fmt::format() call!
template<typename ...Args>
inline auto fmtformat(fmt::format_string<Args...> format, Args && ...args)
{
return fmt::format(format, std::forward<Args>(args)...);
}
using fmt::println;
template<typename ...Args>
inline void eprintln(fmt::format_string<Args...> format, Args && ...args)
{
return fmt::println(stderr, format, std::forward<Args>(args)...);
}
/** /**
* Values wrapped in this struct are printed in magenta. * Values wrapped in this struct are printed in magenta.
* *