ANSI escape code text formatter
forest
is a loose acronym for format escape terminal. It is a single-header lightweight library for transforming marked-up text into a stream of characters and ANSI escape codes. This text can then be piped out to terminals that support such escape sequences.
forest
provides some flexibility in usage of its API:
print
: The most straightforward function, prints tostdout
print_to
: Prints to providedstd::FILE*
streamformat
: Obtains formatted text as astd::string
format_to
: fullyconstexpr
code path that formats text to a provided output iteratorliteral
: compile-time alternative for literals
example/forest-example.cpp contains some samples.
- C++17
- CMake 3.17+ [optional]
- Copy include/forest/forest.hpp into your build tree, or
- Use CMake:
- Import
forest
- Add
forest
to build tree viaadd_subdirectory(path/to/forest)
, or - Locate
forest
viafind_package(forest)
(must be installed to a path inCMAKE_INSTALL_PREFIX
)
- Add
- Link to
forest
viatarget_link_libraries(your_project PRIVATE forest::forest)
(usePUBLIC
instead to propagate include paths to all dependencies)
- Import