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 tostdoutprint_to: Prints to providedstd::FILE*streamformat: Obtains formatted text as astd::stringformat_to: fullyconstexprcode 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
forestto build tree viaadd_subdirectory(path/to/forest), or - Locate
forestviafind_package(forest)(must be installed to a path inCMAKE_INSTALL_PREFIX)
- Add
- Link to
forestviatarget_link_libraries(your_project PRIVATE forest::forest)(usePUBLICinstead to propagate include paths to all dependencies)
- Import